Personal tools

2D Panel Lighting

From X-Plane Wiki

Jump to: navigation, search
This page is not yet finished. Information may be incomplete! If you have information on this topic, you may be able to help complete the article.

Before reading this, be sure to look at Panel and Cockpit Terminology for terminology and Introduction to Panels for background. See Additive Lighting for the fundamental lighting equations used in X-plane.

Contents

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 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 920. (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 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, 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 Modes for Generic Instruments

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.

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 for 3-d Cockpits

3-d panel spot lights
ATTR_light_level

See also: 2D Panel Lighting Tips

Navigation