Hi there,
I’ve been playing around with PCG for my game and made a prety solid graph ecosystem for my environement. I’m using mostly assets from Quixel for rocks and plants. However, I made a custom blueprint for the trees, since I want the player to interact with them.
I used to have it’s structure like so :
Tree:
|root
||box collider
||static mesh
and I would then set the static mesh randomly from a collection of tree meshes I had on load. Like so :
As you can see, now it’s Instanced static mesh, instead of static mesh. That’s why I’m here.
So, I noticed that the game was unplayable, and ended up figuring out that my trees were the issue. In fact, they didn’t have any LOD and were quite poly heavy. So I downloaded a megascan tree library ( Megascans Trees: European Black Alder (early access)).
I could have replaced my old system with the meshes from the pack, but I have the feeling that it would still not be optimal.
As a blender user, I know that instancing meshes is a good way to save on performance. And I can see that in the pack there are some meshes in that format :
I have tried switching to “instanced static mesh” in my blueprint and set the mesh of the instanced static mesh with the same method but it seems that they do not appear in the game when loaded like so.
Do you have an idea on the best way to do it ?
The forest will be quite dense and big, It’s great that the trees have a lot of LODs and are built with nanite so this shouldn’t be an issue
You don’t get any boost from instancing unless all the tree instances are instances of the same mesh
With your system here, each instance is isolated in its own blueprint. You’ll need to have a system wide BP to hold the instanced meshes and make the instance.
You will still find it runs like a dog with a wooden leg, though. The MS trees are also very heavy. People spend a long time making the kinds of trees you can cover a hillside in.
( I think I gave you the wrong answer previously ).
An optimal way of doing that is to just spawn instanced static meshes with the PCG (and have collision turned off), but have a routine that swaps those instances into your blueprint at close proximity.
I’ll be submitting an update to my plugin rdInst in the next few hours which does this:
Thank you for your answer,
That’s an intersting solution. Right now I use spawn Actor to spawn my trees in the PCG graph, I could consider a rework of my actor to be spawned only when the player is nearby, with the mesh that was used in the terrain. I could even not have a mesh at all in the blueprint, only have a collision box and keep the mesh from the PCG. I just need to find a way to get the mesh data to delete the right mesh when the tree is cut.
Hi, thank you for your answer!
I, by chance, had the time to read your answer before you delete it, it wasn’t a bad Idea !
I noticed they were quite heavy, but at least they are better that what I had. They also look good (and are free…) I don’t know if I could reach the same level of looks with less heavy trees. Maybe I can try adding an imposteur LOD for the trees that are far. You shouldn’t be able to see really far in my game tho, the map is big but the terrain is quite flat.