World Wide Guide | Knowledge Bank | Kukushkin's Notebook | Basics of Simulation


How FS5 displays colors

Despite texture mapping capabilities of FS5, many surfaces and all lines and dots are not textured. FS5 can display uniformly colored primitives in a very realistic way. Although FS5 runs in 256-color mode requiring 8 bits/pixel, scenery colors are selected using 16-bit numbers. The high byte selects a so-called color palette, while the low byte selects the color from this palette.

Three different palettes

There are 3 different palettes the color can be chosen from. These palettes should not be confused with the hardware palette or palette files of FS5. They are rather an interface between drawing commands and the hardware palette.

Colors in FS5 are not just RGB values used to draw pixels, they describe properties of primitives they are applied to. For example, a side of a building always has the same color. However, its intensity varies according to the sun position and it turns into black at night, regardless of its original RGB value. Unlike that, runway end lights retain the same intensity regardless of the time of day. Shadows always have black color, but it is transparent -- the ground can still be seen under a shadow.

How RGB values are modified for special effects

FS5 modifies actual RGB values produced by color specifications in multiple ways. First, the hardware palette changes the intensity of its colors according to the (simulated) intensity of the diffused sunlight or moonlight. Palette entries not entirely dedicated to scenery usage sometimes behave differently, thus allowing many interesting effects. Second, some colors are mapped to different hardware palette entries depending from the position of the virtual sun, the cloud cover and the orientation of the surface they are applied to, thus simulating illumination by direct sunlight. Unlike the virtual sun, which is invisible but does change its location, the virtual moon can be visible but always remains at the same location. Probably because of that, direct illumination by the moonlight is not simulated. Haze drivers of FS5.1 add an extra step between these two, where references to hardware palette entries are remapped once again according to the distance from the spectator.

Palette 68h and 69h

Two of the palettes used to choose colors are very simple. The palette 69h is identical to the hardware palette. Color values selected from it specify palette entries directly, similar to pixel values in texture files. The palette 68h allows defining transparent colors used to display surfaces that should not completely hide the scene behind them, like shadows. As in the palette 69h, color values are references to palette entries. In transparent surfaces, only every second pixel is put onto the screen. Half of the pixels from the scene behind remain visible, thus creating the transparency effect. However, a transparent surface can never be seen through another transparent surface, because exactly its pixels will be overwritten. This palette can only be used with surfaces, not with lines. Because of that, lines do not produce shadows in FS5. FS5.1 contains a bug that sometimes causes the colors from this palette to be displayed incorrectly during the dark hours when the map view is enabled.

Palette F0

The palette F0 is the most complex one and the one most frequently used. Unlike the other 2 palettes which are used to access palette entries, this one is used to specify the properties of surfaces. Most colors in this palette change their intensity depending on the orientation of the surface and the position of the virtual sun. This allows a very good simulation of the illumination by direct sunlight. Each of these colors has multiple palette entries. The color is then mapped to the entry that most exactly matches its actual intensity. Because of that, these are the only colors that can be used for shaded polygons. These colors are very well illustrated by default buildings, which change the intensity of their sides during the day. However, the palette f0 is only used when building textures are disabled -- textured buildings use a different way of achieving the same effect. Some other colors from this palette do not change their intensity this way. Most of them are mapped to palette entries that remain lit during the night and are used for night effects. There is also a special white color that changes intensity during the day but remains lit during the night. This palette has a much smaller number of colors than 256. While it is indeed possible to specify 256 color values, most of them result in objects randomly changing their colors according to the sun position and are thus unusable.

Creating the illusion of a rounded surface

Polygons filled with a solid color are useful for defining flat surfaces, but cannot be used for round objects. The only way of displaying round objects in FS5 is to construct them from primitives, all of which are flat. Thus, color changes between neighboring polygons would be clearly visible. This problem is resolved by using so-called shaded polygons. They are not filled with a solid color, but their color varies its intensity inside the polygon. This creates a very realistic illusion of a light reflection on a curved surface. Polyhedra constructed from shaded polygons look perfectly round, even if the eye catches their corners. A good example of such an object is the airship in Chicago when viewed from a close distance.

Besides using capabilities of color palettes in FS5, the scenery can choose different color specifications depending from different factors, like time of day or aircraft position. This allows creating many effects like night lights, blinking lights or visual approach systems, that cannot be implemented using color manipulations offered by standard palettes alone.


Last updated 11 October 1996 by Gene Kraybill.