Things that are considered for fog:
First, you set up 'height' under which fog starts.
The lower terrain is, more dense fog is.
If viewer is in fog, that is added to fog strength.
Next we calculate depending on those, and distance of triangle how dense we'll draw fog (remember, when inside fog, if triangle is close, you see it more clear than triangle that is more far away).
Also about vertex colors, I re-calculate them on the fly.. it's still faster this way than to render each one 'by hand'.
Well, here's a snippet of code to calculate those (yes, it's 'ugly' code... but it works

Sum info: Player structure is actually viewpoint, and what you pass to this functions are coordinates of vertex.
Oh, one more thing... feel free to e-mail me at: nfrances@thphys.irb.hr if u want full code - but remember.. it's kinda messy

Hmh.. have problems post code here, anyway, grab that part here:
http://faust.irb.hr/~nfrances/snippet.txt
[edited by - Nick7 on September 11, 2002 8:56:14 AM]