I’m working on a GFX5200 and I made a demo to check out how fog works with multitexture,and I found a really weird situation.I made a terrain with water,and then I used fog with glEnable(GL_FOG).The water is just a huge flat quad.Everything was fine,until I decided to use multitexturing in order to use lightmap too on the terrain.Well,if I enable more that one texture units,the fog just don’t work right with the water.It seems that there is a problem in the calculation of the fog coordinate,and that’s really visible when I just rotate the camera.I even tried it with a totally white lightmap,and the problem remained.I disabled blending,in case that was the problem,but with no luck.Note that the whole scene is rendered with a single pass.
If I simply disable one of the texture units(no matter which one),then fog works fine.
Some will say that the problem should be fixed if I tesselate the water more.That’s true,since the terrain,that is highly tesselated,works fine.But,as I said,the fog worked with the water when I wasn’t using multitexturing.So the problem must be somewhere else.
Anyway,I wrote a vertex shader(no fragment shaders) that substituted the fixed pipeline and set the FogCoord myself:
Everything works perfect,with multitexturing and fog.Now,if,inside the vertex shader,I clamp the FogFragCoord to 0.0,then I have the exact same problem as before.So,I think that 99% it’s a bug:for some reason,the vertex fixed pipeline clamps the FogCoord to 0.0 when multitexturing is enabled,thus causing problems on the interpolation of the FogCoord.
Has anyone encountered this?What’s your opinion?