Download

Confused about combining ray traced DF shadows with stationary lighting

I’m experimenting with different shadowing options, and I came across something that left me very confused. I want to combine baked lighting with ray traced distance field shadows (in forward, for VR, to reduce the performance hit caused by CSM). The RTDF shadows work as expected when the directional light is set to movable, as it is supposed to be according to the documentation. However, I don’t want to sacrifice the benefits of lightmass.

The solution seems straight forward: stationary light, dynamic shadow distance set to 0 to disable CSM, and RTDF shadows enabled. This works fine for static objects. However, movable objects and skeletal meshes which don’t have capsule shadows enabled create a shadow map shadow, even though dynamic shadow distance is set to 0. Where is this shadow coming from? Is there a way to get rid of it, so it stops eating performance?

In the first image, the MDF is shown. I purposefully used a low resolution, so it’s clear when the RTDF shadow is used. The table is set to movable, the chairs are static.

In the second picture, the light is set to movable. Both static and movable objects are casting the DF shadow.

In the third picture, the light is set to stationary, and light has been baked. The chairs, which are set to static, are still casting the DF shadow as expected. However, the movable table is now throwing a shadow map shadow, even though they are disabled. Setting r.Shadow.CSM.MaxCascades to 0 doesn’t change this either.

I think it might somehow be related to the CSM shadows used as preview for baking. When the light is first switched to stationary from movable, the movable object retains its RTDF shadow. It’s only after baking that it starts using a CSM shadow instead.

This is strange and interesting issue. I am trying to recreate the same, lets see if I could get a different explanation or we have to stick to the conclusion you have

If you disabled the CSM, the stationary light will use the per-object inset shadows instead for movable objects.

Aha, manually disabling inset shadows seems to do the trick! It’s a bit confusing that the option for inset shadows is greyed out when CSM range is set to 0, and that the movable objects don’t have “dynamic inset shadow” enabled, but once the setting is disabled on the stationary light, I keep the RTDF shadow even after baking. Thanks!