Error distance field generated when using two-sided material

Error distance field generated when using two-sided material

重现步骤
1.Open Modeling Mode, create a box.

[Image Removed]

2.Create a Two-Sided material

[Image Removed]

3.Open StaticMesh Editor, give the Two-Sided material to the box

[Image Removed]

4.Show Mesh DistanceFields

[Image Removed]

5.Whether to check the TwoSided DistanceField option in StaticMesh’s BuildSettings will not affect the results

Hello,

Thank you for reaching out.

There might be an issue with the visualizer that we are investigating further.

Testing using a simple material setup using DistanceToNearestSurface shows that the actual data is what is expected. Are you seeing lighting issues with this or are you only seeing the visualizer as an issue in this case like we are?

[Image Removed]There is a difference in the effect of switching the TwoSided Flag on and off. I think it is not just a visualization problem.

When using a Material to check the Distance Fields, you need to apply it to a separate mesh, such as a plane, that does not write into the distance field.

If you apply the checking Material to any mesh writing into the distance field, you will get artifacts on the surface based on how close the mesh surface is to the voxels in the Global Distance Field texture. Since, with a two-sided Distance Field representation, the voxels inside will be positive, the artifacts will be different in that case.

For an example of this, you can see how it is done for the documentation of the DistanceToNearestSurface Material Expression:

https://dev.epicgames.com/documentation/en-us/unreal-engine/utility-material-expressions-in-unreal-engine#distance-to-nearest-surface

Please let us know if this helps.

This issue can be reproduced in 5.7.1, and it’s not a simple visual bug. I initially discovered that the problem was that Niagara leaf particles using GPU Distance Field collision were not colliding with a double-sided floor, but re-importing the same mesh without materials allowed for proper collision and they stayed on the surface (this took me a lot of time).
I removed double-sided textures from all materials, slightly changed the build resolution in LOD Build Settings to rebuild, and the holes and artifacts in the MDF disappeared in the viewport. The artifacts also appear to be related to the current camera (see this image). More details are similar to Distance fields issue

Due to confidentiality requirements, I cannot provide my screenshots.