Set number of instances to draw with instanced static mesh?

Is there a way to draw only a subset of the instances of an instanced static mesh? Like, if the total Num() of transforms is 1000, could you tell it to only draw the first 500?

I’d like to have a very large number of instances, and be able to slowly increase the number drawn.

So, is this not possible? Is the only way to change the number of instances drawn in an UInstancedStaticMeshComponent to add / remove them?

Simplest idea:

  • store the desired tranforms somewhere
  • at the beginning set transforms for all instances to place that is outside the camera
  • set a timer that will systematically update the position of subsequent instances to “real”

Not tested.

So, that does work to make them appear. I guess I’m trying to optimize performance, though.

With no changes to the transforms, you can easily get 1 million instances with no performance hit. But, if you change only one of those instances, you have to mark the render state as dirty, and all 1 million transforms are re-evaluated. This tanks the performance.

I’ve been digging around to see if there was a way to mitigate this, but I’m coming up empty. I was hoping that there was a way to set them once, and then ‘reveal’ them without having to mark the render state as dirty.