• Advertisement
Sign in to follow this  

Fog and GLSL

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

If I am using GLSL to render all my gfx and go to use the FFP fog setup functions I am assuming they will not work or do any fog... As of now I have no fog showing up while I am using GLSL to do all my rendering. So if I am correct in saying I need to implement the fog effect in my shader for the polygons that need some kind of fog effect? So will this fog be like FFP fog or will it follow a curved surface? Right now I am thinking about add in fog to reduce the terrain popping into view due to culling... Thanks

Share this post


Link to post
Share on other sites
Advertisement
sounds like your culling code is a little too aggressive if you can actually see the terrain getting culled

Share this post


Link to post
Share on other sites
The orange book contains a copy of the fixed function fog equations. If you just copy that code, your shader should produce fog that looks like fixed function fog. However, the beauty of shaders is that you can roll your own if you want.

Share this post


Link to post
Share on other sites
are you telling OpenGL to return to ffp with a call to glUseProgramObjectARB(0)? If not then anything you draw will only apply the code from your vertex and fragment shaders.

Not sure if this will help you though, I don't actualy know if fog will be retroactively applied to things you've already done in your scene or not. What I mean is, if you draw a box for example and light it or whatever using your shader, then reenable ffp whether or not OpenGL will fog the fragments of that box appropriately even though it has already been drawn. I'm guessing it won't but I'm not positive.

Share this post


Link to post
Share on other sites
Quote:
Original post by Morpheus011
are you telling OpenGL to return to ffp with a call to glUseProgramObjectARB(0)? If not then anything you draw will only apply the code from your vertex and fragment shaders.

Not sure if this will help you though, I don't actualy know if fog will be retroactively applied to things you've already done in your scene or not. What I mean is, if you draw a box for example and light it or whatever using your shader, then reenable ffp whether or not OpenGL will fog the fragments of that box appropriately even though it has already been drawn. I'm guessing it won't but I'm not positive.


I unbind each shader object after I am done rendering with it. I will have to take another look and see what is going on maybe I am turning on my fog while the shader is enabled and before I unbind it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement