By Mike Damert, Damert@navpoint.com.
Fog is perhaps one of the easiest things in CS to implement, which is why I'm writing about it :p The following code is from the application Simple2, and can be added into the program almost anywhere.
csFog* f = simple->view->GetCamera ()->GetSector ()->GetFog ();
f->enabled = true;
f->density = 0.1;
f->red = 0.5;
f->green = 0.55;
f->blue = 0.65;
This example will put a semi-realistic fog in the current sector. Just create a csFog object by getting the present iSector and calling GetFog (). Density and RGB values are all floating point values which can be set from 0.0 to 1.0.
Note that while fog is pretty fast with OpenGL mode, it runs pathetically slow in software rendering--a scene that ran at at ten or twenty frames per second with fog turned off could only do about one frame per second with fog turned on.