Change Staic mesh actors for HISM

Hi

I have create this BP that I would like to share and also ask for help to improve it.
([link to the forum][1] )

This is inspired on [Rama’s Instanced Static Mesh Editor Feature.][2]

This BP take a lot of mesh actors from the level (all should be the same, and have the same Tag) and replace all of them for one unique Hierarchical Instanced Static Mesh (HISM) or just a ISM

In the sample we have 6000 cones, that before use the BP have 40FPS and with the BP can be play at 120 fps since we change that 6000 drawing call to only 1.

https://forums.unrealengine.com/filedata/fetch?photoid=1452711

https://forums.unrealengine.com/filedata/fetch?photoid=1452712

right now this only work at begin of play, so it’s really good to edit since each copy is independent and can be edited until we compile the game, in very non destructive way

https://forums.unrealengine.com/filedata/fetch?photoid=1452713


So since this is working I shared here. [link to the BP][6]


The problem is if you need o bake the light maps, since the replacement of geometry is done at run time, it can’t be calculated at the swarm agent. Of course this is not a problem with dynamic lighting.

I have two ideas to solved, I hope someone can help me on with that.

Ideas:

1.- assign in some way the lightmap from the original object to the instanced mesh.
Pros: Is non destructive process like before but keep the lightmaps.
Cons:the optimization is only at runtime.

2.- build a BP that takes all the transformations and store in a unique DataTable or similar and, create a second BP that reads that data table to spawn the geometry on the construction instead of the begin play.
Pros: the optimization will also affect to the editor screen during the development.
Cons: This will be kind of destructive since once done we will lose the original actors that can be easily edited

Of course the idea is do it by BP as Rama show by C++ it’s posible.

Thanks

I’ve been looking for something that can do exactly this, i need to instance out single objects that are made up of thousands of smaller objects and its killing the fps.

I’m gonna check it out now, thanks for the upload!

Hi, in fact, was really easy, at the BP you have before you just need to activate at that function the call in the editor. if you do it, you can run that function in the editor