Wednesday, February 15, 2006

Cockpit Lighting Weirdness

A few authors have asked me why the lighting looks different for the parts of a 3-d cockpit that use the panel. Here's what's going on:

The 2-d panel has 3-part lighting: the base background is lit by the ambient light levels with no regard to lighting angles. (Since the panel is 2-d we're not really in a position to light different parts of the panel differentially.) The panel is then additionally lit by the cockpit flood lighting and any instrument gauges are further lit by the instrument brightness, for example an EFIS.

The 3-d panel is then built by taking an image of the entire 2-d panel. Here's where things get tricky. The image of the 2-d panel has already been darkened by the ambient lighting levels and brightened by the flood lights.

If we were then to apply directional 3-d lighting (the way we do for normal lighting) we would further dim the panel (which would make it too dark) and we would dim the EFIS and other instruments.

But since we don't apply directional lighting, the panel texture does not match teh surrounding non-panel geometry in a 3-d cockpit.

There are a few possible things we can do about this:
1. We can leave things the way they are and require 3-d panels to carefully use the clickable parts only for small areas to minimize the visual impact of the lighting effects.

2. We can build the 3-d panel separately out of multiple textures. This would allow us to do truly correct 3-d lighting, but would have some pretty big performance implications. The 2-d panel would have to be rendered multiple times, and the total VRAM requirements would increase by several megabytes. Since the panel is never compressed or resolution-reduced, VRAM is a serious consideration.

3. We could disable all 3-d lighting for the 3-d cockpit. This would cause all geometry to match, but give the 3-d cockpit a flat look. Authors would have to build their 3-d lighting into their texture.

None of these options is ideal.

No comments: