Conventional 3-d games like first-person-shooters and racing games are just full of cheats in the rendering engine.  And that is not a bad thing!  By cheat I mean they find clever ways to optimize performance that make the game look good while doing less work.  The result: better framerate, better graphics.

I look at these games with a bit of envy because those cheats are often inapplicable to general purpose flight simulators for two reasons:

  • The unrestricted viewpoint of a flight simulator is incompatible with a number of optimizations that on-the-ground or movement-constricted games can apply.
  • Since a lot of our content comes from a third party, we can’t apply restrictions and optimizations across the entire set of content for the sim.

Despite these limitations, rendering-engine specific optimizations are beginning to creep into X-Plane as the engine becomes more powerful.  These options and optimizations are unsurprising to anyone used to making 3-d game content but new to X-Plane itself.

What Is a Light Group?

Light groups are a cheatoptimization available in many 3-d rendering engines.  The basic idea of a light group is that the author of 3-d content can create 3-d lights, meshes, and then specify which lights apply to which meshes.

There are two big advantages to light groups:

  1. Lights are expensive in traditional (non-deferred) rendering engines; by restricting which lights affect which objects, an artist can reduce the average number of lights applied to their 3-d meshes, which is good for framerate.  (Using light groups to remove lights from objects that are out of the light’s range can be done automatically by a pre-processing tool.)
  2. Lights in games often do not cast shadows, either because the engine can’t support this (this is the case for X-Plane now) or just because shadows are expensive to generate.  With a light group, artists can get correct results without shadows by simply marking geometry that is shadowed by the light as not in the light group.

As an example of the second case, imagine that you have two rooms separated by an internal wall and a powerful light source in one room.  If the light source casts shadows, the unlit room will be dark because the entire room is shadowed by the internal wall.  But if the lights do not shadow, the light from the lit room will “leak out” into the second room.

With light groups, an artist simply marks the second room as not being part of the light’s group, and the rendering engine doesn’t even consider the light.  The dark room renders faster and has no incorrect light leakage.

Light Groups in X-Plane

X-Plane implicitly has two light groups: the exterior of the user’s aircraft, all AI aircraft and the entire world, and the interior of the user’s aircraft.  In X-Plane 9, landing lights don’t light up the cabin interior, and the 3-d lights inside the cockpit don’t light up the runway or the landing gear.

In X-Plane 10.05r1 HDR mode was not supporting these light groups correctly; one obvious example was the Piaggio tail landing light spilling light on the cabin seats.  This is now fixed in X-Plane 10.10.  Just like X-Plane 9, your choice of “interior” or “exterior” for Plane-Maker objects matters for lighting!

Light Groups and Spill

What if you include spill manually by attaching a named light that casts spill to an object?  What light group should the spill cast light on?

My idea to resolve this is:

  • Spill lights attached to “exterior” Plane-Maker objects will be part of the exterior light group and only light up the aircraft exterior and surrounding scenery.
  • Spill lights attached to “interior” Plane-Maker objects will be part of the interior light group and only light up the aircraft interior.
  • Scenery-attached spill lights will light up everything.  (Perhaps this should be “exterior” instead?  I am not sure!)

For a non-enclosed aircraft (E.g. an old biplane with no cabin) you would not use the interior light group at all – everything would be exterior and all lights would affect everything.

If an aircraft has two light groups (interior and exterior) and a light affects both, you can simply include the spill light in two objects; the spills are cheap.  This also means you could make effects.  For example, if the spill light does actually light up the interior a little bit, rather than having the actual landing light blast the cabin with directional light, you could include an exterior spill for the landing lights themselves and a second interior spill that is omnidirectional, dimmer, and tinted, to represent the reflected light that makes it into the cabin.

About Ben Supnik

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.