Jump to content
  • Advertisement

Archived

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

Dwarf with Axe

Fog troubles...

This topic is 6010 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

I've been trying to implement fog into my first-person terrain viewer thing, and well it's not going to well... http://dwarvenale.tripod.com/screenshots.html The recent screenshot is a picture taken from the left-most part of my terrain (so there is more to the right). If you pan to the right, you will see everything that should be there, but everything is colored the fog color... the init code I use is:
glFogf(GL_FOG_MODE, GL_LINEAR
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_DENSITY, 0.8f);
glHint(GL_FOG_HINT, GL_FASTEST);
glFogf(GL_FOG_START, 100.0f);
glFogf(GL_FOG_END, -MAP_SCALE *0.2f);
glEnable(GL_FOG);
  
Ugh I've tried most everything... It's early but I haven't slept in two days... If I've overlooked something please let me know. And if you can, help! Thanks again, ~Dwarf [edited by - Dwarf with Axe on June 1, 2002 8:03:15 PM]

Share this post


Link to post
Share on other sites
Advertisement
I think your problem is that you assign GL_FOG_END a negative number (unless MAP_SCALE is also negative), i don''t think that''s legal... (i''m not completely sure)

Share this post


Link to post
Share on other sites
>>glFogf(GL_FOG_DENSITY, 0.8f);<< doesnt go with LINEAR FOG

from the screenshots i cant see any fog!
so ill have to guess, r u setting up the camera in the right position see the faq for reasons why this will effect fog

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Hard to say from the small code snippet, but:

1) This negative number seems *very* odd to me, you should definitely make it positive
2) how much is ''MAP_SCALE'' ? Are you sure that the fog end is greater than the fog start (100) ?

Share this post


Link to post
Share on other sites
Thanks for the replies so far.

I have noticed that my fog is working, and that oddity is the cutoff (I suppose b/c I gave the fog end a 5000.0f value, it stopped at z5000)

Anyway... The problem that I have, really, is that my fog is remaining in a static place. This is very odd to me, because it''s never happened before.

I have a static terrain with a CPlayer that walks around it. It seems as though the fog is set with the terrain once in the beginning then never changed... Very odd indeed.

So I''m just wondering: Do I have to assign my fog start/stop in relationship to the player x/y? If not, I can figure it out on my own.

Thanks!
~Dwarf

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You dont put the camera position in the Projectionmatrix, do you?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You dont put the camera position in the Projectionmatrix, do you?

Share this post


Link to post
Share on other sites
LOL NOOO!! I may have stupid problems, but I myself am not stupid!

Anyway, I think I fixed it now...

I noticed that I read my map data in from a heightfield array and then multiply the values by MAP_X and MAP_Z... Previously, they were each 32, so I incremented them to 64 and voala! My fog is beautiful!

Just one question though:

If something is fogged out (i.e., you cant see it because the fog is blocking it out), is it not drawn? Because I''m not seeing any performance decrease...)

~Dwarf

Share this post


Link to post
Share on other sites
quote:

If something is fogged out (i.e., you cant see it because the fog is blocking it out), is it not drawn? Because I''m not seeing any performance decrease...)


Everything is still drawn, fog is just a colour blending effect, nothing more. If you want to clip totally fogged geometry, then you''ll have to do it manually. Eg. adjust the far clipping plane, and include the fog range into your higher level drustum clipping.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!