Shadow mapping thoughts [Screenshots inside]

Started by
22 comments, last by hplus0603 18 years, 2 months ago
Quote:Original post by Anonymous Poster
We are using Cascading Shadow Maps (2 physical maps emulates 6 logical
cascaded maps) in our current game with great success

http://www.elmatador.net/images/Gallery/JAN06/JAN06_screenshot_ElMatador04.jpg
http://www.elmatador.net/images/Gallery/JAN06/JAN06_screenshot_ElMatador08.jpg
http://www.elmatador.net/images/Gallery/JAN06/JAN06_screenshot_ElMatador02.jpg


Can you describe how you implement CSM? There are some approaches, I'll sketch the one I imagine 3D Mark 2006 is using (or you might say the one I implemented ;-):
1. Divide the view frustum into five adjacent (but not overlapping) frustums along the viewer's z-Axis.
2. For each frustum - starting with the most distant one - do:
2.1. Clear screen z-buffer (but don't clear the color)
2.2. Create a standard shadow map for the current frustum
2.3. Apply this shadow map to the scene for the current frustum (this means only to apply the frustum's projection matrix to the scene) such that a black and white image for shadowed and non-shadows regions is drawn. The color information for frustums closer to the viewer overlap that of more distant ones (kind of painter algorithm).
3. Use the screen as a texture and render the scene using real materials and that shadow information

Is this a particular inefficient way of doing CSM?
Advertisement
Hi AP,

Do your cascaded shadow maps overlap, or do you use one per section of the frustum? If the later, how do you use them in your lighting pass - custom clip plane or stencil buffer to prevent double shadowing/lighting (or a better way)? I'm currently overlapping my shadow maps and don't have to deal with those issues, but I have trouble over picking the right shadow map - it's not as nice as i'd like, currently using both for objects which overlap the shadowmap boundry.

Very nice shadows, BTW :).
Unfortunately I cannot reveal technical details about our technique,
but here's some info anyway.

- We use co-centric set of uniform shadowmaps, each level covering larger
area than previous. So yes, shadowmaps are overlapping. (but when rendering
to shadowmaps, we use some clipping and culling to get decent sbuffer fillrate)

- Actual shadowing over entire scene is then performed in single pass, whith
per-pixel CSM level selection (there are no overlapping or double shadowing
problems). Shadow determination (including CSM selection) takes about 8 PS2.0
instructions.

Cheers
Petr S.
I didn't see anyone mentioning it, but the original screen shot shows the "duelling frusta" problem, which happens when you have a projected light aimed almost straight at a perspective camera.

When you use sunlight, there are two things that help you:

1) The sun is usually above you, not in your face.

2) The sun is usually directional, not a point light, and thus the duelling won't be nearly as harsh.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement