Advertisement

Tutorial 22 + fog

Started by December 28, 2002 01:05 PM
20 comments, last by C Lund 22 years, 1 month ago
I''ve been working my way through the tutorials, and modified the resulting apps in various ways. One of the things I''m trying to do is add fog to the embossed bump-mapping tutorial (22). But it seems as if the multitexturing in that tutorial is messing up the fog. It seems as if the fog color gets a slightly different hue than it should - as if the two fog values were added together. Turning the fog off for the bump-texturing makes the fog color correct - except that the bumps are somehow not affected by the fog at all. Has anybody else tried doing this? Anybody have an idea what''s going on? I think the solution either lies in the glBlend constants or in changing the fog color for the inverse texture, but I have no idea how the fog color should be changed or which constants to use. C Lund
C Lund
Try disabling blending when drawing fog.

Just an idea.
Advertisement
"Try disabling blending when drawing fog."

I''ve tried that. Unfortunately, that disables the bumpmapping.


C Lund
C Lund
When u r done drawing the fog, enable blending.
"When u r done drawing the fog, enable blending." (how does one quote prev articles anyway?)

Uhh.. that leaves me none the wiser. When is the fog drawn?

I have this:

glBlendFunc( GL_ONE, GL_ONE );
glDepthFunc( GL_LEQUAL );
glEnable( GL_BLEND );
for ()
{
[stuff snipped]
glBegin(GL_POLYGON);
for()
{
[stuff snipped]
glTexCoord2f();
glVertex3f();
}
glEnd();
}

When is the fog drawn? At glVertex()?

(I''m new at this)


C Lund
C Lund
Do:

glEnable(GL_FOG);
// draw your fogged stuff here
glDisable(GL_FOG);
// draw your non- fogged stuff here
Advertisement
Hawkeye3 wrote:

glEnable(GL_FOG);
// draw your fogged stuff here
glDisable(GL_FOG);
// draw your non- fogged stuff here

----

No, that''s not what I want. I want fog on all the stuff. The problem is that the texture blending messes up the color of the fog.

Snisarenko wrote:

When u r done drawing the fog, enable blending.

----

But where is the fog drawn? At glTexCoord2f()? glVertex3f()? Somewhere else?

C Lund
C Lund
I get what u r saying now.
That is a pretty weird problem.
Maybe there is a fog model that does not submit to blending ?
I truly don''t know.....
Just to make sure you get what the problem is: If I turn off the embossed bumpmapping - which uses texture blending, the fog acts the way it should. If I turn the embossed bumpmapping on, I get this (with the fog maxed out for effect):

http://www.notam02.no/~clund/picts/scrnshot/Fog+Blend.jpg

As you can see, the polyhedron does not have the same color as the fog. B(

C Lund
C Lund
i have no problems in adding the fog tut to the bumpmap one. looks fine! make shore your fog color and your glClearColor() are the same. the ''fog'' is only drawn on top of objects, not the background.

make shore everything has the same values a the tuts inclueding the same objects. i noticed you have changed the object so the problem might be there some were??


- Jono AH
- JonoRule #1: If you build it, they will come -- to hack and cheat.

This topic is closed to new replies.

Advertisement