Haze File Specifics

The visibility that the user sets in the Weather Visibility dialog box isn't the only factor that controls haze effects. To make Flight Simulator more realistic, provisions for haze layer effects were included; that is, the scenery designer can create and manipulate haze layer effects. When a plane is flying above a haze layer, the user can see a great distance to the horizon, but scenery that is in the haze below fades out in the distance. In scenery design, computing the precise amount of fadeout for each item and texture based on a haze level model is very complex. As a result, Flight Simulator uses approximations to create an effect close to the effect that a true haze layer model would yield. This topic describes the systems and projection rules that work with the haze file and haze layer definition to create haze effects.

The altitude of the haze layer extends to the base of the first cloud layer. The altitude of the haze layer is handled by the haze_height variable. In the file Enviro.asm, the value of the variable update_visual_far is set every 4 seconds as shown in the following code example.

if (cloud_1_active==0)
haze_height=0
else
if (average_visib => 7d00h);unlimited visibility
haze_height=2000 ft
else
haze_height=cloud_level_1

The haze_height variable in Vgbpoly3.asm is used to determine if the user is above the haze layer, and then used to determine visibility accordingly. If the distance above the last scale commands y value (ybias) > haze_height, the user is above the haze layer and the following formula is used to determine visibility.

haze table row index=haze table row index1 * haze_height / ybias

If a haze driver is installed, whenever a solid polygon or line is drawn, the haze_color routine in Vgbpoly3.asm is called. This routine maps the submitted color to a haze color based on the following formula.

haze table row index1=min ( rbias/(average_visib/256 +1) , 15)
haze table row index=haze table row index1
where:rbias=distance of the last radsorted object in meters

If the distance above the last scale command's y value (ybias) > haze_height, the plane is above the haze layer and the following formula is used.

haze table row index=haze table row index1 * haze_height/ybias

And, the final haze layer determinations use the following criteria.

Water polygons present a problem in terms of hazing because their center is used to determine haze distance. A large water polygon can have its center 15km from you, but you might be just a few hundred feet from it. The scenery system helps fix this problem to some extent by limiting all water colored polygons to a maximum distance of 5km as shown in the following example.

ugi86sh3.asm
POLYCL:
if (water_texture=0 and scolor_var=0f00eh and texture_flag=0 and rbias > 5km)
rbias=5km