Shadow Swimming Problem

Hello guys,
on my journey implementing shadows in my engine i decided to use Variance Shadow Mapping.
Everything works fine (directional-, point- & spotlights) except there is this ugly “shadow-swimming”, when lights are moving/rotating in my scene. (
I dont know if this is a synchronization error in my code or if its a generally problem in shadow-mapping.
With higher shadow-map resolution the effect is less noticeable.
Hope you can help me to fix this problem, so i can finally finish shadowing.

Thanks in Advance :slight_smile:

If your projection matrices are dependent on the scene, light or camera position it is possible this is caused by the shadow maps shifting by a non-integer multiple of a shadow map texel with respect to your world. Say in frame N your shadow map is at a specific position in world space and in frame N+1 it has moved a little bit, but not by an entire shadow map texel, you get this shimmering effect along shadow edges. See e.g. dev DOT theomader DOT com SLASH stable-csm (sorry not enough posts to do proper links) for perhaps a better explanation and how to fix it.

Yes, i was aware of that and snap my lights already to shadow-map texel, so this swimming wont happen when the light/camera moves (with the light-frustum) around. The problem is that this “shimmering” happens when the lights rotate.