Additive Lighting

= Additive Lighting Equation = X-Plane's fundamental "lighting" equation is fundamentally this: albedo texture * external light level + emissive texture * internal light level To define these components:
 * The albedo texture is the "daytime" texture, used for an OBJ, airplane fuselage, or instrument. Typically it does not have a suffix.  It  contains an image of the object at its brightest during the day.
 * The emissive texture is the "_LIT" texture, used for an OBJ, airplane fuselage, or instrument. The emissive texture typically contains the image of the parts of the object that emit light (e.g. light bulbs, neon signs).
 * The external lighting level is the sum of all light falling on the object/instrument, etc. This usually includes the effects of the sun, and sometimes also landing lights or in-cockpit spot lights.
 * The internal light level is the attenuation of the brightness the object/instrument is emitting. For example, the LED digits on a radio might have their brightness turned down by the user.

= Additive Lighting in the Scenery System =

Additive lighting has been available in the scenery system for a very long time via emissive textures.
 * For older scenery file formats, X-Plane will automatically look for a texture with the suffix _LIT and use it as an emissive texture.
 * For newer scenery file formats, there is typically a texture command (like TEXTURE_LIT) to define the name of the emissive lighting texture.
 * Mostly the internal light level for emissive textures is determined by X-Plane. In 930, OBJ authors can override this light level using ATTR_light_level.

= Additive Lighting for Instruments =

In older versions of X-Plane, additive lighting was not available for instruments.


 * Starting with X-Plane 920, generic instruments can use additive lighting - set the lighting mode for the instrument to "back-lit" and provide _LIT versions of the overlay textures. (The -1 overlay would be XXX_LIT-1.png, for example.)
 * Starting with 930, any instrument can have additive lgihting - set the lighting mode to "Additive" for non-generic instruments.
 * The panel background cannot use additive lighting - use generic instrument overlays to build emissive panel parts where needed. (For example, to make the labels for an overhead panel be emissive, you need to build them using a generic instrument overlay, like a rotary, rather than putting them in the background of the panel.)
 * To get additive lighting in the 3-d cockpit, use ATTR_cockpit_region, not ATTR_cockpit!

= Emissive Textures and Alpha Channel =

The emissive texture (typically called _LIT or _LIT-1, etc.) usually does not need an alpha channel. Since the texture is added to the albedo (daytime) texture, a black pixel will have no effect. Thus no alpha channel is needed - black is the "alpha" of a LIT texture.

If there is an alpha channel for an emissive texture, how it is interpreted depends on context:
 * For objects, if an emissive texture has alpha, the alpha is added as well. This means that an object can become less transparent when the LIT texture is visible.
 * For airplanes, the alpha channel is ignored.
 * For instruments, the alpha channel is not allowed - Plane-Maker will flag this as an error!

A tip on creating _LIT textures
Typically, your regular texture should have alpha while your _LIT texture should not. This would, for instance, be the case for an aircraft fuselage with transparent windows that is lit up the logo lights at night. The regular texture should use alpha to make windows transparent, while the _LIT texture should represent any lit parts of the fuselage over an opaque black background.

When creating emissive _LIT versions of your object textures, it's important to know whether your textures have alpha channels or not. What's a little confusing is that it's possible for your _LIT texture too look perfectly opaque and still have an alpha channel which could cause undesired effects in X-Plane. How to avoid this depends on what graphics software you are using to create your textures.

To remove alpha channel in Photoshop, you should select "Flatten image" in the layers toolbox before saving your _LIT texture. The result should be a single layer called Background. There is also a variety of image tools and graphics converters that allow you to save images with or without alpha.