Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Cascading shadow maps - best approach to learn


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 10 October 2012 - 07:50 AM

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)

Sponsor:

#2 Tasaq   Members   -  Reputation: 1235

Like
0Likes
Like

Posted 10 October 2012 - 01:06 PM

I learnt it by... drawing everything on a piece of paper Posted Image
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 ;)

#3 MJP   Moderators   -  Reputation: 11620

Like
1Likes
Like

Posted 10 October 2012 - 01:18 PM

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. Posted Image

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.

#4 french_hustler   Members   -  Reputation: 382

Like
0Likes
Like

Posted 11 October 2012 - 10:10 PM

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.

#5 jeffkingdev   Members   -  Reputation: 779

Like
0Likes
Like

Posted 12 October 2012 - 09:03 AM

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.

#6 Tispe   Members   -  Reputation: 1039

Like
0Likes
Like

Posted 14 October 2012 - 03:36 PM

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.

#7 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 15 October 2012 - 07:17 AM

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. =)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS