Shadow mapping problems along the outline of object
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?
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
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
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
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
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
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement