Best approach for rendering a procedurally generated forest with thousands of trees in Godot 4.7?

Godot Version

4.7.1.stable

Question

Hi everyone,

I’m building a forest scene in Godot 4.7 that needs to contain a very large number of trees. The forest is fully procedural and generated at runtime, so tree placement isn’t known at design time and nothing can be baked in the editor everything has to be spawned/built dynamically while the game is running. I’m trying to figure out the most performance-friendly architecture before committing to one. I have two ideas and I’d love some feedback:

Option 1 — Instanced tree scenes + visibility ranges
Create a scene for each tree type and instantiate those scenes at runtime as the generator produces tree positions. My understanding is that Godot batches identical meshes with the same material automatically, so draw calls should stay reasonable. Then I’d use the visibility_range_* properties on each tree to switch to impostors at a distance.

Option 2 — Chunked MultiMeshInstance3D system
Divide the generated forest into chunks and build a MultiMeshInstance3D per chunk at runtime, filling the instance transforms from the procedural data. When the camera gets close to a chunk, I’d spawn the actual tree scenes (for collision/interaction), and when it moves away the chunk gets culled and falls back to the MultiMesh representation.

My main concerns are CPU overhead from having thousands of nodes in the scene tree (Option 1) versus the lack of per-instance culling and per-instance LOD in MultiMesh (Option 2) — plus, since everything is generated at runtime, the cost of building/updating MultiMesh buffers on the fly without causing stutters.

Which approach would you recommend, or is there a better hybrid? Any real-world experience with large procedural forests in Godot 4.x would be really appreciated. Thanks!

I don’t think I can be any help but there are talks about trees and lods in recent godot con if you not aware of it:

There’s also this talk about vegetation in previous godot fest:

Kind of a simple, low intensive approach is billboard trees that turn into real trees at a certain distance. Might not work for you.

The problem with tree rendering is the mesh complexity, the antialiasing of thin polygons, and the transparency, theres a couple of approaches that i have found worked well,

  1. Depth pre-pass alpha: this is a transparency setting for the branches/leaves that you can find in the standard material settings. This version helps with the early fragment rejection so functions a bit like occlusion for the fragment program.
  2. Alpha -scissor : this is another transparency setting that treats opaque pixels as fully opaque and the rest fully transparent (pixel rejection) and so with this setting the objects are rendered in the opaque pass with normal geometry. Generally the most performant way to render the transparent stuff.
  3. Instancing: this is usually the best method, but the multimesh will draw all instances at the same LOD even if they are distant. So the best way seems to be to build a multi mesh buffer for each visibility range.
  4. Manual LOD: make a tree scene with several LOD meshes in the same scene, set the visibility ranges then place them statically in the main scene and simply use Godots internal renderer to handle the instance buffers.

There are addons like Spacial Gardener and Proton Scatter that do a lot of the hard work for you.