Distance Filed Shadowing break issue

Hi there
I’m using the DistanceField effects and everything is working right but in a very specific case the editors breaks and exits.

Working with Unreal Engine 4.10.2
Engine - Rendering in project settings has Generate Mesh Distance Fields checked
My Map contains:
-some Movable actors with “Affect Distance Field Lighting” checked;
-a SkyLight (Movable) with “Cast Shadows” checked;
-a DirectionalLight (Movable) with RayTracedDistanceFieldShadows checked

When I disable r.DistanceFieldAO, enable r.DistanceFieldShadows and change r.DetailMode or r.MaterialQuality the engine breaks in
File: DistanceFieldShadowing.cpp
Function: FProjectedShadowInfo::RenderRayTracedDistanceFieldProjection(…)
Statement: check(!Scene->DistanceFieldSceneData.HasPendingOperations());

Is there a workaround to fix this? Or i’m doing something wrong?

Hoping it can helps:
Searching in the code I saw that it happens because the PendingAddOperations and PendingRemoveOperations are not erased in DeferredShadingRenderer.cpp by UpdateGlobalDistanceFieldVolume(…) because in case of disabled DistanceFieldAO the if “ShouldPrepareDistanceFields()” returns always false caused by SupportsDistanceFieldAO(Scene->GetFeatureLevel(), Scene->GetShaderPlatform()).
Is it right that the DistanceFieldShadowing depends like this from DistanceFieldAO?

Hi Fabre,

I was able to reproduce this using your notes above. I’ve submitted UE-26319 for this to be investigated.

Thank you!

Tim

Thanks for this. I also ran into this issue with distanceFieldAO in 4.11.1, and this thread saved me some looking around.
I can’t used DistanceFieldAO as it isn’t working yet with VR and instanced stereo rendering so i was trying to disable it.

For now, I’ve re-enabled DistanceFieldAO with “r.DistanceFieldAO 1” and “showFlag.DistanceFieldAO 1”
in my game instance, and that seems to work with setting the DistanceField AO settings at 0 in the skylight as a
temporary workaround. Will be looking forward to the fix.

Thank you for this post. I have had a light with distance field shadows turned on and this caused the crash.
So check lights if this occurs to you.
Also, curious thing is that I can’t remember enabling this in the light :slight_smile:
Cheers!