• Advertisement
Sign in to follow this  

Too far for shadow mapping

This topic is 4324 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

I have a problem with shadow mapping. If the light source is too far away from shadowed objects, the shadow is cast incorrectly. If the objects are very far away they appear as dots form the light's point of view, so they cannot be shadowed. I want to render objects in space. They should be lit by the sun so they should be shadowed as well. But the sun is too far away to do simple shadow mapping. Is there any way to solve this problem.

Share this post


Link to post
Share on other sites
Advertisement
if you model your light as an orthographic projection, you can get the equivalent behavior of a directional light and still have the light located close enough to your scene to get good shadow map resolution.

Share this post


Link to post
Share on other sites
There are two solutions:

1) you go for a shadow volume and you're shadows will always be correct, even for omnidirectional lights. Shadow volumes are hard on fillrate though.

2) you chose a perspective shadowmapping algorithm that's view dependent. You're light will always be in the correct position, but the resolution of the depth texture is utilised in a more efficient manner. Be sure to pick a solution that works for omnidirectional lights, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by godmodder

2) you chose a perspective shadowmapping algorithm that's view dependent. You're light will always be in the correct position, but the resolution of the depth texture is utilised in a more efficient manner. Be sure to pick a solution that works for omnidirectional lights, though.


Be very careful with that method. You can get some bizarre pathological errors if there is a shadow caster located behind the camera.

Share this post


Link to post
Share on other sites
Shadow-mapping does become difficult to get right with parallel (infinite-distance) light sources, and you should be modelling the sun as a parallel light source. The key is to define very stringent near- and far-planes for the light volume.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
Shadow-mapping does become difficult to get right with parallel (infinite-distance) light sources, and you should be modelling the sun as a parallel light source. The key is to define very stringent near- and far-planes for the light volume.


Can You tell me how to model a parallel light source? I think that's a good idea.

Share this post


Link to post
Share on other sites
Quote:
Original post by cwhite
Be very careful with that method. You can get some bizarre pathological errors if there is a shadow caster located behind the camera.


Good comment. Although it might not be an issue in his specific case with the sun lighting a scene.

A nice article on estimating a near-optimal frustum for your light by Stefan Brabec can be found on his site:

http://www.mpi-sb.mpg.de/~brabec/
It is called "Shadow Techniques for Interactive and Real-Time Applications".
I haven't tried this yet myself, but it seems pretty practical.

Greets, Bart.

Share this post


Link to post
Share on other sites
I can't figure out how to create a shadowmap for parallel (directional?) light source. Can anybody help?

Share this post


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

  • Advertisement