What is a Instanced Static Mesh in Unreal Engine?
In Unreal Engine, an Instanced Static Mesh is a feature that allows many copies of the same static mesh to be created with a single draw call, significantly boosting the game performance.
To make it simpler to understand, imagine that you have an asset that you want to duplicate hundreds of times to build something more complex, like a wall. In this situation, you would copy and paste the same actor multiple times into the scene. However, if you use an Instanced Static Mesh, you will only have one actor in the scene.
Instead of rendering each mesh separately, the engine produces mesh instances, which share the same geometry and material properties.
This method decreases the amount of draw calls, which can be a performance bottleneck in huge scenes with a lot of objects.
Instanced Static Meshes are widely used for repeating foliage, trees, rocks, and other environmental assets across a level. Depending on the game, they can also be utilized for other kinds of things, such as buildings or other Static Meshes that will be used multiple times throughout the level.
With this approach, Unreal Engine only needs to calculate the location, rotation, scale, collision, and lightning of a static mesh once rather than once for each static mesh. That is one of the reasons it performs better than standard static meshes.
How to make a Instanced Static Mesh in Unreal Engine?
- To add an Instanced Static Mesh to a Blueprint Actor, click the “+Add” button and then choose the Instanced Static Mesh component.
- Choose the Static Mesh you want to use multiple times in the Details panel.
- Finally, in the same panel, search for “Instances” and hit the “+” button to add an instance of the selected mesh.
- Feel free to add as many instances as you like. They may each be moved independently using the transform tool’s arrows.
Batch Actors in Unreal Engine
Another great way to create Instanced Static Meshes, is to click on “Actor” and select “Merge Actors → Batch“.
This will create a Blueprint actor with all the static meshes as instances, as shown in the image below.
The static meshes will be hidden, but you can delete them after the merge if you want.
Tip: Click the Blueprint icon, which is located next to the “+Add” button, to export the blueprint so you can use it in other levels.
Create an Instanced Static Mesh using Blueprints
If you wish to add instances using blueprints, simply search for the “Add Instance” node.
The specified instanced static mesh will then spawn at the coordinates 0,0,0 on the map.
If you want to change the location, just right-click on “Instance Transform” and select “Split Struct Pin“.
What is a Hierarchical Instanced Static Mesh?
Similar to a regular Instanced Static Mesh, a Hierarchical Instanced Static Mesh (HISM) allows multiple instances of a mesh to be rendered with a single draw call.
However, in addition to this, HISMs provide the ability to hierarchically group instances and apply transformations to them.
This means that a group of instanced meshes can be managed and modified as a single entity, which can be very helpful for building complicated objects or settings with recurring patterns or modular elements.
For instance, a HISM may be used to build a forest with thousands of trees, each of which is an instance of the same tree mesh. By grouping these instances hierarchically, it becomes possible to apply global transformations to the entire forest, such as moving, rotating, or scaling it as a whole. Or even delete individual instances.
Moreover, Hierarchical Instanced Static Meshes may be used with LOD (Level of Detail) systems to improve rendering speed by swapping out complex models for simpler ones as the camera moves away.
Which one should I use?
Generally speaking, try to use simple instanced static meshes whenever you can. The hierarchical instanced static mesh should be used if different LODs are needed for the instanced items.
In any case, the HISM will produce extra load by having to calculate which LOD to display. So try not to use it for every actor, and preferably utilize it on bigger maps that will need LOD.