Shadow jittering back and forth

Hi there! Does anyone have ideas about this strange shadow flickering effect? I have applied PCF and bilateral filter but they only have limited help. I used a cascaded shadow map with 3 layers 1024x1024.
jittering

It’s fairly common for shadow maps to do this if you set their bounds based upon the intersection of the view frustum with the world. To prevent this, you have to explicitly align the shadow map’s pixel grid with the world so that the pixel grid doesn’t move even as the bounds change (i.e. the bounds only change by whole pixels).

What GClements suggests will handle the case where your shadow map needs to translate in space (e.g. shift along the ground) without causing “edge flickering” of static shadow casters in your shadow map.

However, when your casting light source moves (in relative angle), that of course changes the shadow caster silhouette profile in your shadow map. Similarly, when a shadow caster is dynamic (moves), the shadow caster’s profile will change in your shadow map during movement. So you’ll see edge artifacts in those cases.

Yeah, this is the problem I’m handling. The light source is dynamic so that the flickering seems inevitable. Do you have any suggestions to resolve this? Increase map resolution helps, but the map size will increase exponentially.

  • As you said, increased shadow map res, so the edge pixels span a smaller area of world space.
  • Tightening the extent of the shadow map to the minimum required to cast shadows from your dynamic casters (again, so the edge pixels span the smallest area).
  • Better filtering (e.g. VSM, ESM, etc.) will help mask shadow edge inaccuracies / shadow crawling.
  • Are you using built-in PCF filtering for shadow map sampling? If not, you should definitely try that. It’s easy, virtually free, and helps filter the edges.
  • An MSAA shadow map gets you higher spatial res than 1x for about the same cost to render (just more mem). Apply can multi-tap sample the texture to put a little filtering on that if needed.
  • If you have a deep scene in the perspective view frustum, Cascaded Shadow Maps can help match the shadow res with that needed at specific perspective depths.
  • Using a different shadowing method that doesn’t operate a different spatial rate than view frustum rasterization, or which filters easier.

This is just a small set of the entire possibility list. Pick up a good realtime rendering which discusses shadowing techniques. I haven’t looked into this in years, so there may be some new, cool stuff for 3D realtime rasterization rendering.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.