Flickering Shadows

I am getting flickering shadows, is there a known cause?

Hey @Win3xploder , could you expand on the issue? I’m not aware of anything relatively recent breaking the shadows

The issue is hard to pin down but disabling and enabling “Compute Light Variants” seems to affect/fix it somehow. It only happens when one of my meshes is on screen. I found a thread earlier stating that broken normals will cause issues with the renderer but as far as I can tell my mesh has no degenerate normals.

I’ve seen flickering also in 2020.2/10.x. I can’t actually say for sure it’s that version only, but it seems odd I would have missed it as it’s fairly obvious.

Lighting is outdoor it’s all realtime.

In my case it’s mesh trees that cause it. The actual leaf geometry is flickering slightly when the camera is moving but it only shows at around 20 meters or so away from the camera. And that render flickering has a direct correlation with shadows. It’s a very fast unnatural flickering that can’t be accounted for purely from the movement speed of the camera. I went through disabled all the volume overrides but that still leaves the defaults, I didn’t test with putting in a global profile with nothing enabled and build up. I did test with both HDRI and physically based sky but no difference.

This could be expected but that it seems to have changed seems worth mentioning.

Which HDRP version are you on? Do you have decals with “Affect Normal” enabled in your scene?

@snacktime are you able to share a repro project? Would help a lot if you could submit a bug report regarding this. I’ve tried to place around some trees on a terrain and check on various distances in 10.2.2 HDRP, but can’t seem to reproduce any flickering on my end.

I am on the latest version 10.2.2. I do have decals with affect normal enabled.

Guess this is a bit far fetched, as it’s not related to shadows, but if a mesh has zero normal and there’s a decal with “Affect Normal” projecting to it the result will be fullscreen black. Maybe it would also be worth a try to disable Decals in your HDRP asset. Anyway, if you could share the mesh or a small repro project showcasing this issue would help us a lot to investigate.

I’ll try to get time to get a repro. Playing around with it some more I think it’s likely more of a shader then a shadow issue per say. Darker shadows exhibit the behavior for example while lighter shadows do not. Or at least to such a degree that it’s not visibly noticeable. A ground surface with a different slope or texture has a huge impact.

Like in this screen the tree next to the water I didn’t produce a visibly noticeable flicker. The other one did. I did place a plane under the tree on the right just to rule out the terrain shader. Still saw the flickering against the white plane.

The effect also doesn’t repro for me in the editor only while playing.

The flicker itself visibly looks a lot like aliasing impacting shadows. It’s distance sensitive and there is a near/far range. And as you get closer to the far range the patterns are larger and you can see it’s more of an oscillation.

@snacktime checking on my end I only see flickers caused by small gaps letting light go through the leaves when moving the camera or when trees themselves are moving, this seems to be expected. What’s your Anti-Aliasing setting in Scene view camera and Game Camera? With TAA that flicker seems less noticeable.