Fog problems

Hello everybody

I have been trying to get the build-in fog effect working, as specified in the online version of the Red Book, but I have some problems.

The fog effect only works on one axis (z i presume), so if I turn my camera to look down the x-axis, there is no fog. I am not sure what I am doing wrong here, the docs make it seem very straight forward and simple

Regards,
Michael

Im pretty sure you put stuff in the projection matrix that doenst belong there. Only projection should occur in that matrix, the camera rotation/movement should be in the normal Movelview matrix.

And beware, the default fog is almost always computed relative to eye z distance. So when you rotate around, the fog seem to move.

As it is computed per vertex, you need pretty well tesselated geometry too. It depends on the type of fog, though.

I have seem an 3 years old nvidia extension (GL_NV_fog_distance) able to do true radial z computations, used in Return to Castle Wolfenstein.

Else, try a fragment program