I'm doing Simple Shadow Mapping and have problems with handling shadow acne and erroneous self shadowing and just can't get rid of it.
I already tried adding a bias to the depth value and rendering back faces to the depth buffer, but it doesn't remove all artifacts.
I also have problems choosing the right bias which leads to Peter Panning.
Here I have some screenshots.
So my questions are:
Is there a robust (and easy) way to completely eliminate shadow acne and erroneous self shadowing?
How to choose the perfect bias?
There's a technique called variance shadow maps which is subject to its own peculiar artifacts, but which is very good at eliminating shadow acne and erroneous self-shadowing. It was designed as a nonlinear filter for shadow maps, to avoid jaggies due to low resolution.
Briefly, it estimates the variance of the depth map, and uses that to find a smooth, conservative estimate of shadowing vs. depth. You need to be careful about buffer precision, as most implementations seem to evaluate the variance in ways that abuse their dynamic range.