I am having a shadow shimmering in my scene when using a shadow mapping technique. I know that there is a lot of posts over the internet dealing with this subject but my issue is slightly different.

I know that the problem comes from sub-texel issue when moving the camera BUT my scene is using a different technique as the camera and the light sources are stable and the objects inside the scene is moving Relative To Eye concept (RTE). The issue is when implementing cascaded shadow mapping and variance shadow mapping as stated in DirectX examples, everything goes well except that the shadows are shimmering (flickering). The shimmering is coming from the objects that are moving, not the camera. So when I try to solve the problem with adjusting the sub-texel problem with the camera movement it didn't solve the problem as the camera is stable but the objects are not.


The easiest way to overcome this would be blurring your shadows. This is obviously not a perfect solution, but might be worth trying it out, it might just solve your problem.

Now, there are multiple way of implementing soft shadows. The most straighforward way is to sample your shadow maps multiple times, and interpolate the shadow comparison results. This is called percentage closer filtering (PCF). This is trivial with a comparison sampler, because the sampling result is already a filtered comparison value. You can use a jittered shadow sampling kernel or sample neighborhood shadow map texels in a regular grid.

You could also be blurring your shadows in a full screen pass.

You can blur the shadow maps themselves before the comparison if you are using Variance shadow mapping technique.

You could do a temporal filtering for shadow maps maybe with an offset shadow projection matrix and blending with the previous frame's shadow map. I haven't seen this technique being applied to shadow maps yet, but this is widely popular these days for anti aliasing.

  • \$\begingroup\$ I tried blurring the shadow map as I am using the variance shadow map but this didn't help. Also, I used large kernels in cascaded shadow mapping but a black dots appears in the vertical surfaces. \$\endgroup\$ Sep 29 '17 at 17:08
  • \$\begingroup\$ The PCF filter technique is the simplest to achieve an okay result. I do believe there is a technique around adjusting the camera in pixel increments (basically to reduce the shimmering) which you can employ also, I think Frank Luna has an example in his DX 11 book. But I wasn't able to replicate myself a suitable result from that technique, but the principal seems sound. \$\endgroup\$
    – ErnieDingo
    Sep 2 '19 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.