• Advertisement
Sign in to follow this  

Shadow mapping - near and far

This topic is 1705 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement