Using large amounts of BP Actors / Forest with interactable plants

What would be the best way to have a forest of trees or other plants that the player can interact with, using only Blueprints, no C++?

Since my post turned out a little bit long and complicated, here is the short version: How is it possible to have large amounts of blueprint actors in a level at once without loosing a lot of performance? Are there ways to optimes BP actors, like a distan culling to reduce draw calls or a way to replace them with static meshes when they are far away?

I´m trying to create a forest scene with berry bushes that the player can harvest, but while the vegetation tool gives me optimal performance for Static meshes, it´s not possible to add Blueprints (The usable berry bushes) to it. When I place a large amount of bushes manually or via a spawning volume the performence drops to a few frames per second.

Is there a way to use large amounts of Blueprints in a level? I thought about possible ways, and I´d like to know if someone has a better idea or knows how to properly set them up.

1: Idea: Using static meshes and painting them via the vegetation tool, then replacing them with BP actors once they enter a sphere around the player and turning them back into static meshes once they leave said sphere.

Problem: All static meshes painted with the vegetation tool are combined to one big mesh to reduce draw calls and it does not seem possible to get static meshes of a certain kind by using “Get overlapping actors” on a collision volume.

2: Idea: Using only static meshes and paint them with the vegetation tool, then trace for them in a certain radius around the player and when right in front of the player, using a “player mounted” BP to let him collect berrys instead o9f actually interacting with the berry bush itself.

Problem: Again, all meshes are in one peace and its not possible to look for a static mesh that is not part of a Blueprint.

Now, does anyone have an idea how to solve this problem? Or is there a completely different way to make the berry bushes interactable without loosing so much performence?

The only solution for this I know about is the “Hierarchical Instanced Static Mesh Component”, or short HISMC.

You would add all of your bushes as instances to one HISMC, and as far as I know a vegetation tool internally also only uses one (or multiple) HISMC.
In the HISMC you still have full control over each individual instance, so for example a trace would hit the HISMC and tell you it hit the instance with the index 20, and then you could do something with this instance 20, either set a new transform or remove it.

HISMCs are extremely good regarding performance, and they still support LODs. They are designed to be used with foliage like bushes.

Only problem with HISMCs is that if you want to update or add instances dynamically they are unfortunately a big buggy at the moment, sometimes all the instances flicker or show wrong LODs, but that hopefully get’s fixed soon.

I would immediately suggest Streaming levels, this is the only trouble free way around such things.
This is pretty self explanatory.Lots of them.LOTS.
And lets be reasonable, either the interactive bushes are going to be sparse and separated or use some filler foliage to fill in the spaces to flesh things out.
Not every mesh is going to be interactive.

Thanks for your help, I created a Blueprint actor and added a HISMC to it, then I added 1 element to it and selected the Mesh I wanted to use. I tried googleing it, but there seems to be no ducumentation about how to actually use it now.
Questions:

1: Do I have to create a new HISMC if I want to use a second mesh?

2: What is the point of adding more elements to it?

3: How do I place the Meshes in my level correctly? Do i just place the BP
actor or do I have to do something special to make sure it renders all the trees as instances?

4: how do I create an array of all instances in the BP actor to refer to individual instances?

I think I´m missing somethin criticly here…

  1. Yes, for a second mesh you need to use a second HISMC
  2. One HISMC with 1000 elements has extremely good performance compared to 1000 static mesh components.
  3. You need to find a nice way to do this, because all of your trees need to be in one single actor (with one HISMC, one per type of tree/bush). Manually placing the instances is not really easy, you could for example create an array of vectors and expose their widget to the editor so you can drag it around and spawn and add an instance in the construction script at each vector location.
  4. The HISMC already has an “array” inside, you can refer to individual instances with the index. If you make a trace you get the index output, this is which index go hit in the HISMC.

I made a tracer and a button that starts the “Harvest” action. When the button is pressed, the BP checks if the object that the player aims at is part of the HISMC by casting. If the cast is succesfull, the Item ID of the tracer hit is send to the HISMC blueprint and the there it is used to change the material of the HISMC element to a harvested material (different diffuse texture).

The element ID of the Break hit node seems to be the ID of the targeted part of the HISMC (all correct so far), but the element of the “change material” node is refering to the material element, not the HISMC element.

How can I acces the HISMC Array?? I got the Id from the tracer, but no idea where i can get the Array of all HISMC meshes that I need to filter for the INT ID I got from the tracer.

Yeah, you can’t just change the material of a HISMC. For getting the good performance, every instance in the HISMC has the exact same material, so one HISMC with 10.000 instances will still produce less than 5 draw cells (as far as I know, depends on amount of LODs).

So if you want to change the material, you actually have to use 2 HISMCs, one for bushes which are not harvested and one for bushes which are harvested. Then if you harvest a bush, remove the instance from the “non-harvested” HISMC and add a new instance with the same transform to the “harvested” HISMC, you can get the transform with “Get Instance Transform” Node, before you removed it.

This is how I would do it. Since there is no documentation about HISMCs I actually have no idea why the “Set Material” node has an index input. I guess it’s supposed to be useless there.