Creating Shadows and Transparency

When projecting aircraft-external views (as determined by gen_model), the BGL model code always calls the aircraft shadow code before drawing the aircraft. The following example shows the BGL code sequence.

shadow:
SHADOW_VPOSITIONplane0lat
SUPER_SCALEshadow_out,0,11,6
SHADOW_VICALLlocal_model_cessna_plan0pitch
shadow_out
BGL_RETURN

In the preceding example, the command BGL_SHADOW_VICALL is executed. This command uses the following flags shown in the following example to determine if a shadow will be drawn.

aircraft_shadowsdw0;set in preferences to 0=aircraft shadows off 1=aircraft shadows on
shadow_densitydw0;0=shadow off .nz.=shadow on
;set in bgllight based on time of day

The Flight Simulator Scenery system has the ability to generate textures with holes in them, so that other patterns can "show through." This process is referred to as "hazing" or "transparency" and is controlled by the setting of the haze_factor variable in the file Global.asm. A haze_factor value of 0 copies all pixels without any haze effects; values ranging from 2–255 copy only pixels with color numbers greater or equal to 2–255 and perform haze effects.

Important: The "hazing" process described in this topic is not the same as the visibility hazing system that's described in other topics included in this SDK. Haze_factor isn't related to visibility hazing and 4096-byte haze palettes.

The setting Haze_factor=1 has a specific effect. This setting activates a special shader that uses texture files that are limited to a single color run, fading from green to gray based on pixel distance from the eye. Haze_factor=1 is used in the farm.r8 seed (80h) to draw the horizon trapezoids and fade the trapezoids to gray at the horizon line. Only the values B0,B1,B2 and B3h are used in farm.r8, and they use the B0...BF ground gradient color run (from light green to gray) to fade the farm texture to gray at a distance. A similar process is employed for clouds with the blue clouds color run. The following example shows the possible settings for the haze_factor variable.

haze_factordw0;global.asm1=use special haze shader
;0=copy all pixels from source to screen
;2–255=copy only pixels with color numbers >= n from
; source to screen.