Fog


Fog is, of course, another nifty weather feature. We've already encountered one kind of fog that is used to obscure distant objects and terrains. There is another kind of fog that operates in layers, just like the clouds—except that with fog, these are real layers in the game world that you can actually get into with your player, depending on where the layers are placed.

This layered fog is a limited form of volumetric fog. It is limited in the sense that although you can specify the upper and lower bounds of the fog, it will appear at those levels throughout the entire map.

You can use this layered fog to complement the moving cloud textures to create clouds (except that the fog will never be at the same altitude as the cloud textures). You can also deposit fog in low-lying river valleys.

A good use for this fog is underwater, helping to reduce visibility there. This reduced visibility results because of silt and other materials that often exist underwater, cutting down your ability to see far.

This layered volume fog is specified in the Sky mission object that we looked at earlier. An entry looks like this:

       fogVolume1 = "500 0 100"; 

The three parameter numbers are, in order, distance, bottom, and top. Their meanings are shown in Table 18.1.

Table 18.1: Volume Fog Settings

Parameter

Description

distance

View distance when in the layer. This works like the distance fog, except that a value of 0 here means there is no fog at all. If you want a really, really close view distance, use 1, not 0.

bottom

Bottom of fog layer.

top

Top of fog layer.

You already know how to edit the mission file and change the properties of the various mission objects, so go ahead and putz around with the fog values and see how they work.




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net