Cascading shadow maps - best approach to learn

Started by
5 comments, last by Kurt-olsson 11 years, 6 months ago
I think i will have to give up using this in my first edition of my game. Cascading shadows are complex and i have to little knowledge.

What do you think is the best approach for me to learn to one day be able to implement this in my game?
I am thinking about this approach:


1, make sure to get full control with RenderToTexture
Being able to change camera and render to texture and then draw the texture in my scene at the same time

2. Reflection and DepthBuffers
This is a part of the technique that is used in Cascading shadows, but i cant think of an example to laborate with...
Maybe be able to render the the ShadowMap only...


There is a Sample in the DirectX SDK that has both D3DX11 and Cascading shadow Mapping.
Maybe i am wrong, but i don´t understand why these examples has so lazy/bad code in them?
First there is 100 options in the GUI that complicates all parameters and there is often too much functionality build within the sample.
Maybe people like DXUtil, but i hate it, i want to know from the basics what i am doing.

Under category this sample is marked as "beginner". How can this be "beginner" sample, is it me that is that stupid but you have to have understanding of lots of things to get shadow-mapping to work.

Should i try to outbreak the SDK Sample and remove code by code to try to see the basics?

How would you do to learn shadow mapping? (Cascading especially)
Advertisement
I learnt it by... drawing everything on a piece of paper smile.png
For the code, I get the idea from MJP here -> http://mynameismjp.wordpress.com/2009/02/17/deferred-cascaded-shadow-maps/
Maybe it will help you too ;)
The DX11 sample is complicated because it demonstrates a lot of (advanced) functionality. Cascaded shadow maps in general can be pretty complicated, and some of the examples you'll see will reflect that. I agree with you that DXUT is pretty bad, but that's just something we have to live with. smile.png

Anyway, I definitely think you should have a firm handle on using render targets and depth buffers if you haven't done so already. If you haven't done shadow mapping yet, you might want to try doing it for a single spot light first. A spot light is a *much* easier case than directional lights. After that, you can try getting a basic directional light shadow map without cascades. That will introduce you to some of the particular issues tackled by CSM, without having to implement the whole thing.
The DX11 sample is complicated, but its technical article was very well written (IMO).
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416307%28v=vs.85%29.aspx

It really helped me understand how the technique works.
I figured it out by doing each piece of the puzzle slowly. I can't stress how important debug drawing helps.

Steps I took:

1) I visually draw my view frustum
2) I split my view frustum into 4 slices and then draw those.
3) I setup an orthographic camera that uses each frustum (I didn't draw anything for this, but I set my main camera to each orthographic view slice of the frustum to see if I was seeing exactly what's in the view frustum.
4) Then I setup my render targets to a large texture and draw each orthographic view into them so you have 2x2 using the 4 slices of the view frustum.
5) Lastly, project that shadow map onto the scene, but you'll need to figure out the depth to figure out which 2x2 area you are projecting on the scene. This is a very confusing step, but it's the last step, so if you get to this point, keep working on it!

Good luck! It took me about a week or two to get this working, take your time and understand each step. If you don't understand a reason for something, you might miss something crucial.

Jeff.
I bump this because I am looking for a tutorial on this topic. The theory from microsoft and nvidia is ok but not enough for me to grasp it.

How the actual orthogonal-ligh-shadow-map is correlated with the camera scene to determine if the pixel is in the shade is what I can't get.
Thanks for all your answers, i am having some progress with RenderToTexture and being able to render my scene to a cube in my application.
Debug is king with Pix - application, without this it is going to be hard work. =)

This topic is closed to new replies.

Advertisement