View Full Version : Fog problems

01-22-2001, 11:20 PM
Hi everybody,

Fog seems to be very easy to implement in openGL but I got some visualization problems when I use it in my program. There isn't a nice fog everywhere on the screen but only some spots on the ground and I don't understand why.

I enable the fog in the initGL function, after enabling the lighting, the textures... I put all the fog parameters but it's not working.

I tried the fog in another program, an easier one, with the same parameters, and I get a great fog.
I don't know what can come the problem from.

Thanks for your answers,


01-22-2001, 11:56 PM
Hi, where is u'r fog node in the graph scene ???

I had this problem once and it was because the fog was the last node added in the graph..

The fog should the first rendered node.

Hope it will help

01-23-2001, 03:11 AM
I'm going to try!!!



01-23-2001, 07:00 AM
Also, fog seems to be calculated for each polygon and interpolated over it's surface for each pixel. So if you have one huge quad for the ground, it won't look good at all. Tesselation of any sort makes for better fog effects.


01-24-2001, 05:29 AM
I tried to enable the fog at the beginning of my program but I still have the same problems.
Firthermore, my ground is complex with hills and holes, so with many polygons. I also draw a sphere for the sky.

In fact, those ugly spots of fog move when I move the camera.
I hope I'm going to have some answers!


01-24-2001, 11:06 AM
Are you trying to do your camera movement using the GL_PROJECTION matrix? If you are you should be using the GL_MODELVIEW matrix for camera movement. Using glTranslate/glRotate/glScale is usually not wise to use with the GL_PROJECTION matrix. One reason is that it can mess up fog calculations. http://www.opengl.org/discussion_boards/ubb/smile.gif