Jump to content
  • Advertisement
Sign in to follow this  
d00sint

Shadow mapping problems along the outline of object

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

Hello, After having implemented standard shadow mapping for the first time, I realized i had som problems along the contour of the object (from the lights point of view): I spent a good while wondering what I had done wrong, until I realized that this must be a pretty standard problem with shadow maps. I also noted that for example the simple hardware shadow map implementation by nVidia has the same problems: How is this particularly irritating aliasing problem normaly dealt with? Here, increasing the shadowmap resolution doesn't help at all? Anyone got a good solution where i can get continous shadow-lines also along faces that are almost perpendicular to the light?

Share this post


Link to post
Share on other sites
Advertisement
Hi There,

You'll want to use a very small bias (almost nothing) and a decent slope bias when rendering your shadow map. That doesn't look like your problem though. When it comes to self shadowing, usually your lighting model should fade out the light as it approaches the border where the shadow kicks in. Are your lighting calculations consistant with your shadow map type? For example, a directional light should go with an orthogonal shadow projection, and point light should go with projective shadow map. It's best to have very little ambient on shadowed lights. Put a second light in for that.

If you think about it using flat shading: as the polygon gets close to facing away from the light it will get darker and darker until it is perpendicular and it is completely black. In your engine the area where it is close to perpendicular the lighting is still bright so I think that's your problem.

Cheers!

Eric

Share this post


Link to post
Share on other sites
Hello,
Thank you for your reply, setting the bias (very) carefully certainly helps, but does not solve the problem. And indeed, if I only have one light and no ambient light I can hide the uglyness pretty well (I actually turned on ambient light in the nvidia demo just to show what I meant), but what if I toss on a second light? Is there no allround solution for this problem? What do people do in games? I can't remember seing theese kinds of artifacts in any published title ;). Thanks again,

Erik Sintorn

Share this post


Link to post
Share on other sites
Hey there,

If you turn on a second light then it will light both the shadowed area and the non-shadowed area equally, so that won't look bad. So on second thought the ambient light shouldn't be the cause of the problem if it is implemented correctly. Game engines have this problem too and I believe it is handled like I mentioned. What is likely happening is your shadow is cutting off the contribution of something more than just that one light...

<edit> For example, if there is an ambient contribution maybe the shadow is cutting it out when really the ambient should get added in at the very end after calculating the shadow contribution * phong etc.

Eric

Share this post


Link to post
Share on other sites
increasing the SM res should hide it better,
though theres no way u can get rid of it. u can hide it better though
- render the backfacing polygons (from lights viewpoint) into the SM
- try to have the same color shading for backfacing (from lights viewpoint) as the shadows, ie in the face picture if u turn off shadows im pretty sure the shading wouldnt be so dark

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!