Cascade shadow mapping?

Started by
21 comments, last by wolf 17 years, 10 months ago
I have been looking for some info on implementing this technique or has anyone tried it themselves? Any background info on it would be great also. Thanks
Advertisement
I've implemented it (at least what my interpretation of it was -- as there's not a whole lot out there on it, at least that I could find) with pretty good results.

To me at least, CSM was a lot more straight forward and intuitive in terms of handling its special cases rather than some of the more complicated issues and special cases associated with things like Perspective Shadow Maps or Trapezoidal Shadow Maps.

In essence you can divide your viewing frustum up into several regions -- dedicating a shadow map to each region.

I currently split the frustum into two regions. You can do more, but then it'll require a more complicated shadow caster/receiver determination algorithm -- which could start to get a little crazy. The two region approach essentially gives you a "higher-rez" region closer to the camera and a "lower-rez" region beyond the "high-rez" region's cutoff.

The only real issues at that point are handling the areas of adjacency -- i.e. the border between each region and the regions of light frusta overlap -- as you'll have a "virtual" light frustum bounding each "region".
Brian, this sounds interesting. How did you construct the view frustum for those two shadow maps?
I got this link around here I think :
http://appsrv.cse.cuhk.edu.hk/~fzhang/pssm_vrcia/shadow_vrcia.pdf
Parallel Split Shadow Mapping, basically what you want, it's quite effective and waste less fillrate and memory (smaller ShadowMaps).
-* So many things to do, so little time to spend. *-
did you implement this? I think it is not usable in a game or a game like environment.
Quote:Original post by wolf
did you implement this? I think it is not usable in a game or a game like environment.


Not yet, but I plan on doing it "soon"...
-* So many things to do, so little time to spend. *-
Quote:Original post by wolf
Brian, this sounds interesting. How did you construct the view frustum for those two shadow maps?


I don't know if what I implemented is what is described in that paper -- as I've never seen or read that paper before. When I get a chance I'll take a look at it just to see whether it is or is not what I've done.

As for constructing the two "virtual" light frusta, it's pretty straight forward. As you know, a directional light only needs to use an orthographic projection - no perspective projection required.

In this particular case, you'll be constructing two "virtual" frusta -- one to tightly bound each of the regions of your split viewing frustum.

I believe I actually maintain two separate shadow frusta with the camera's frustum -- one representing each of the two regions.

One of each of those corresponds to the high-rez and low-rez shadow regions in the visible viewing region.

To construct the two "virtual" light frusta I simply build a view matrix using the direction of the light. Then transform each of the eight frustum corners into view space and compute the max/min x, y, and z values (assuming your light view matrix has you looking down the z-axis). Those max/min x/y/z values will then give you all the info you need to build an orthographic projection matrix that tightly bounds that portion of the view frustum. You may want to give yourself a little lee-way on the negative side of the z-axis to allow for you to properly cull/detect off-screen shadow casters that while not "visible" will cast shadows into the viewing region.

At this point, you now have the light's ViewProj matrix for each shadow region, which can be used to render the corresponding shadow depth buffer for each region.
Thanks for the info Brian would it be possible to contact you on your method or get a quick tutorial on it? Sounds like a good method... As of now I have frustum culling working for my pathing system, but not sure how to implement that for shadowmapping also??? Thanks

Quote:To construct the two "virtual" light frusta I simply build a view matrix using the direction of the light. Then transform each of the eight frustum corners into view space and compute the max/min x, y, and z values (assuming your light view matrix has you looking down the z-axis). Those max/min x/y/z values will then give you all the info you need to build an orthographic projection matrix that tightly bounds that portion of the view frustum. You may want to give yourself a little lee-way on the negative side of the z-axis to allow for you to properly cull/detect off-screen shadow casters that while not "visible" will cast shadows into the viewing region.

I used pretty much the same method. The problem is that all the viewing frusta have to start at the same line ... so you render a bunch of objects twice or more(... with two maps these are the ones that are in the first slice). I will post a few other thoughts in the next mail ... I just need to make a few figures to show what I mean.

[Edited by - wolf on May 20, 2006 9:32:23 PM]
Here is how the sliced view frustum looks like:
Cascaded Shadow Maps / Sliced View Frustum
Figure 1
Here is how the light view frustum calculation is handled:
Cascaded Shadow Maps / Light View Frustum Calculation
Figure 2
Here is the problem with shadows that cross view frustas. This is the reason why all the light view frusta have to start at the same line and the reason for the overdraw.
Cascaded Shadow Maps / A Tree Casts a shadow in the following slice
Figure 3
here is the problem with the tree that is outside the view frusta but should cast a shadow into the scene.
Cascaded Shadow Maps / A Tree is outside the light view frustum but should cast a shadow into the view frustum
Figure 4
And here is the same scenario from a side view. This time I painted two different times of day.
Cascaded Shadow Maps / A Tree is outside the light view frustum but should cast a shadow into the view frustum - side view
Figure 5
The orthographic projection of the lower sun should catch the tree ... if it is not culled?

Let the discussion begin ....

[Edited by - wolf on May 20, 2006 9:57:20 PM]

This topic is closed to new replies.

Advertisement