Jump to content
  • Advertisement
Sign in to follow this  
jimmyh

Fogging With Pixel/vertex Shader Question

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

Could any one please tell me or point me in the direction of how to do fogging using pixel/vertex shaders? Does any one know any could tutorials/examples of pixel shaders, can't seem to find any on the net. Cheers. James.

Share this post


Link to post
Share on other sites
Advertisement
You have to output a scalar value to the oFog register from the vertex shader as well as enable the fixed function fog unit (since fogging isn't done manually in the pixel shader yet). Remember that 0 means full fog and 1 means no fog :) This is perhaps not very intuitive but it's because of the way DirectX blends fog into the output from the pixel shader

FinalColor = fog * pixelColor + (1-fog) * fogColor

Also remember that fogging takes place after the pixel shader has been executed, but *before* the result has been blended into the framebuffer. This can be kinda annoying if you're working with multiple passes.

- Kasper Fauerby

Share this post


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

  • 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!