Sign in to follow this  

Few words about trapezoidal shadow maps

Recommended Posts

Hello :)

I've noticed that this shadow map technique, TSM, is quite rarely mentionned.
I've implemented it, and I would like to share/discuss my (little !) experience about it :

Here's some advantages
- allow to control the accuracy of the shadow map along the depth
- no risk to miss occluders that aren't in FOV
- the trapezoid is defined to cover only the projection of the view frustum from light view : large better accuracy (*)
- the code (and more !) that computes the matrix that transforms the trapezoid into the unit square is provided by the authors : [url=""]TSM recipe[/url]
- there is a simple way to eliminate the dueling-frusta problem in general case (**) : the idea is to keep a constant sized top edge of the trapezoid (at the price of a bigger wastage of the map in some cases)
- since the shadow map is in camera direction in trapezoidal space, it's possible to get it more accurate in depth extending it along one dimension only. (I use 1024x2048)
- My shadows don't cover the entire depth of the view frustum, but they can be quite far anyway. It doesn't replace cascade shadow maps of course, but it's possible with only one map to cover with controlled accuracy a high depth range anyway.
- No problem with non-constant polygon offset, because it works with light space depths.

- The main problem I have is when the projection of the front face of the view frustum is inside the projection of the far face : I use then standard shadow map , and the sunden difference in accuracy is visible.
But in my case, a more or less horizontal camera direction, it rarely occurs (at crashes sometimes).

I post a picture, but my shadows have nothing special : classic blurred shadows

I'm really curious to know what's your opinion on this shadow technique, I'm opened to any suggestion/piece of advice :rolleyes:

Best regards

-I added non-blurred standard shadow map and non-blurred trapezoidal shadow map to permit to compare
-NB : for a scene with a small depth range, it's possible to get a per-pixel accurate TSM; my aim was to get an accuracy that is enough so that blur can eliminate aliasing

EDIT (again) :
-I've replaced the two pictures with non-blurred shadow, with new ones : the difference in accuracy is more visible

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this