Although it’s still the holidays, I decided to do a bit of tinkering today since there were a few things about the depth shadowmapping that had been bugging me. I’ve still yet to find a totally satisfactory biasing solution - this is of course a common factor in all depth shadowmapping algorithms, but I’d hoped to have some better results than I have, having implemented quite a few options including rendering back faces into the shadow texture instead of front faces, fixed and gradient-based biases, fuzzy depth comparisons, and a choice of either scaled linear or projective space depths. I can come up with adequate settings for most setups but it’s less friendly than I’d wanted it to be - I’m sure there’s something I’m missing, I think all these factors should give a more reliable result more easily for the general user. I’ll have to keep working on it. The biasing is fine when using uniform projection, but of course that’s a bit nasty 😉 I think the problem is to do with the fact that when using non-uniform projection the distortion of the frustum also distorts the depth buffer continuity - I’ve been trying to deal with that but I must be doing something wrong which is why my biasing results are too erratic.
In the meantime whilst I was playing I implemented a 5-tap Percentage Closest Filter since I was already reading several depths from the shadow map in order to derive the gradient bias (if I was using SM3 I could use the shader derivatives in the shadow caster to bias the depth, but since I’m aiming at SM2 or better I have to calculate it in the receiver), it looks quite nice I think you’ll agree. You’ll have to view the full-size version to really see it of course 😀