In this lesson, you will learn how to leverage Hierarchical Instanced Static Meshes (HISM) to maintain high frame rates when rendering thousands of individual foliage assets across your world.
When populating vast environments, drawing thousands of unique StaticMeshActors is a performance killer; each object incurs a separate draw call, which quickly bottlenecks the CPU. The HISM component solves this by batching all instances of a specific mesh into a single draw call. Unlike standard InstancedStaticMesh components, HISM adds an integrated, tree-based occlusion culling system that allows the engine to cull entire groups of instances that are out of view or behind other objects.
Implementation Strategy
When working within a World Partition workflow, you should avoid placing individual foliage actors directly. Instead, utilize the Foliage Tool or the Procedural Foliage Volume. These systems automatically aggregate your vegetation into HISM components based on spatial proximity.
If you are building custom foliage spawner tools, ensure you are spawning instances into a HierarchicalInstancedStaticMeshComponent rather than creating new actor instances. Here is a high-level look at how the component structures your data:
// Logic for adding an instance to a pre-existing HISM component
FTransform InstanceTransform = GetRandomFoliageTransform();
int32 InstanceIndex = HISMComponent->AddInstance(InstanceTransform);
// HISM automatically calculates LOD transitions based on distance,
// significantly reducing the triangle count for distant forest clusters.
Why HISM Wins
The "Hierarchical" aspect is crucial for large-scale worlds. As the player moves through a dense forest, the engine builds a spatial tree of the foliage. If a group of trees is located entirely behind a large hill or far beyond the view distance, the engine discards that branch of the tree in a single operation. This approach drastically reduces the per-frame overhead on the Render Thread, keeping your performance stable even when the screen is packed with vegetation.
Always verify your instance count using the stat foliage command in the console to ensure your density settings are effectively batching within the HISM hierarchy.
Key Takeaway: By utilizing Hierarchical Instanced Static Meshes, you shift the rendering burden from thousands of individual draw calls to a single, culled hierarchical batch, ensuring your performance remains rock-solid in dense, large-scale environments.