• Advertisement

Archived

This topic is now archived and is closed to further replies.

Help.... I can't get fog to set on a z axis...

This topic is 6214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I think someone else had this kind of problem some time back, but the topic dissappeared before I could read any of the replies given to him. Basically, I want it so that fog is enabled say 50.0f away from the central position. However, it doesn''t seem to matter what value I give it, the fog just doesn''t seem to want to start 50 away. I am using Nehe''s tutorial directly in my program, so there are 3 filters on it. I am aware that GL_EXP and GL_EXP2 are both designed to totally fill the area. However, the last filter GL_LINEAR is supposed to work based on the GL_FOG_START and GL_FOG_END values. I hope someone here can help me with this. ( maybe the person who had problems with it before can fill me in on how he fixed it in his program ) Hope you can help.. Thanx in advance. ~Cobra~

Share this post


Link to post
Share on other sites
Advertisement
I just had a quick look through the tutorial again, and I noticed that the GL_FOG_START value is how far away the fog starts.

In other words, it''s supposed to be how far away ( on the z axis ) the fog starts. So basically, it should already work. For some reason though, GL_LINEAR fog filter refuses to work for me.

If I''m using GL_EXP it just fogs out the screen.
If I''m using GL_EXP2 it does the same thing, but looks better.
If I''m using GL_LINEAR then there is no fog. But when I turn fog off, you still notice a slight change in brightness within the level. So what''s that all about???


I really hope someone can help me with this. It''s just a nice little effect to add around the edges of my world, but I really do need it...

Thanx in advance.

~Cobra~

Share this post


Link to post
Share on other sites
WOO HOO, solved it.....

For some reason, GL_LINEAR just wasn''t working as a fog filter in my original coding.

I removed ALL of my fog code, and rewrote it in, but this time I DIDN''T include GL_EXP or GL_EXP2. I just had ONE fog mode, GL_LINEAR ( seeing as it''s the only one I need ), and I removed the filter toggling code, and voila, it works

NICE!


Anyone else having trouble with the fog should probably try this. It only takes a few minutes, and it solved it perfectly.

So my advice to anyone having problems with the fog code:

1) Remove all the fog code.
2) Rewrite it in, except this time ONLY use GL_LINEAR ( seeing as it''s the only one that works on depth ).

That should fix it. If it doesn''t, then a sledgehammer usually does the trick


~Cobra~


Build a man a fire, and he will be warm for a day. Set a man on fire and he will have warmth for the rest of his life.

Share this post


Link to post
Share on other sites
>>Rewrite it in, except this time ONLY use GL_LINEAR ( seeing as it''s the only one that works on depth ).<<

they all work on the pixels depth value.

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
I meant that GL_LINER is the only one that uses the GL_FOG_START value to set how far away the fog begins.

GL_EXP just fogs out the whole screen.
GL_EXP2 does the same, except makes it look better.

From what I could tell from the coding ( and the tutorial ), out of the three, only GL_LINEAR uses the GL_FOG_START value.

That was all I meant.

~Cobra~

Edited by - Cobra on February 18, 2001 4:04:35 PM

Share this post


Link to post
Share on other sites

  • Advertisement