Flickering/Wobbly Shadows Issue due to Day/Night Cycle

Hi guys,

I’m losing my mind a little here. I have a particular issue in regards to shadows flickering or rather, wobble due to my day/night cycle and I’ve had to hit the forums to see if anyone else has mitigated the issue or have alternative ideas.

You can see the problem here: https://www.youtube.com/watch?v=IrMHcfgrQJs

My game is using a two tone cel shaded post process for a number of foliage and assets in game and the directional light movement is updating per tick or rather, frame.

Steps I have taken so far to try and mitigate the issue (which has helped somewhat)

  • Adjusted Shadow Bias, Distribution Exponent, Cascades Amount and Transition Factor (tuned to the best results I can get
  • Stepped the light movement (although this helped the effect is still there, just “slower”
  • Set r.shadow.filtermethod to 1 (improves the flickering very well but introduces weird artifacts on certain objects, I would like to avoid this)

I can mitigate the problem entirely by enabling virtual shadow maps but due to the WPO and animated light nature I’m invalidating every frame which is a huge performance hit.

Has anyone encountered this issue or have better knowledge than myself (very easy to achieve lol) and have some solutions?

Probably using a post process cel shader over Lumen, which typically won’t work, because Lumen is not completely temporally stable.

Thanks for the reply. Lumen is disabled already.
I’m only using a moveable directional and all dynamic shadows

It’s hard to research the issue because everything points to Lumen in search results at the moment.

I’m assuming that’s this is some kind of shadow confusion between the hard edge of the shadow, WPO and the lights direction being updated every frame. But my assumptions don’t mean much as I don’t really know where else to look for improvements.

Turn off your post process and post a video. If it isn’t lumen my next guess would be that it’s virtual shadowmaps and you’re using a directional light with a large source angle.

I’ll get that posted in a second.
As for virtual shadow maps, the example above is with it disabled. I can completely solve the issue by enabling virtual shadow maps.

Edit: Source Angle? is that something I should look into?

Here is the test with Post-Process Material disabled. Issue doesn’t seem to be there nearly as bad but you can see the effect still regardless. Just far more subtle due to soft shadow gradient I guess.

I could be asking for too much precision using simpler methods of shading.

Shouldn’t be jittering like that but it may just be that the shadow cascade resolution is just too low. I would try reducing the dynamic shadow casting distance significantly, increasing the number of cascades, or adjusting the cascade distribution (all settings in the directional light)

I’m having this same issue after changing my scalability settings, but switching it back doesn’t fix it. I wonder what the setting is that causes it.

Thanks for the input Ark,

I have adjusted all settings except for reducing the dynamic shadow distance prior to making this thread. Reason for not lowering the dynamic shadow distance is because I have to have Distance Field Shadows disabled as the effect is worse with those shadows in the distance!

The cleanest settings I could get are as follows:

  • Dynamic Shadow Distance 15000
  • Number of Cascades = 4
  • Distribution Exponent = 1.8
  • Shadow Bias = 0.5 (either lower or higher values just seem to ‘move’ the effect around)
  • Shadow Resolution = 2
    (may have missed some, brain is melting)

This is interesting,
I will look into this.

I haven’t really messed with scalability apart from r.screenpercentage for DLSS, and FSR upscaling, but I’m going to test that now too.

I’m not a fan of these pre-defined scalability and gameusersettings nodes. They seem to get in the way more than anything.

Alright,

I have done everything you mentioned again and beyond.

If I stop my animated directional light (night/day system) the problem stops. So I know the issue is with lights animated movement and some sort of shadow invalidation. (I’m not using virtual shadows or lumen)

But even with all post process materials disabled, shadow cascades at max, dynamic shadow distances checked (no significant improvements at any lower ranges), resolution at maximum, shadow bias, light source angle and intensity, auto exposure settings, skylight settings etc etc I saw miniscule improvements at major sacrifices of my visual quality. In that second video I posted above we can see that this invalidation or problem is apparent even without forcing lighting information into bands in post-process.

I just don’t understand enough about Unreal Engine’s dynamic lighting system to fix this issue, and it seems to be a rare issue… for some reason.