2
votes

I'm trying to find the optimal shadow mapping technique(s) for use in my game engine. So far I've implemented standard shadow maps with PCF, cascaded shadow maps, and variance shadow maps. However, none of them seem to be providing satisfactory results.

I'm trying to find the optimal shadow mapping method for all situations. I am requiring backface correct geometry, so rendering backfaces can be used. However, I also have a fair bit of low-poly, smooth normals geometry, which results in some really ugly acne even when drawing backfaces.

What are some other techniques that can be used to get nice shadow maps, without severe acne, peter-panning or light bleeding, but also not place any major constraints on geometry (only backfaces)?

1

1 Answers

2
votes

Unfortunately, there is no general purpose approach that results in artifact-free shadows but I might be able to give you some hints.

Percentage closer filtering is not only a good starting point but is also the basis for contact hardening shadows (If you are interested I may give additional information about it). PCF basically yields better results than statistical algorithms like variance shadow mapping (VSM) or exponential shadow mapping (ESM) but is slower because the filtering step requires O(n²) instead of a seperable filter in O(n). On the other hand, light bleeding is a pain and cannot be removed completely.

The best approach for reducing or even removing shadow acne is dual depth layer shadow maps, which is an improvement of mid-point shadow maps. Both algorithms are explained in this paper:

Weiskopf D., Ertl T. (2003): "Shadow Mapping Based on Dual Depth Layers".

The technique requires an additional rendering pass of the scene for each shadow map (can be quite expensive when you are using cascaded shadow maps) but yields extremely good results in almost all scenarios. The depth peeling might be implemented in a faster way when using modern graphics cards and geometry shaders, which enable the rendering of two depth layers in one rendering pass. Unfortunately, this does not come for free and I have no experience with this technique yet. I have not found any technique that can remove Peter panning and shadow acne as well as dual depth layer shadow mapping.

If your penumbrae are not that big, you might be able to achieve great results with "normal offset biases", which are explained on a GDC poster:

Holbert Daniel (2011): "Saying goodbye to shadow acne".

The implementation can be a little tricky but removes worst case scenarios with steep slopes. Note that this technique also introduces new artifacts because it "shifts" the shadows a little bit.

In summary: I vote for PCF with dual depth layer shadow mapping and implementing contact hardening based on a blocker search and a filtering step. Other techniques like exponential variance shadow maps (EVSM), summed-area variance shadow maps (SAVSM) or techniques in screen space (mip-mapped screen space shadow maps) all come with a more complex implementation, light bleeding or edge cases where they simply fail requiring a fall-back approach.

For extremely high quality and physically accurate shadows you might consider multi-view shadow mapping (MVSS) which basically renders multiple shadow maps and accumulates their light contribution. They are explained here:

Bavoil, Louis (2011): "Multi-View Soft Shadows".

MVSS is expensive and is only usable in real-time for the main character or the most important object in your scene. It is available in "Batman: Arkham City" for Batman himself.

Good luck! :-)