Description

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
 
 

 

Steps to Reproduce
  1. Put ISMs containing scaled instances and non-zero transform in the level. (see screenshot.)
  2. Enable HLOD in worldsetting pane
  3. Generate Proxy meshes in HLOD outliner
  4. Set Forced LoD level 0 in the HLOD outliner pane to display the meshes place a  wrong location.

 

[Image Removed]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-79140 in the post.

0
Login to Vote

Fixed
Fix Commit8211754
Main Commit8211754
Release Commit9552237
CreatedAug 20, 2019
ResolvedAug 23, 2019
UpdatedMar 30, 2021