In order to work around this, I have kept the screen size as 0. This seems reasonable given the math in the other branch, but I could well be missing something.
Steps to Reproduce
I am loading a mesh created in ue 4.10. This model has four LODS, with different descending screen sizes. LOD 3 has a screen size of 0, which in 4.10 ( and later? ) means that it is never drawn. When loading this mesh into 5.6, I see that the UStaticMesh::ConvertLegacyLODScreenArea() converts a size of 0 to 1, which causes this LOD to be drawn. To repro, one would take a mesh created by an earlier version of UE and set the screen size of the last lod to 0 and the note that this lod is incorrectly selected in the mesh editor.
if (SrcModel.ScreenSize.Default == 0.0f)
{
SrcModel.ScreenSize.Default = 1.0f;
GetRenderData()->ScreenSize[ModelIndex] = SrcModel.ScreenSize.Default;
}
else
{
// legacy transition screen size was previously a screen AREA fraction using resolution-scaled values, so we need to convert to distance first to correctly calculate the threshold
const float ScreenArea = SrcModel.ScreenSize.Default * (ScreenWidth * ScreenHeight);
const float ScreenRadius = FMath::Sqrt(ScreenArea / UE_PI);
const float ScreenDistance = FMath::Max(ScreenWidth / 2.0f * ProjMatrix.M[0][0], ScreenHeight / 2.0f * ProjMatrix.M[1][1]) * Bounds.SphereRadius / ScreenRadius;
// Now convert using the query function
SrcModel.ScreenSize.Default = ComputeBoundsScreenSize(FVector::ZeroVector, Bounds.SphereRadius, FVector(0.0f, 0.0f, ScreenDistance), ProjMatrix);
GetRenderData()->ScreenSize[ModelIndex] = SrcModel.ScreenSize.Default;
}
Hi there,
This looks like it is probably a mistake from copying some of the conversion logic from ConvertLegacyLODDistance, where a LODDistance of 0 makes sense to be converted to a screen size of 1. I will make a bug report for this, but it seems like it should be fine to just change the line:
SrcModel.ScreenSize.Default = 1.0f;
to
SrcModel.ScreenSize.Default = 0.0f;
inside the if statement.
Regards,
Lance Chaney
Thanks!
Bug tracker links should be these two:
https://issues.unrealengine.com/issue/UE-323801
https://issues.unrealengine.com/issue/UE-323803
These should eventually go live once the bug reports have been processed.
Regards,
Lance Chaney