PDA

View Full Version : Fog problem



kotrlar
08-21-2002, 10:09 PM
Hello, I have problem with fog. I get different results from multipass and single pass (multittexture) rendering. First I enable fog, then I render polygons. Results from multipass are darker ... Does it mean that fog is applied to every polygon in multipass and then it is blended together?
I use standard opengl fog. Please help.
Code multipass:
opengl::glEnable(GL_FOG);
opengl::glFogi (GL_FOG_MODE, GL_EXP);
opengl::glFogf (GL_FOG_DENSITY, fogpar[0]);
opengl::glFogfv (GL_FOG_COLOR, c);
here render first pass (blending disabled)
here second pass (blending enabled)
(in multipass only one pass is here - results are different).
Thanks
Radek

Bob
08-21-2002, 11:20 PM
The fog is applied to anything you draw after you enable it, and until you disable it. So if you have it enabled for two passes, it will be applied to both passes. That in combination with a "proper" blend function can create a real mess.

I had problems with double fogging in dual pass rendering some time ago, and it was solved by applying the fog only to the last pass. I may depend on the blending function, not sure, but you can give it a try.