Files
UnrealEngineUWP/Engine/Shaders/Private/MeshDistanceFieldCommon.ush
tiago costa 972ba99ea9 Fix issue in Global SDF when multiple objects with Mesh SDF that extend outside the bounding box overlap.
Context:
- When composing objects into GlobalSDF we shorten the max distance based on the distance to the closest surface found so far
- the condition `if (DistanceToBox < MaxDistance)` is incorrect if mesh SDFs stick out of the bounding box
- this can cause instability in Global SDF since result will depend on the order objects are composited in

- we have logic to prevent this but only when the query position is outside of the bounding box
- this is a problem since Global SDF voxel centers can be inside the box

Fix:
- also prevent negative SDF distance to stick out of the bounding box when query position is inside the box.
- Modified how DistanceToBox is calculated to be valid when point is inside box.

#rb Krzysztof.Narkowicz
#preflight skip

[CL 23410499 by tiago costa in ue5-main branch]
2022-12-06 12:09:58 -05:00

1.5 KiB