Jump to content

  • Log In with Google      Sign In   
  • Create Account


Shadow mapping - near and far


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 george7378   Members   -  Reputation: 1132

Like
0Likes
Like

Posted 18 May 2013 - 09:41 AM

Hi everyone,

 

At the moment, I'm using my shadow mapping technique to make a small object cast a shadow onto the terrain from a fairly large distance. However, this means that I have insufficient depth resolution for the object to perform self shadowing, which I would also like. So, how can I create a shadow map with sufficient depth resolution to create self-shadowing, but also allows the shadow to extend out onto the distant terrain? It might help to know that my small object is always going to be in front of the terrain.

 

Thanks for the help!



Sponsor:

#2 kubera   Members   -  Reputation: 858

Like
2Likes
Like

Posted 18 May 2013 - 10:22 AM

You would consider rendering two shadows independently with different math parameters

and then merge theirs output textures into one shadow by the HLSL.

It would be less efficient (two shadows processed).



#3 george7378   Members   -  Reputation: 1132

Like
0Likes
Like

Posted 20 May 2013 - 09:11 AM

Thanks for the reply - I did consider doing this, and I think it might be the only way! I have noticed that a lot of games manage to render both self-shadowing and also shadows of distant objects like trees and buildings. Do they do a similar thing?



#4 menohack   Members   -  Reputation: 216

Like
1Likes
Like

Posted 20 May 2013 - 02:00 PM

If you are trying to cast a large shadow from a small object onto terrain you should be using a directional light (orthographic) since you are imitating the sun. Orthographic projections do not depend on distance so you can make the shadow map perfectly centered around the caster even if it is infinitely far away.



#5 george7378   Members   -  Reputation: 1132

Like
0Likes
Like

Posted 20 May 2013 - 02:54 PM

That's what I'm doing at the moment - the only problem is that the terrain is so distant that the depth resolution isn't good enough to allow for self shadowing as well as the casting of the distant shadow.



#6 menohack   Members   -  Reputation: 216

Like
0Likes
Like

Posted 20 May 2013 - 05:03 PM

Use multiple shadow maps for a single light. One shadow map contains only your lunar lander while the other has the entire scene. When you draw the lander switch to the new shadow map. When you draw the terrain switch to the other one. This requires two depth passes and an extra shader resource view of another depth texture.


Edited by menohack, 20 May 2013 - 05:04 PM.


#7 Steve_Segreto   Crossbones+   -  Reputation: 1460

Like
0Likes
Like

Posted 20 May 2013 - 11:22 PM

@OP: One way to solve the problem you describe is to use something called a Cascaded Shadow Map (CSM). Google has information and some code examples.






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