Is there any optimization sense in Instanced Static Mesh with nanite?

Hello. I’m using nanite in my project and I’m using Instanced Static Mesh. Does it have any sense for optimization? I’ve tried to look into statistic and don’t see any defference between 12 meshes or 1 mesh + 11 instanced meshes.

12 meshes:

1 mesh + 11 instanced meshes:

looks like you dont use ISM correct way. ISm is beneficial if you have same mesh in level multiple times, then create bp with ISM component, assign SM to it and then add instances in Instances section otherwise you have not getting any benefit.

1 Like

Here’s my bp:

Is there any problem with it?

do you see all your instances now above each other? or just 1? i think you are not setting new Z after each instance

Yes, I see it. Here’s the example of this BP: at right bottom you can see variable “count=15” so I have 16 meshes

It seems that all instances are not on top of each other in this case as @KryogenicGames mentioned, given that you’re updating the value of the location Vector in each loop and adding a constant (Although for a moment I suspected them to be on top of each other)

In any case, to quote Chris Murphy here, “nanite is very very very very very good at instancing static meshes”, but I’m not sure if it’s being used properly in this case.

ok and if you scroll down you should see all your 15 Instances

Yes, here it is:

1 Like

perfect, try to now see draw call difference between your 2 examples with ISM you should have 1 for that 1 mesh but 15 instances

How can I do it only for my mesh? I know about stat scenerendering, but it showing stats for all scene I suppose.

sadly there is not per actor draw calls, i would try to have exactly same levels and see difference, but this instancing should also affect your other stats like fps, try perhaps scene with higher count. also how many triangles your mesh has? if is not high count is no point having nanite enabled

Well, I suppose it’s 332. Or 1424, I’m not sure:

1788 yes thats very low count, i wouldnt use nanite. you just creating unnecessary overdraw.

I understand it, but what if I’ll use something more detailed? Will nanite work with instanced meshes at all? Does it have sense?

yes, ism works fine when you use same mesh and material so best to use for same meshes, scale doesnt affect perf but different material will add draw call. i think if you want to see perf difference add high count nanite mesh maybe 1mil triangles add maybe 10 of them to level, save stats and then do the same but as one bp with ism component and 10 instances, you should see difference

1 Like