Precision of UStaticMesh vertices

Hi, we are rendering large terrain tiles at various sizes and resolution. The approx size of the tile’s extent in the picture is 276,992 x 243,967 x 234,252 where the tile mesh is slanted. The picture is the intersection of 4 adjacent tiles. We are importing these tiles from an external software that exports it into fbx, which then gets imported to UE with our custom pipeline. To our knowledge, the vertices are exported as doubles. In FbxMesh.cpp it seems that the original data is being casted from double to floats when filling the FMeshDescription. We are suspecting this is the main reason of the discrepancy we see in the picture, where the vertices are supposed to be exactly the same in world space - but it is not reflected visually. We’ve tried editing the vertex in the Modeling editor mode to the exact location but it seems to automatically be casted to floats and ends up reflecting a different value than what we put in. We are wondering if this is a current UE limitation, if a solution is being worked on to be released in the near future, and what steps are recommended for us to take.

If this is truly a limitation, that the vertices of UStaticMeshes can only be in floats, then we are wondering if a custom vertex factory that splits the source vertices (position,normal,tangent) into 2 vertex buffers and combining them at the beginning of the vertex shader (using LWC) - is a viable workaround. And what are the consequences of that method when using Nanite?

Hello,

Thank you for reaching out.

I’ve been assigned this issue, and we will be looking into these precision issues for you.

Hi Ronnin.

This is indeed a limitation of the engine. Mesh are indeed using float internally for their vertex. The double (LWC) are only used for the world space transformation. If I recall correctly, the rendering is still in float but this not a issue here since this is done from the perspective of the camera.

Assuming here the the units are in unreal that seems like a lot of imprecision for a 2.7 Km mesh. Are the origin point of those mesh centered inside of the mesh?

If they are not adding a step into your production pipeline to make it so and then using the actor/component translation to move them to right place would probably fix your issue. One way to validate that quickly would be to take your meshes instances that are close to the world origin and translate them to the location where you see the precision issue. If your issue is gone then I would say preprocessing the FBX would be the simplest way to fix your issue.

Let me know if this doesn’t help.

Pleasure,

Julien.

Apologies for the late reply, the issue we were having was from our mesh generation software itself causing the vertices to be off by ~10cm. If the source vertices were truly the same value in the fbx, our hunch is that the doubles would’ve been casted down to exact floats - but they weren’t. Thanks for the help!