Nine numeric parameters define the appearance of a custom light. Typically the texture coordinates and size are not modified. Most X-Plane provided datarefs for lights reinterpret the RGBA values (and replace them with white and a variable-level alpha) lights can be colored by coloring their texture. In return for this flexibility, the author loses control of the tint of the light (because the dataref always sets the light tint to white). In this example, the meaning of RGBA is completely changed – instead these four parameters form a vector and light number. The result is a directional landing light. The dataref replaces the RGB values with 1,1,1 (white) and the alpha value with the brightness based on the current camera angle, or 0.0 if the light is off. (This is a light where X = 0, Y = 0, and Z = -1.) A = 2 would mean the third landing light is used A = 0 means the first landing light. So RGB = 0 0 -1 means that the light points toward the front of the aircraft. The alpha parameter is interpreted as an index number for the landing light switches. Example: the dataref sim/graphics/animation/lights/airplane_landing_light interprets the red, green, and blue parameters as a direction vector for the light. In this case the “meaning” of those lighting parameters depends on the dataref. The most complex case is the one where lighting parameters are interpreted by a plugin and then replaced. Custom Lights with Plugin-Modified Parameters You can put any RGBA into your custom light with sim/graphics/animation/lights/airplane_strobe_light and it will always come out white. ![]() Other parameters (RGBA) are replaced by the plugin, so the values in the OBJ file do not matter. In this example, some of the light parameters (size, texture coordinates) work normally. Thus adding this dataref to a custom light makes it into a white strobe. Example: The dataref sim/graphics/animation/lights/airplane_strobe_light replaces the red, green, and blue parameters with 1.0, an the alpha parameter with 0.0 if the airplane strobes are not flashing or 1.0 if they are. Custom Lights with Plugin-Replaced ParametersĪ more complex use involves using a plugin that replaces certain parameters. Example: an object uses a custom light with no dataref to make a simple, omnidirectional, always-on light. Your light will be drawn based on the parameters in the OBJ file. The simplest way to use a custom light is to not use a dataref at all. There are a number of ways to use custom lights (with or without datarefs): Simple Custom Lights Usage Models for Custom Lights and Datarefs This process happens each time the light is drawn – that is, the next time the light is drawn, X-Plane starts over with the original OBJ parameters. X-Plane then draws the billboard with the parameters (as modified by the plugin).That custom dataref code can then modify or replace the parameters.X-Plane passes those 9 parameters to the dataref code (in a plugin or X-Plane) for the custom light (if it has a dataref associated with it).First, X-Plane starts with the 9 parameters from the OBJ file.When a custom light is drawn, the following steps occur: Behind every dataref is some code (in a plugin or X-Plane) that provides the dataref value. In order to understand how custom lights work, you must understand that datarefs can act as processing functions as well as sources of information. ![]() Example: if you attach a landing light to an airplane and put it inside an animation for the landing gear, then the light’s directionality will change as the plane flies and as the gear retracts. When a dataref indicates that a light is “directional” in a certain direction, remember that this is relative to the object, and can be affected by animation. Like named lights, custom lights are affected by animation (both rotation/translation and show-hide) as well as the object’s position. The lighting parameters specify RGBA tinting of the texture, as well as the texture coordinates, and apparent size of the billboard.Ĭustom lights may have a DataRef associated with them if the light does have a dataref, that dataref modifies the lighting parameters when the light is drawn, for animated effects. The texture of the billboard is a subsection of the OBJ texture. Custom lights are always rendered as a textured billboard (no matter what the user’s settings and hardware).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |