🔒 Locked
Shadow Map problem
Advertisement
Original Post
you probably need to add a tiny bias to your depth-comparisation check. float precision makes your distance calculation almost represent the same numbers in both the shadow map and while using it but it isn't precise enough to catch this error.
watch out with making your bias too big tho, if you feel like you need to you might want to use front face culling.
watch out with making your bias too big tho, if you feel like you need to you might want to use front face culling.
I am wondering the precision of depth map generated in light space. It seems to me that the precision is far below single precision.
I am currently using NVidia GTX470 and I don't know whether this card needs to enable something explicitly in order to use single precision calculation (I know its non-sense).
Does anyone have another ideas since I have tried to use a number of bias values to improve the rendering quality, but doesn't help so much.
I am currently using NVidia GTX470 and I don't know whether this card needs to enable something explicitly in order to use single precision calculation (I know its non-sense).
Does anyone have another ideas since I have tried to use a number of bias values to improve the rendering quality, but doesn't help so much.
precision makes your distance calculation almost represent the same numbers in both the shadow map and while using it but it isn't precise enough to catch this error.Precision is absolutely a part of this. However, more importantly is the quantization of the shadowmap. When a depthmap is rendered, the texels' depths correspond to the depth of the scene at the center of the texel. Because the texture does not have infinite resolution, if the shadowmap image plane is at all at an angle to the receiving geometry, there will be problems.
You are correct; you do fix this with an offset and/or by culling front-facing geometry in the shadowmap pass. In OpenGL, I believe the command you're looking for is glPolygonOffset(...). Note that you'll need to enable GL_POLYGON_OFFSET too. If you're using a shader, add a small epsilon to your depthmap sample.
-G
I dont really get what you mean by improving quality of shadowmap when lighting is a small grazing angle but asuming you're talking about
the peter-panning problem, for me this was almost fixed (for everything but terrain) using the forementioned front face culling as this allows
you to make the depth bias really small.
About the precision problem you should take a look at optimal shadowmap distribution. In short this changes the light's frustum
to fit really tight around the camera's frustum. This makes sure you're not wasting any precision on parts of your scene that cant
be seen anyway. (be aware of occluders between light and camera frustum though, you dont want to drop those shadows). You could
also increase the bits-per-fragment of your depthbuffer but yeah that can only be done up to some point ofcourse. For a more
fundamental change you could take a look at cascaded shadow maps or parallel split shadow maps. While these dont really
increase the precision of your depthmap they're making the precision less of a problem because less precision is needed
for smaller sections of the scene.
the peter-panning problem, for me this was almost fixed (for everything but terrain) using the forementioned front face culling as this allows
you to make the depth bias really small.
About the precision problem you should take a look at optimal shadowmap distribution. In short this changes the light's frustum
to fit really tight around the camera's frustum. This makes sure you're not wasting any precision on parts of your scene that cant
be seen anyway. (be aware of occluders between light and camera frustum though, you dont want to drop those shadows). You could
also increase the bits-per-fragment of your depthbuffer but yeah that can only be done up to some point ofcourse. For a more
fundamental change you could take a look at cascaded shadow maps or parallel split shadow maps. While these dont really
increase the precision of your depthmap they're making the precision less of a problem because less precision is needed
for smaller sections of the scene.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement