There is a blueprint that will increase the TOD for the SkyAtmosphere. The volumetric clouds are largely stationary but do seem to have a bit of randomness.
The issue is that the global light that illuminates the scene will change or flicker drastically supposedly when it hides behind and then is exposed from the clouds.
The effect happens everywhere but is worse and easier to see when close to the horizon. It does not seem dependent on the lat/lon of the viewpoint.
ShadowMap vs Virtual Shadow Maps does not make a difference.
I would expect the global lighting to still be affected by the cloud cover but it should not change as drastically as it does in this example.
Steps to Reproduce
Using the repro file just hit play.
Otherwise:
- Create a simulation scenario with clouds
- Increase the cloud density so that the sky is around 60% covered in clouds
- Change the TOD so that it adjusts 1x realtime
- Observe global lighting
Hi,
thanks for reporting this and providing a repro scene. I started investigating the issue (it is in fact easier to see the flickering when speeding up the time-of-day by 10x or 20x realtime) and found that the flickering seems to be related to the cloud shadows: when disabling “Cast Cloud Shadows” on the DirectionalLight in the SunSkyTimeLoop blueprint, the flickering disappears. Can you confirm that?
Thanks,
Sam
Yes, I can confirm that this only occurs when the “Cast Cloud Shadows” is enabled on the directional light in question. In this case the sun.
I’ll also note that I think I left two volumetric cloud systems in the scene for the repro. That was by accident but removing the duplicate does not solve the problem.
Thanks for confirming. I did some further investigation and found that setting either of the following console variables can reduce or eliminate the flickering:
- Set r.VolumetricCloud.ShadowMap.SnapLength to 1000. This CVar represents the snapping size in kilometers of the cloud shadowmap position to avoid flickering
- Set r.VolumetricCloud.ShadowMap.SpatialFiltering to 4. This CVar enable/disables the shadow map dilation/smoothing spatial filter. Enabled when greater than 0 and it represents the number of blur iterations (constrained to a maximum of 4).
Increasing these settings may introduce some performance overhead, so this will need profiling to find the best settings or combination of settings.
Hopefully that helps. Let me know if you have any further questions or comments.
Best regards,
Sam
Hi,
>> About r.VolumetricCloud.ShadowMap.SnapLength… is that snapping the position of the shadow map rendering origin?
Yes, it defines the grid size used to snap the origin of the shadow map for volumetric clouds. By snapping the origin to a fixed grid, it helps stabilize the shadow map and reduce jittering or flickering artifacts that can occur when the camera, sun or clouds move slightly.
That said, I believe the best way to avoid flickering from the cloud shadow map is to increase the SpatialFiltering CVar, as I didn’t see much improvement in the flickering by using the SnapLength CVar until its value goes beyond 955, which reduces cloud shadows in the scene.
Thanks,
Sam
Hi,
setting r.VolumetricCloud.ShadowMap.SnapToPixelGrid to 0 is a good way to reduce the flickering, as the shadow map’s movement is smoother when this is turned off (not discretized to the pixel grid which may lead to sudden changes in lighting). I also found that the flickering can be reduced or smoothed by increasing the Cloud Shadow Ray Sample Count Scale on the Directional Light, although this comes at a significant performance cost.
Hopefully that helps,
sam
I actually found those same values late on Friday but was unable to measure the performance hit they added. I will be working on that today.
I am convinced that the flickering and drastic lighting changes were due to the hard edges that are probably present in the shadow map produced by the clouds. Blurring that image is probably the only solution other than making it a very high resolution.
About r.VolumetricCloud.ShadowMap.SnapLength… is that snapping the position of the shadow map rendering origin?
After experimenting with these values I’ve noticed that the SpatialFiltering CVar blurs the cloud map a little too much when set to 4. In order to eliminate the abrupt lighting changes I’ve had to set this value to 4 but doing so blurred the shadow map so much that individual cloud definition was completely gone. After 4 passes of blurring the shadow map essentially becomes one uniform shadow averaging out the entire map.
Is there another function that can be used to solve this problem?
I have had luck with setting
r.VolumetricCloud.ShadowMap.SnapToPixelGrid=0Just setting this value seems to remove the abrupt lighting changes. I think the snapping to a grid is where the issues are getting introduced but I didn’t have any luck with increasing or decreasing the snapping radius.
Simply turning it off and setting SpatialFiltering to 0 got me the effect I was looking for.