Questions about calculations for fallback target errors in Nanite build

Hello.

I’ve been exploring the use of Nanite for optimizing mesh detail in my project and came across a specific calculation that I’m trying to understand better. The calculation involves FallbackTargetError within the Nanite settings and how it’s determined based on mesh surface area and vertex bounds. Here’s the snippet from the code:

float FallbackTargetError = Settings.FallbackRelativeError * 0.01f * FMath::Sqrt(FMath::Min(2.0f * SurfaceArea, VertexBounds.GetSurfaceArea()));
  • SurfaceArea represents the total area of all triangles in a cluster.
  • VertexBounds.GetSurfaceArea() is calculated as 0.5 * (Size.X * Size.Y + Size.X * Size.Z + Size.Y * Size.Z).

My question is about the use of 2.0f * SurfaceArea in the calculation. Intuitively, I would expect the multiplication by 2 to be applied in the calculation of the bounds’ surface area, not the total surface area of the cluster triangles. Can anyone explain why the formula is structured this way, especially why the 2.0f multiplier is applied to the SurfaceArea instead of being part of the VertexBounds.GetSurfaceArea() calculation?

I’m trying to understand the logic behind these specific choices in the formula and how they affect the determination of FallbackTargetError for optimizing mesh detail in Nanite.

Thanks in advance for any insights!