Hey team,
I am trying to figure out how foliage clusters are handled by the engine when the foliage instances are added at runtime via the “Add instance” node and are not owned by the foliage actor. From memory, before I converted my project to Ue5 foliage, foliage instances were added with the “Add Foliage Instance” Node, but now in Ue5 there is only the “Add Instance” node, with the target “instanced static mesh component”.
So the first question I guess is, when a “foliage instance” is added to the world at runtime via a Blueprint is it handled by the engine as a foliage instance as it logically should be? or is it treated as a standard “instanced static mesh” as the target of the node would suggest?
Second question would be how are the clusters determined? Is each instance automatically added to a cluster by proximity in world space to a cluster node or something? or are all instances of each foliage instance static mesh component just lumped into one big cluster?
For context my project works as follows.
I have a blueprint that is added to the level that manages all of my trees. I need to swap out foliage instances for actors when the player is close enough to interact with them (i.e. chop down), and then swap back to a foliage instance when they move away again. To enable this, at begin play my tree manager BP swaps out all of the foliage actors placed in my level via the foliage tool with foliage instances via the add instance node. Because these foliage instances are added by my tree manager BP I am concerned that they are no longer clustered in an efficient localized manner as they aren’t owned by the foliage actor anymore and instead belong to the tree manager BP.
The foliage actors are swapped out by a “get all actors by class” node, where I loop through all the foliage actors on the map and add a foliage instance in its place before destroying the original foliage actor. Because the “Get all actors by class” node loops through all the foliage actors in numerical order I am concerned any foliage instance clusters made would have ridiculous bounds depending on the order they were painted to the landscape and not on their proximity to one another.
I cant figure out how to check the cluster bounds at runtime so any info on this would be greatly appreciated.
Cheers