Saturday, November 3, 2007

Soft Shadows continued

like all shadow map algorithms, VSM also suffer from something called light bleeding (instead of shadows you will see some light color pops at the middle), this is due to the fact that its a probabilistic algorithm.
when the variance over a filter region is high we probably see light bleeding artifacts, we more likely to see LB in scenes where depth complexity is high.
the good news is that VSM have a lot more advantages than disadvantages if we compare it to other pixel based shadows algorithm, also we can reduce the light bleeding issue by doing a smoothstep with the variance value and some threshold.
some of the advantages:
1. we can use mip maps on the "shadow map" texture (the variance map).
2. we can blur it like regular texture blurring (no pcf needed), and because of that we can use hardware filtering so as linear, anisotropic etc.
3. we can get good soft shadows a lot faster and smoother than using pcf.

i have added softness for both spot and point lights, point light is a little bit tricky :)
here is few screenshots:
no soft applied
with soft applied
no soft applied
with soft applied

No comments: