Jump to content
  • Advertisement

Archived

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

CP

OpenGL Blending and Fog in OpenGL

This topic is 6284 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 just added fog to my 3d world so you couldn''t see the edge of the map far away. But I also have water, which is blended so it is translucent. But this seems to cause a problem with the fog. Instead of the water slowly blending in with the fog at a distance and and slowly becoming not-visable, it becomes very bright and I can see the edge of it. Instead of going grey like the fog, it gets white. Anyone know how to fix this so it blends into the fog the same way as a normal, not-blended polygon?

Share this post


Link to post
Share on other sites
Advertisement
I don''t do OpenGL either, but....

Check that fog is still enabled when drawing the transparent part of the water. You might be drawing the floor of the water area with fog, but drawing the surface of the water after fog has been disabled.

Share this post


Link to post
Share on other sites
I don''t understand all of you. why use Direct3D, why use OpenGL? Why Why!!!!
Just create an abstract rendering class with render states. Makes it easier to port to different rasterizers / OSes

Share this post


Link to post
Share on other sites
How are you doing the fog calculations - are you just using GL''s fog? If you are, then make sure you are setting the fog up with the appropriate calls, glEnable() it, then render everything in your scene. When your done, call glDisable() on it.

Try looking at the Quake(1) engine source code, and see if that gives you any help/ideas.

-Mezz

Share this post


Link to post
Share on other sites
Well, the fog works perfectly with the land. At a distance the fog becomes more visable and the land becomes less visable. But with water, that doesn''t happen. it gets brighter. I tried to glEnable/Disable at different parts to fix it, but that never worked. Any clues?

Share this post


Link to post
Share on other sites
In the begining of your drawGL routine enable the fog, draw whatever you want, then disable the fog, enable the blend, draw the water, disable the blend...
It should work

Bruno

Share this post


Link to post
Share on other sites
I'm actually trying to figure out the same thing (getting fog to work well with transparent water). Bruno's approach works well when the fog is far off in the distance because it gets rid of that annoying bright white. However, if you want to have a very fogy scene (you can only see 10ft in front of you), then the water sticks out like a sore thumb sense no fog calculations are used on the water.

Any idea how to resolve this other complication?

Edited by - Brett Crain on January 22, 2001 3:11:21 AM

Share this post


Link to post
Share on other sites
send me a short working program (+ a description of what u wanna do) + ill tack a looksy. fog in gl is computed per vertex

http://members.xoom.com/myBollux

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!