Download

Having many trees while all are Actors

I need and use a lot of trees in my game, but every tree needs to be an actor. It can grow, create new seedlings, get cut etc.

Due to every tree being an actor they are all individual static meshes and not instanced and this of course is killing my fps absolutely.

I don’t think it’s possible to use instanced static meshes distributed over multiple actors, but is there any other approach to solve my problem?

Could you somehow create instances for multiple states of trees and swap them to non instance actors when they get interacted with?

I would think LOD levels of some sort would help with this. I believe you could use a very low poly LOD for medium distance and perhaps even a billboard far off.

I could do this, interesting idea. Thanks!

Of course I use LODs, but a lot of non-instanced static meshes will nevertheless kill the fps :wink:

I think I found a well working solution.

I’ve created a Shared Hierarchical Instanced Static Mesh Component (SHISMC). I can use this the same way as a regular Static Mesh Component, but internally all SHISMCs in all the actors are working together, so if I have 10 different actors with the same Mesh in the SHISMC then internally this is only one Hierarchical Instanced Static Mesh Component (HISMC).
I have one “InstanceContainer” Actor in the level which holds all the HISMCs (one for each mesh used by SHISMCs) and adds new ones if any actor uses a SHISMC with a mesh which was not used before.

Now I can have 500 tree actors and all have their own SHISMC, all can grow individually, all can create seedlings etc, but internally this is only one HISMC. I get a lot better fps with this and additionally I have nice smooth LOD transitions since HISMCs are optimized for foliage. :slight_smile: