My environment is as follows
UE5.3.2
Twinmotion2023.1.2
I am creating an UnrealEngine application that uses DatasmithRuntime to display udatasmith files exported by Twinmotion.
When loaded in DatasmithRuntime, the tree and human models placed in Twinmotion immediately display rough models due to the large LOD ScreenSize values.
The following screenshot is an example of a tree model loaded.
Due to the large ScreenSize value, this mushroom-like model is immediately displayed.
For this reason, I have written the following code in C++ to adjust the ScreenSize of the LOD of the StaticMesh, but it is not working.
void ULaplaceUtils::SetLOD(UStaticMesh* Mesh)
{
Mesh->bAutoComputeLODScreenSize = false;
int32 NumLODs = Mesh->GetNumLODs();
if (NumLODs >= 4)
{
Mesh->GetSourceModel(0).ScreenSize = 0.5;
Mesh->GetSourceModel(1).ScreenSize = 0.1;
Mesh->GetSourceModel(2).ScreenSize = 0.05;
Mesh->GetSourceModel(3).ScreenSize = 0.002;
}
}
When I check in EditorPlay, the ScreenSize is reflected in the loaded StaticMesh, but it is not reflected unless I change the ScreenSize on the Editor, even slightly.
For example, changing the ScreenSize of LOD0 from 0.5 to 0.51.
How can I reflect the ScreenSize change in the C++ code?
Or do you have any good ideas on other ways to avoid displaying the mushroom-like model above?