HLOD Builders (MeshApproximate, MeshMerge, MeshSimplify) Fail on Multi-Level HLODs

In HLODBuilder.cpp, the base class UHLODBuilder::Build(const FHLODBuildContext&) at line 324 separates components based on their HLODBatchingPolicy:

if (!ShouldIgnoreBatchingPolicy())
 {
   for (UActorComponent* SourceComponent : InHLODBuildContext.SourceComponents)
   {
     if (ShouldBatchComponent(SourceComponent))
     {
       ComponentsToBatch.Add(SourceComponent);
     }
     else
     {
       InputComponents.Add(SourceComponent);
     }
   }
 }

Components in ComponentsToBatch are processed by BatchInstances() at line 406, bypassing the derived builder entirely:

if (!ComponentsToBatch.IsEmpty())
 {
   BuildResult.HLODComponents.Append(BatchInstances(ComponentsToBatch));
 }

The problem is that UHLODInstancedStaticMeshComponent (created by first-level HLODs) sets HLODBatchingPolicy = EHLODBatchingPolicy::Instancing in its constructor (HLODInstancedStaticMeshComponent.cpp:45).

When the second-level HLOD builds using MeshApproximate:

1. Source components are UHLODInstancedStaticMeshComponent from level 0

2. These have HLODBatchingPolicy::Instancing

3. ShouldIgnoreBatchingPolicy() returns false (default)

4. All components go to ComponentsToBatch

5. BatchInstances() processes them, producing instances

6. UHLODBuilderMeshApproximate::Build() is never called

UHLODBuilderInstancing already overrides ShouldIgnoreBatchingPolicy() to return true (HLODBuilderInstancing.h:69), but MeshApproximate, MeshMerge, and MeshSimplify do not.

[Attachment Removed]

Steps to Reproduce
1. Create a World Partition level

2. Configure two HLOD layers:

- HLOD_Default_0: LayerType = Instancing, ParentLayer = HLOD_Default_1

- HLOD_Default_1: LayerType = MeshApproximate, ParentLayer = None

3. Generate HLODs

4. Result: Both HLOD layers contain instanced meshes

5. Expected: HLOD_Default_1 should contain approximated meshes

[Attachment Removed]

Hi Mickael!

We already ran into this issue internally, and a fix has been submitted. It will be included in the 5.7.2 hotfix release.

The fix is actually pretty simple, just get rid of the line you mentionned (HLODInstancedStaticMeshComponent.cpp:45)

HLODBatchingPolicy = EHLODBatchingPolicy::Instancing;

This should resolve your issue.

Sorry for the trouble!

Regards,

Sebastien

[Attachment Removed]