MeshVertex has been converted by component transform before being converted by instance transform.
It is ( Vertex * ComponentTransform ) * InstanceTransform.
I thought it has to be converted by (Vertex * InstanceTransform * ComponentTransform).
I found one quick solution.
// code placeholder void FMeshMergeHelpers::ExpandInstances(const UInstancedStaticMeshComponent* InInstancedStaticMeshComponent, FMeshDescription& InOutRawMesh, TArray<FSectionInfo>& InOutSections) { FMeshDescription CombinedRawMesh; bool bFirstMesh = true; for(const FInstancedStaticMeshInstanceData& InstanceData : InInstancedStaticMeshComponent->PerInstanceSMData) { FMeshDescription InstanceRawMesh = InOutRawMesh; #if 0 FMeshMergeHelpers::TransformRawMeshVertexData(FTransform(InstanceData.Transform), InstanceRawMesh); #else const FTransform ComponentTransform = InInstancedStaticMeshComponent->GetComponentTransform(); const FTransform InstanceTransform = ComponentTransform.Inverse() * FTransform(InstanceData.Transform) * ComponentTransform; FMeshMergeHelpers::TransformRawMeshVertexData(InstanceTransform, InstanceRawMesh); #endif
[Image Removed]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-79140 in the post.
0 |
Component | UE - World Creation - Worldbuilding Tools - HLOD |
---|---|
Affects Versions | 4.23 |
Target Fix | 4.24 |
Created | Aug 20, 2019 |
---|---|
Resolved | Aug 23, 2019 |
Updated | Mar 30, 2021 |