Question about Variance Shadow Mapping

Started by
1 comment, last by RnaodmBiT 11 years ago

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:

http://fabiensanglard.net/shadowmappingVSM/

http://electronicmeteor.wordpress.com/2011/11/06/xna-4-0-variance-shadow-mapping-sample/

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??

Thanks

Advertisement

isn't it a question of diminishing artefacts like light leaks ?

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.

This topic is closed to new replies.

Advertisement