Download

Ability to turn off using half floats for static mesh instance rendering transforms

The static mesh instance rendering code (FStaticMeshInstanceData) is currently written to always use half floats for the instance transform unless the platform does not support half floats. This was causing issues with us when we were tiling instance rendered static meshes together and it would leave a small gap between tiles. We’re using a 1 unreal unit = 1 cm scale and the transforms would definitely go past the half float’s precision.

Disabling using half floats for the transforms fixed the issues we were seeing. To disable that we had to make multiple engine changes in that class.

Code was written with this:

Initializing bUseHalfFloat
, bUseHalfFloat(PLATFORM_BUILTIN_VERTEX_HALF_FLOAT || GVertexElementTypeSupport.IsSupported(VET_Half2))

And have these checks to use half floats or not
if (PLATFORM_BUILTIN_VERTEX_HALF_FLOAT || bUseHalfFloat)

I feel like it should have been
, bUseHalfFloat(PLATFORM_BUILTIN_VERTEX_HALF_FLOAT && GVertexElementTypeSupport.IsSupported(VET_Half2))

And then only check for bUseHalfFloat. That way it could be disabled by setting PLATFORM_BUILTIN_VERTEX_HALF_FLOAT = 0 for a specific platform. The name for that define should probably be changed since it is only used with mesh instance rendering.

Thanks,
Jeff