Exponential shadow mapping drawbacks.

I created a model that could demonstrate some harder cases for the various shadow mapping filters that I experimented with the other day.

Raytraced render of the new test model.

This model (which is two copies of a sort of church-like building), casts shadows on itself (where we will see contact light leaking), and the windows provide various sized gaps in the self shadowing (where we will see ESM’s oversized shadows drown out the gaps).

 

Here is a render of the model(s) in the game engine, viewed from the inside:

1 tap ESM, 1024x1024 shadow map with 2 cascades, 4xMSAA + 3x3 box blur

Notice how light leaks through at the corners of the church in the image above.

By rescaling the ESM results further (and throwing away more of the blur), we can reduce this artifact:

However this makes the shadows even larger (“fatter”), and reduces the size that a window can be before light shows through. (The two small windows are already missing in the shadow.)

1 tap ESM with 1024x1024 shadow map, 2 cascades, 4xMSAA + 3x3 box blur

Notice the lack of shadow at the top of the church, near roof edge. Overall I would say that this is not too noticeable. However, this is a best case, where the church is quite large relative to the size of the scene (the ground edge in the background stops just before the depth range ends).

4 tap dithered PCF, 1024x1024 shadow map, 2 cascades.

When using 4 tap dithered PCF, there is no leaking and the small windows let some light through. Notice that the large windows on the right also now allow light through. Of course, the shadow edges are not as soft, and the shadows shimmer during movement, and the dithering pattern changes during camera movement.

4 tap dithered PCF

With 4 tap dithered PCF, self shadowing is improved. Notice that the roof now begins to self shadow the building. Also notice slight peter-panning in the roof shadows due to the roof offset being large, as slope-scale biasing must add more bias to the roof than other parts of the building (because the roof is at a large angle to the light).

4 tap PCF with 50px sampling area random disc

Above the shadows error is unstructured compared to the regular dithering pattern, and the sampling area is larger so the shadows appear softer. This sampling method mostly hides the underlying shadow map, although the dithering pattern changes during camera movement. It’s far from ideal, but may be better in some cases, where self shadowing is important, and contact light leaking is important. Adding two more cascades would sharpen the shadow edges while completely hiding the underlying shadow map.

Exponential Variance Shadow Mapping also solves these issues at 4x the memory usage, while still producing smooth shadows. I may experiment with EVSM, although I doubt that it is an affordable technique on the Xbox 360 unless significant compromises are made.

4 tap PCF with random sampling from 50px area disc

In the image above, we can see that there are shadow acne problems due to too little bias while at the same time the top roof shadows are peter-panning due to too much bias. Slope-scale bias is already implemented here, and only surfaces facing the light are drawn. Using more cascades, or a larger shadow map, or a smaller sampling area would solve this problem.

Final decisions on which shadow technique combinations will be used will be made when the scene is more complete, and left over performance is more limited.

This entry was posted in Coding, XNA and tagged , , . Bookmark the permalink.

One Response to Exponential shadow mapping drawbacks.

  1. Pingback: Shadow map filtering experimentation. | Olhovsky

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>