flickering shadow on translucent material

I’m trying to fix a bug that I’m having a hard time reproducing. It’s happening on at least one player’s system consistently no matter what settings (DX11 or DX12, lumen on or off), on one of our machines it’s pretty random (sometimes you start the game and it’s there, most times you start it and it’s not), and I was told it was seen on PS5 as well.

The issue is that shadows (we only use dynamic shadows) rendered on translucent materials flickers quickly on and off.

No graphics settings fix it, except for turning shadows completely off (which, well, yeah, shadows can’t flicker if they’re not there).

Playing around with show flags, the logical ones “fix” it, like disabling lights/shadows/SSAO. But I’m surprised to find disabling Decals or Particles/Niagara also fixes it. Of course not an actual solution, but interesting. Reflections, refraction, etc. don’t seem to cause any change.

The translucent materials are lit surface materials rendering before DoF. It has appeared on both modern Nvidia cards (though it seems like it’s a laptop chip?) and a couple years old mid-range AMD card

I know it’s a long shot, with this little amound of info, but it’s all I’ve got at the moment. I’d appreciate it if anyone is familiar with this

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into these flickering shadows for you.

Can you please send us a minimal test project that demonstrates this artifact, and include screenshots/videos of the issue in the test project?

The guide for test projects: [Content removed]

sadly no. Sometimes you start the game (on certain machines) and it happens, sometimes you start it and it doesn’t. Wouldn’t even know what to do to recreate it in the test project.

Only have that video as I didn’t remember to record another one last time it popped up again.

Additional info: I don’t think we had it in Unreal 5.4.2 (none of our early access players had it when we were on that version), and must’ve snuck in with 5.4.4 or 5.5.1, IF it’s from an engine change.

Hello,

Can you try capturing a RenderDoc or Pix capture of the issue?

If it is machine-dependent, please make sure that your graphics drivers are up to date. If the issue persists, can you share what hardware and driver versions you are experiencing the issue on?

Are you using VSMs or cascaded shadow maps?

We’re using CSMs. I managed to capture two frames of the flicker, to compare with and without the shadow/light(!?). It’s noticeable on the water (a regular translucent material, not singlelayerwater)

Virtual Shadow Maps seems to fix it, but we’re hesitant to go with it due to performance concerns.

Edit: apparently still happens very lightly at least on PS5. Maybe there’s two different issues happening simultaneously? It’s best noticeable on a part of the material that uses the depth fade node.

Hello,

For future reference, please make sure that GPU Captures have the pass names in them. This assists when trying to use them to collect information.

Based on your captures, it looks like the flickering is coming from the translucency pass itself, rather than the shadows on the opaque geometry behind them.

Are you using WPO in your translucent Materials? If so, this ticket might be relevant:

[Content removed]

Are you using Lumen Hardware Ray Tracing? If so, what is the values of the CVar “r.Lumen.HardwareRayTracing.LightingMode”?

We replicated a similar-looking flicker when using Lumen HWRT and this CVar was set to 1, along with CSM shadows, but are unsure if it is the same as your flickering.

“please make sure that GPU Captures have the pass names in them”

How would I ensure this? First time using RenderDoc. Could it be that it didn’t have the names because I used a global hook?

The material does not have WPO on it, nor are we using Lumen, so it must be some other kind of flickering.

Hello,

Thank you for your patience.

We are continuing to investigate this issue and will get back to you.

Hello,

Event names are enabled by default, but are compiled out for Test and Shipping builds. They can be manually enabled by the following build setting in your .Target.cs file:

  • “bAllowProfileGPUInShipping” for Shipping builds
  • “bAllowProfileGPUInTest” for Test builds

You might need to use the console command “ToggleDrawEvents” to enable the events for Test and Shipping builds, when it is compiled in.

You can find more information about using RenderDoc with Unreal Engine here:

https://dev.epicgames.com/documentation/en-us/unreal-engine/using-renderdoc-with-unreal-engine

Can you please answer these questions and perform these tests to help us narrow down what is causing this flickering?

Are you using a weather system where the sun moves?

What are the values of the shadow quality CVars you are using or have changed from the default?

Since you mentioned Depth Fade, have you tried bypassing this Material Expression as a test?

we’re not moving the sun.

Here’s the general CVARs, and also the PS5 specific ones (since that’s the platform we got the issue consistently). I’m not sure which ones may be relevant, so I tried to include as much as I could.

`DefaultEngine
r.RayTracing.Shadows = False
r.Shadow.RadiusThreshold = 0.005
r.Shadow.Virtual.Enable=0
r.DistanceFieldShadowing = 0
r.CapsuleShadows = 0
r.AmbientOcclusion.Compute = True
r.AmbientOcclusion.Compute.Smooth = True

DefaultScalability
[ShadowQuality@0]
r.Shadow.DistanceScale=0.0
r.Shadow.CSM.MaxCascades=1
r.Shadow.RadiusThreshold=0.02

[ShadowQuality@1]
r.Shadow.DistanceScale=0.725
r.Shadow.CSM.MaxCascades=1
r.Shadow.RadiusThreshold=0.02

[ShadowQuality@2]
r.Shadow.DistanceScale=0.825
r.Shadow.CSM.MaxCascades=1
r.Shadow.RadiusThreshold =0.01

[ShadowQuality@3]
r.Shadow.DistanceScale=1
r.Shadow.CSM.MaxCascades=1
r.Shadow.RadiusThreshold=0.005

DefaultDevice
+CVars=sg.ShadowQuality=3
+CVars=r.AOQuality=1
+CVars=r.VolumetricFog.GridPixelSize=16
+CVars=r.VolumetricFog.GridSizeZ=64
+CVars=r.ContactShadows=1
+CVars=r.VolumetricFog=1
+CVars=r.Shadow.MaxNumFarShadowCascades=1
+CVars=r.Shadow.FarShadowStaticMeshLODBias=1
+CVars=r.Shadow.MaxCSMResolution=2048
+CVars=r.Shadow.MaxResolution=2048

PS5
+CVars=sg.ShadowQuality=3

[PS5_120 DeviceProfile]
+CVars=r.Shadow.MaxNumFarShadowCascades=0
+CVars=r.Shadow.MaxCSMResolution=1800
+CVars=r.Shadow.MaxResolution=1800
+CVars=r.DFShadowQuality=2
+CVars=r.ContactShadows=0`

we have bypassed the depth fade node and it did seem to help. But not consistently. I think it’s just that without the depth fade (being used to lighten the water shore for instance) the water was just darker and thus shadow issues harder to see.

Currently we’ve switched to surface forwardshading on the most egregious materials, and that does seem to fix it. Though it’s not an ideal solution.

Hello,

For platform confidentiality, please keep console implementation specifics to the appropriate console group for that platform. In this case, the information provided was only platform-agnostic CVars, so there are not any issues.

As a test, can you please see if “r.TranslucentLightingVolume 0” prevents the flickering?

Are you using “Cast Cloud Shadows” on the Directional Light? If so, can you try disabling cloud shadows to see if it prevents the flickering?

If you are using the cloud shadows, what is the value of “r.VolumetricCloud.ShadowMap.TemporalFiltering.NewFrameWeight”? We saw some flickering when it was less than 1, but it might be unrelated and visibly looked different.

Have you made any engine modifications to the translucent lighting volume?

Please let us know if this helps.

Cast cloud shadows: is off

No engine changes to the translucent lighting volume.

Disabling the translucent lighting volume does prevent flickering as far as I can tell.

Hello,

A few more questions to help us narrow this down.

Are you using any light functions?

Does the issue change depending on the camera FOV?

Is the flickering present with Directional Lights, local lights, or both?

Can you please send us a capture with debug markers?

Been struggling to reproduce the issue on PC. We resorted to changing the problem materials to “surface forwardshading” to deal with it (it works! For sure 100% now, unlike virtual shadow maps … but not the ideal solution either).

So I’m trying to work with an old changeset where I put in the things to make renderdoc work. But now I can’t get the issue to show up. Doublechecked with an old shipping build from roughly the same time, where the issue does happen, but I can’t get any debug info out of captures from that one.

We’re using light functions to create fake cloud shadows

I’m pretty sure camera FOV didn’t affect the issue

Flickering is present with directional lights. We have no shadow casting local lights that I could use to test local lights with.

Attached the capture, though as mentioned the flicker did not happen, so I don’t know how helpful it can be.

I’ll try again to get a capture by the end of the week

Hello,

Since you are using Light Functions, CL: 38381205 from //UE5/Main might help you.

Fix for light object position not being resolved correctly in Light Functions. Also unblocks UI/PostProcess/Decals from using the Object Position node. Return float3(0.0) for incompatible pathways (e.g. PP and Light Atlases).

If the above CL does not help, you could also try CL: 38602096 from //UE5/Main. It is possible that the flickering is due to resource synchronization issues that might be solved by this CL.

Please let us know if this helps.

Unfortunately by now we’ve reached a point in development where we prefer to not make changes like that. But thank you for your help!

Hello,

Thank you for the reply.

Can we close your case? You can always re-open it if you find you need additional assistance with the same issue.

Yes please!