User Controls for Lighting Effects

external spill vs. emissive
instrument lighting rheostats
panel lighting rheostats
HUD rheostat

Instrument Lighting Properties

These lighting techniques apply to both 2-d panels and 3-d cockpits that use 2-d panels as textures.

Instrument Overlay Lighting Modes

Generic instruments overlays have one of three lighting modes – the lighting mode controls how LIT layers are used and how the instrument reacts to brightness changes. In considering the mode, each instrument has:

  • A power source.
  • A rheostat controlling instrument brightness.
  • Some amount of light falling on the instrument, the sum of ambient, flood, and spot lights.

Built-in instruments typically have either the glass or mechanical mode, but a few are composed of parts that have both properties.

Mechanical Lighting

Mechanical lighting is the simplest mode: the overlays brightness comes from the sum of ambient, flood and spot lighting hitting the instrument overlay. This mode of lighting is appropriate for instrument overlays that simulate mechanical parts, parts that require something to cast light to be seen.

If electric power fails, the instrument is still drawn; the power failure is noticeable because the spot and floods will go dark, reducing the amount of light that falls on the overlay.

For backward compatibility, mechanical lighting will use the _LIT texture when it is dark and the electrical system is on. However, we recommend that you use back-lit lighting for mechanical lit instruments in X-Plane versions 920 and newer. (See below.)

You can cause mechanical lit instruments to disappear using generic instrument filters; this might be appropriate for a mechanical flag, for example.

Glass Lighting

With glass lighting, the instrument brightness rheostat determines the brightness of the instrument. The light cast on the instrument has no effect. This is appropriate for EFIS elements and other “glass” displays. If power fails, the instrument is not drawn at all.

For backward compatibility, mechanical lighting will use the _LIT texture when it is dark and the electrical system is on. However, we recommend that you use not use this feature with glass lighting in X-Plane versions after 920. (See below.)

Back-Lit/Additive Lighting

Back-Lit lighting is a new lighting mode: the daytime texture is drawn based on the sum of ambient, spot and flood lighting; the LIT layer is then added on top of the day time texture (when power is available) at a brightness based on the instrument rheostat.

The result is an instrument that is self-lighting, but still visible due to ambient light if power fails.

Lighting Modes for Non-Generic Instruments

  • You can set the lighting rheostat property on any instrument, even an old one.
  • The parts of that instrument that respond to the “instrument brightness” rheostat will now follow any of the 16 lighting values.

This lets you use the moving map and pre-made EFIS elements with multiple lighting rheostats.

In X-Plane 930 and newer, you can set the legacy lighting mode to “mechanical” or “additive” (which corresponds to mechanical or back-lit for generics). Legacy instruments are “glass” or not based on their type, and in fact some parts may be glass while others are not.

Lighting for 2-D Panels Only

Theoretical Model

Under the new 2-d panel lighting model, there are four sources of light:

  1. Ambient light comes from outside the plane – its level is a rough approximation of sun and moon effects (but in the 2-d panel it is not directional.)
  2. The flood light fills the entire panel with a single color, similar to what was available in 902. The flood level is controlled by the panel brightness rheostat (flood light rheostat).
  3. Up to 3 spot lights fill some areas of the panel with a specific color. The spot lights are defined by an RGB color in PlaneMaker and a mask (indicating where they have influence) in a PNG file. Three new rheostats control the spot light brightness individually.
  4. Instrument overlays can also have “emissive” lighting – that is, they can light themselves up regardless of these other effects. Instrument brightness can come from one of sixteen rheostats; default instruments use rheostats 0 and 1 (for pilot and copilot). Old datarefs and instruments keep rheostats 0 and 1 in sync for compatibility with 902 and beyond.

Panel Background Spot Light and Shadow Masks

Four things are necessary to use the new panel spot-light feature:

  1. Include at least one spot light overlay. These overlays have the same name as the panel, with the extensions -2.png, -3.png and -4.png. Their format is a gray-scale PNG (no alpha) of the same size as the main panel. These correspond to each of the three spot-lights.
  2. Change the -1 shadow layer from RGB+alpha to gray-scale, no alpha. In its converted form, white means more shadow, black means no shadow.
  3. Set the RGB colors for the three spot lights in the PlaneMaker view screen (lights sub-tab).
  4. Optional: include rheostats to control the spot light levels.

The change in shadow format is very important: without the spot light system, the shadow uses transparency to overlay a color image. With the shadow format, the shadow is a simple gray-scale mask, with higher values meaning more shadow.

Spot lights affect burned-in instruments on a per-pixel basis; that is, the the spot light masks combine with the background image to produce a lighting effect.

Spot lights affect overlays on a per-instrument basis; that is, the overlays will take on a lighting level from the average of the spot light around the instrument, but one side of an overlay can’t have a different spot-light affect from the other side. The precise way spot lighting is used depends on the lighting mode (see below).

Lighting Tips

Creating Glow Effects With Default Instruments

In X-Plane 930 and newer you can use “additive” lighting with the default instruments – set the lighting mode to “additive” in Plane-Maker and add _LIT-1, _LIT-2 textures etc. to the overlays.

This effect is typically used to make LEDs and back-lit numbers have a warm “glow” at night.

There are two problems with this technique. First, additive lighting can only be used on the overlays of an instrument, e.g. the -1, -2, -3 and -4 layers. So there is no way to make the background glow. For example, if an instrument has its numbers and markings in the background, those can’t be made to glow.

The work-around is to make a new instrument, typically a generic rotary with 1 image cell and no click mode, with additive lighting mode and the image of the glow. The glow goes in the -1 layer.

This glow instrument must be lower in the panel “stack” than the instrument you want to glow. The glow will appear on top of the background (since all backgrounds are drawn before any overlays) but under the moving parts of the regular instrument (which is higher in the sack).

For an example of this, see the default C172 in X-Plane 930 or newer. Since the steam gauges have their markings in the background, the author uses a single large generic to add all the glow effects to the six-pack instruments.

The second problem is that default instruments automatically categorize their layers into lit vs. mechanical lighting…the “additive” option only affects those “mechanical” layers. For example, in the radio stack, the LEDs are automatically categorized as “lit”, so additive lighting is not available for them.

Usually this is not a problem – if the layer is lit, you wouldn’t need glow because the lit texture would already contain this.

Per-Pixel vs. Per-Vertex Limitations

The 2-d “lighting” masks (-2, -3, and -4 layers on the panel background) add light to the panel and instrument background and any burned in elements on a per-pixel basis.

However, due to performance limitations, these effects only affect overlays on a per-vertex basis. That is, the entire overlay is lit uniformly by the -2,-3, or -4 mask based on one sampling point. (The same is true for the -1 shadow layer.)

There is no one good work-around for this…typically you will have to use a combination of careful shaping of the background lighting effects and possible use of lighting overlays to reduce artifacts.