Jump to content
  • Advertisement
Sign in to follow this  

Question about Variance Shadow Mapping

This topic is 2028 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 just got variance shadow maps working in my game (I'm using XNA) but something

curious occurs to me. I'm using what I assume is the standard algorithm:





I don't see why it's necessary to use the moments to calculate the variance, use chebyshev's upper

bound etc etc. Assuming you've already blurred the shadow map, why can you just use read each

pixel's occlusion directly from the r component?


It seems to work fine (if anything it looks better). I assume it's gonna cause a problem further down the line

though or people wouldn't have bothered with all those extra lines of code??



Share this post

Link to post
Share on other sites
If you examine the depth texture after your blur you'll find it has been linearly blurred. By using the r and g components we can store the depth value and its square which both get linearly blurred by your blur function. If you compare the interpolated values between two pixels you will find the r component squared will be less then the g component (which contains the original squared value). This difference which is increased over a change in depth is what is used to calculate whether a pixel is in shadow or not as a probabilistic function. If you simply used r and r squared instead of g you would find there is never any difference which would mean the pixel is never in shadow.

If simply used the depth after you're blur you would get a hard edged shadow since you would be comparing the depth of the pixel against the blurred value in a function that only returns lit or shadowed. The blur itself is only acting on the depth values before you turn them into shadows.

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!