Instanced Static Mesh inside BP Actor - optimizing

Hi. I currently create an Unreal project in 4.27 for weather channel. It has a main BP_Map actor. It has contains of map, cities, weather icons, temperatures etc. Map settings are being controlled by ‘Set Visibility’ for a specific weather icon and map can be scaled up and down. I’ve decided to put 11 icons for each city and turn off visibility. I choose which icon should be visible using a variable and array at begin play. I have added to BP_Map a set of icons (each is a separate icon actor blueprint. BP_Sunny, BP_Cloudy etc.) and duplicated them for each city, that way dependencies are created and I can edit each icon and change is represended by all city names.

In general the project runs smoothly. My problem is the map animation of scaling up and down. I am facing a significant FPS drops when BP_Map scales up or down. I guess that is the result of many static meshes (some icons are rotating) that need to be rendered in the same moment.

I thought that Instanced Static Meshes may be a good way to go here and I wonder if I can open each BP actor with static mesh icon and replace it with instanced static mesh? This way I would maintain icons alignment and blueprint structure because ISM would be positioned perfectly in old SM places. Is it possible to do in any way? This should save some performence and solve huge FPS drop.

As far as I have read ISM only work within its actor BP but maybe there is any way to use them in my case without whole blueprint rebuilding.

Thanks!

PS. I turned off all physics, collisions and casting shadows on icons to make it less demanding during loading up (scaling) and now I wonder if duplicating a BP actor with instanced static mesh (with single object) will reduce fps drops

Hi nazzzir,

Yes, using instances will speed your level up, even when the meshes don’t have collision.

It’s easy to convert your static mesh components into instances - I have an instance manager on the marketplace with a tutorial linked below - the same concept of converting the components in instances would work with any type of instance routines though so you don’t need my plugin:

I also have another tool on the marketplace called rdBPtools which can help build those blueprints (and optimize them).

Thank you for ur reply. I know that ISM will help in general but I am not sure if the way of using it I want to use it works tho. Do not want to waste time doing something that will not work in my case. Thanks for plugins will look into it. BTW here is the answer from AI:

"Yes, if you create a blueprint actor with an instanced static mesh and then duplicate that actor, the duplicated actor will also benefit from the instanced static mesh. This is because the instanced static mesh is a component of the blueprint actor and will be duplicated along with the rest of the actor’s components.

When you duplicate the blueprint actor, you will create a new instance of the same blueprint with the same components, including the instanced static mesh component. Each instance of the blueprint actor can then use the same instanced static mesh, which can help to reduce the number of draw calls and improve performance."

Can you confirm that?

No that doesn’t sound right - if you’ve implemented an ISM component in a blueprint, duplicating that blueprint will also duplicate the ISM component and not share - you will end up with a set of draw-calls for each ISM component.

What you do is create one global ISM component (per mesh) and reference that in each BP.

Ok, now I see. So I will create ISM component in BP_Map my main BP and then will add separate ISM component per weather icon, then move it away somewhere. Then I can open my created BPs for weather icons (Sunny, Cloudy) and in there on Event Begin Play what node should I use? ‘AttachComponentToComponent’? Or what is the best way of doing a reference? Cast to BP Map, and as that ‘Add instance’?

You won’t want to attach it. Your BP_Map sounds like a good place - you need a ISMC for each static mesh - usually contained in something like a Map of Static Meshes to ISMCs so you can quickly find the correct one.
You’ll need to find that BP_Map from each of your other BPs and then you can store a reference to it in a variable. Don’t try finding actors in your level from construction scripts though - there is no guarantee of what actors are already constructed.

I am sorry but totally cannot manage to do it. I’ll try to search the web, I need to reference it and add instanced static mesh to it somehow.

Maybe it could be done the other way around:

Your BP_Map could find all of your weather BP’s in the level (or you could set a tag on them and find all actors with tag), and call a function that you create in those BPs, passing in a reference of itself for those BPs to get the ISMC from…

I am afraid that it cannot be done. I set an Instanced Static Mesh Component in my main BP_Map, and in blueprint actor for sun icon I tried to cast this ISM and add it to comeponent list using Add Instanced Static Mesh Component node however it has no input to connect the reference. The main clue of this is to feed icon blueprints with ISM set up in my BP_Map blueprint. After 4 hours of trying different nodes and ways to connect it and lack of documentation about these nodes it is time to give up on this idea.

It can be a bit daunting to set it up - that’s why I created my rdInst plugin - it wraps up all of that into fast c++ code, just exposing useful nodes. If you’re using rdInst - you don’t need to worry about any of that side, it manages the instances - you just subclass your Blueprints from my rdActor class - then you can just:

rdInst seems to be nice and affordable but will it solve my problem?
Currently I would like to add Instanced Static Mesh component from one BP to the other to populate the same ISM system/component along already existing and placed BPs in level.

The idea is to make these BPs use the same ISM, otherwise this ISM optimizing method will not work as you said and I was thinking.

Could you give me some hints after purchase on how to set it up to success?

1 Like

Yes, it only creates one Instanced Static Mesh Component per mesh - no matter where you are creating it from, all your blueprints will automatically share the same ISMCs (rdInst uses HISMCs).

Yes, you’re welcome to email me at any time at rd@recourse.nz, and/or there’s a rdTools forum here that you can ask any questions on - and of course a lot of tutorials and documentation on my site at www.recourse.nz.

Ok, thank you.
I sent you an email.

1 Like