Are instanced static mesh components combined into a single instanced static mesh if they use the same mesh asset?

I’m currently wondering how Instanced Static Mesh Components work, or more precisely what happens in the following two situations:

First, let’s assume one creates an actor blueprint that has an instanced static mesh component, and then places two identical instances those actors in the level. Will this cause two distinct instanced static meshes to be created, or will both actor’s instanced static mesh components be combined into a single instanced static mesh for rendering purposes?

The second situation would be that one actor has two identical instanced static mesh components. Will those be one instanced static mesh for rendering, or will they be rendered as individual instanced static meshes each?

Thanks in advance!

The instanced static mesh component acts as a container for the intances that you add. The static mesh and material it uses is set on that component. You add instances with AddInstance, not Spawn.

So if you do spawn or place two of those actors, each will have it’s container and they won’t be pooled together.

If you want it to be one static mesh container, what you can do is create an actor that has the instanced static mesh component that acts as a global container, and pass a reference to that to your other actors, who then add instances to this global container.

ISMs don’t get combined behind the scenes or anything. If you want to batch render stuff at a higher level than a single actor, then you would need to build and populate the instances of an ISM yourself somehow.

The foliage tool does this. When you paint foliage into the map with the foliage tool, all those instances get added to a hidden InstancedFoliageActor, which has an ISM(specifically a hierarchical ISM) per foliage type that is painted. This keeps foliage batched at a very high level and is why foliage rendering can be as performant as it is.

The ISM component is a child class of static mesh component. The main difference is that it also has an array of transforms, such that it can render many instances of that single mesh, saving a ton of draw calls.

It’s much more difficult for us developers to take full advantage of the ISM component directly, because we work at the actor level, where there isn’t often enough to merge to get the most out of it.

In theory it should be possible to set up an actor such that when it is spawned, it disables its own static mesh component and registers itself with a single scene super actor which acts in a similar way as the foliage actor to get more batching, though you would also need to manage those actors calling UpdateInstanceTransform on the ISM of that actor if they were able to move.

On the other hand, there is various functionality that does allow you to take advantage of ISMs indirectly.

The merge actor tool has the option to combine reference to render the same meshes into ISM renderers.
The UE5 world partition tool uses ISM heavily when building HLOD
The UE5 packed level instances uses ISMs