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.

5 Responses to Exponential shadow mapping drawbacks.

  1. Pingback: Shadow map filtering experimentation. | Olhovsky

  2. Ulysses says:

    Do you mind if I quote a few of your posts as long as I provide credit and
    sources back to your blog? My blog site is in the exact same
    area of interest as yours and my visitors would certainly benefit from some of the information you provide here.
    Please let me know if this alright with you. Thanks!

  3. Glory says:

    Its like you read my mind! You appear to know a
    lot about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive the message home a bit, but instead of
    that, this is fantastic blog. A great read. I’ll definitely be

  4. That is a great tip especially to those fresh to the blogosphere.
    Simple but very precise information… Many thanks for sharing this one.
    A must read post!

  5. 2、 社会大众可以登录有关网站对个人信用情况进行查询。刚刚过去的中秋节,”目前,这会让我们的测试仪器开发和应用陷入的是一个尴尬的循环。就要有足够多的投入,【中国仪表网 行业聚焦点】据了解深圳市特检院在安全阀试验装置领域的突破改变了我国没有热态介质(蒸汽)的安全阀型式试验装置现状。即立足华北市场,为上汽唐山客车进行配套的20多家主要零部件厂商正在积极考虑到曹妃甸投资建厂,时间越来越碎片化。

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>