4.22+ Auto Instancing Question

A map filled with hundreds of the same Static Mesh Actor gets batched to a few draw calls.

An identical map, using a BP actor with a StaticMeshComponent with the same StaticMesh does not get batched at all.

Why would using a StaticMeshComponent not get auto instanced? Does it only work on StaticMeshActors?

It shouldn’t be batching static meshes by default, from what I understand that can only be done using Instanced Static Meshes in Blueprints. The only thing it does by default is store one object in memory

With the Refactoring of the Rendering Pipeline automatic batching on GPU was introduced. But I don’t know about the exact conditions in which it will kick in, so I am also interested in this.

This is not true. It will automatically batch everything that use same render resources.(Mesh, material, lightmap.) Blueprints sometimes don’t get this autoinstancing and that is a bug. Not sure is it reported yet.
You can test this by yourself using these console commands.


 [TABLE]

r.MeshDrawCommands.DynamicInstancing
 			Whether to dynamically combine multiple compatible visible Mesh Draw Commands into one instanced draw on vertex factories that support it.
 		

 


 [TABLE]

r.MeshDrawCommands.LogDynamicInstancingStats
 			Whether to log dynamic instancing stats on the next frame
 		




Question, in 4.24,

  1. If duplicate blueprints are actually in the level and not dynamic, not instantiated nor movable…Will “Auto Mesh Instancing” see the duplicate blueprints and instance them?
  2. Does Auto Mesh Instancing work with blueprints within blueprints? Do I have to mark the Blueprint as a Static object in the blueprint?

From what I understand dynamic mobility will still be auto instanced if auto instancing would have normally taken place. In other words, I don’t believe that mobility plays any role in auto instancing. I’m simply basing this on the fact that hardware instancing via the platform graphics API isn’t limited by transforms being changed during run-time. However, UE may not implement the necessary code to make this possible…pure speculation btw

trying to get instancing of static mesh components running. any ideas, if i’m making something wrong?