Jump to content
  • Advertisement
Sign in to follow this  
SiS-Shadowman

Light Scattering in Outdoor scenes

This topic is 4504 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 asked myself how i could simulate the scattering of light in outdoor scenes. i've managed to do this on my skydome ( where the aequatorial area has another color than the top of the dome ( depending on the time ), but i also need to scatter the light, emitted by the terrain. as i was implementing shadow mapping, i came to an idea. i could render the scene another time from the sight of the camera, but fill a texture with the depth of the screen. the screen first gets cleared and filled with white, then the further an object is, the darker it gets. a quad, wich is rendered in front of the camera ( it covers the whole screen ) gets filled with the skydome color ( distant objects always seem to get blue on the day ) and it's alpha color is taken from the texture, rendered in the first place ( color.r * color.g * color.b = alpha ). that would require that all geometrie gets rendered twice per scene for the scattering. i think i'll try to implement it these days, just to test it. what do you think of this technique? i'm certain that i'm not the first one, coming up with this idea, but i haven't heard it so far.

Share this post


Link to post
Share on other sites
Advertisement
I'm confused, I thought normal atmospheric scattering was just a modification to the color calculated in the vertex or pixel shader? Doesn't that then make more sense than rerendering all scene geometry?

Share this post


Link to post
Share on other sites
Quote:
Original post by SiS-Shadowman
but how does the pixel shader know whats further from the camera ( because this one is much more affected by the athmosphere color ) ?


the pixel shader has access to the current pixel's coordiantes
since the camera is assumed to be at 0,0,0 your distance is the z-coordinate

cheers

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!