When having many instances in InstancedStaticMesh and selecting the component, editor freezes. Memory usage peaks incredibly with more instances. I have 8GB RAM and setting the value to around 15k instances freezes my PC completely for like 5 minutes, if not more.
Repro project: [REPRO PROJECT][1]
How to reproduce:
119560-
Basically select the ‘Freezer’ actor and then its ‘InstancedStaticMesh’ component, just like in the attached picture. In my case it freezes the editor for around a minute/two and memory usage peaks very high.
Thanks!
I opened up your project and gave it a test. The freeze you are experiencing is a GPU limitation. When I set the instance count to 15,000, I still get a decent FPS and nothing freezes. What you are trying to do is very GPU intensive as each one of those instances uses a dynamic shadow and dynamic occlusion queries.
What this means is that for each instance, it is attempting to occlude others behind it, in order to cull based off of the view angle and frustum. In order for it to know how to do this, it has to run a query to check and see if the culling is valid for any given instance. Therefore, the more instances you have, the more queries and dynamic shadows you have, and the more expensive it becomes to render on the GPU.
In order to prove this, you can use the console commands ‘stat initviews’ and ‘stat unit’. Below is an example of what it looks like when I crank up the instance count to 150,000 and observe the differences between that stats displayed on screen.
I also experiencing the freeze when clicking on the Component, but that is because it is attempting to populate the instance array after entering the value. It is going to take longer for the array to populate the larger the number.