OpenGL problem with distant shadows

Hello to the group,
I am new to OpenGL and struggling with a problem in shadow mapping. I am using a depth cube map for shadows and everything is working fine for near shadows but far shadows have poor resolution, which makes sense but it is not acceptable.
Here is a screenshot of the problem :

Is there any way to improve distant shadows without raising the resolution of the depth map?

1 Like

Try first to reduce the projection to see only what is visible from the light.
After that, you have several techniques. Percentage closer filtering is one of them. Variance shadow map is another one, and there are others.

With directional lights, the common technique is to use cascade shadow maps. For position lights, like yours (this is what I suppose from your cube-mapping use), it is usually not expected that the cast will end far. Thus using one of the filter as listed above, and with slightly raising the resolution, with also confining the shadow (ie don’t cast too far) should be enough.

You could also have a look at some presentation. I could quickly found this one on google.

Thank you for your extended reply. It is very helpful. I am using a cube-map for directional light because it works very well and shades everything on screen. I will look into cascade shadow maps as you explained. Does cascade shadow map shade all objects on screen?

The thing with directional lights is that they cast in one defined and specific direction. Thus, you’ll end only with drawbacks with cube-maps since you’ll have to render to faces where the light doesn’t cast. You’ll be ~6 times faster without cube-map since you’ll render only one time, not 6.

I know it already dropped by 10 frames for a simple scene since I introduced the cube-map. I’m convinced in using the cascade shadow map. Do you have any pointers to get me started?

Google is your friend :slight_smile:

I found that quickly:
Cascaded Shadow Maps (NVIDIA)
Tutorial 49: Cascaded Shadow Mapping

Thank you very much for your help. Off I go :slight_smile: