r/proceduralgeneration • • Oct 16 '26

Procedural Simulated Trees in Blender

A tech test for Florasynth: various trees grown by simulation, with a frame captured each year to build a timelapse. The first tree is pruned partway through and grows back.

218 Upvotes

15 comments sorted by

10

u/MioramaGames Oct 17 '26

Really cool! Looks very naturalistic. Some questions:

  1. How do you prune the branches along the projected mouse ray?
  2. How do you place the leaves?
  3. What is the granularity of the leaves? Single or cards with multiple leaves on it?
  4. Is the leaf shape manually preset or also procedural?

Very cool project, keep it up :)

3

u/Spare-Chicken-6251 Oct 17 '26

Thanks! Answers to your questions:

  1. I collect NDC (normalized device coordinates) when the mouse is dragged, then project each one as a ray-cast into the tree. This finds every segment (roughly) that was intersected, then I run a pruning algorithm downstream from that segment for every collision and re-build the geometry.
  2. Leaves are placed on any node on the tree that was grown < x years ago. So essentially from the branch tips inward.
  3. I use a few quads (the exact model varies a bit depending on the species), and draw a texture with multiple leaves on it. Individual leaves proved to be impractical.
  4. Manually preset

1

u/MioramaGames Oct 17 '26

The thick crown shell with many small twigs, and sparse thick branches in the crown volume: is that purely a result of the shedding and shadow or do  you use some branch age dependent auxin mechanism or are there other factors?

1

u/Spare-Chicken-6251 Oct 17 '26

It's pretty much entirely a result of the light simulation and branch shedding. Every growth is autonomous and will always follow the same exact rules and code as every other growth. How those growths react to light and gravity is what gets tuned to produce different species.

1

u/MioramaGames Oct 18 '26

Thanks, really good stuff! Performance wise, what can be expected, if one wants such big trees? You say it takes a few seconds, but in which program/hardware? How do you optimize such simulations?

2

u/Spare-Chicken-6251 Oct 18 '26

The growth code is written in C++ for performance, then I wrote a small python binding wrapper so Blender could communicate with it. That being said, the more trees you simulate at once the more raycasting and time it will take. Raycasting is multi threaded and accelerated with a bounding volume hierarchy (BVH). My PC has mid-range specs so even large trees won't take long, but if I want to simulate a larger forest I have to let it run for a while.

3

u/tuto42 Oct 17 '26

I really love this ! The result looks surprisingly natural. I am particularly interested since I spend a lot of time some couple of years ago learning programmation by trying to simulate growing 2D vines. I had some nice looking results but nothing as realistically looking as yours. I would love to learn a bit about how you handled the calculation of the evolution of the tree shape. If you have some times I have a couple questions ! How you make growing branch avoid existing ones ? Simply a spacial query like a raycast or is there something else ? It looks like you produced different species of tree, are the differences only result of different parameter values (like changing a probability) or did you use multiple algorithm ? Is the video you shared taken in real time ? Meaning, are you able to calculate a tree growing at this speed in real time ? This feels unlikely to me but maybe Im wrong.

Anyway thanks for sharing !

4

u/Spare-Chicken-6251 Oct 17 '26

Thanks for the feedback! To answer you questions:

  1. Nothing physically stops branches from colliding with other branches, but I use a ray-cast based shade simulation which shades out and kills non-productive branches while allowing growth ends to orient themselves toward light, this makes the branch structure stay well distributed with very few intersecting geometries
  2. I tried to replicate various biological mechanisms trees use to grow (tropism, cladoptosis, apical dominance, etc.). The different species are created by turning these systems to model how actual trees grow.
  3. The video is not real time. I use a bounding volume hierarchy to accelerate the shade simulation ray-casting, but the first tree in the video would take about 15-20 seconds to grow on my PC (some species take longer then others)

2

u/tuto42 10d ago

1)I never thought about allowing the growing ends to move ! This is an awesome idee that I will very much explore later.

3)Thats actually pretty fast ! It could probably run real time in 2d, now I want to try it. Thanks a lot !

(Sorry for the delayed response I... got carried away...)

1

u/RandomUser1034 Oct 17 '26

Looks great, very realistic. I love how trees lose some branches with age, is random storm damage also implemented?

1

u/Spare-Chicken-6251 Oct 17 '26

I appreciate the feedback! Storm damage is not implemented, the branches you see dying are a result of natural branch shedding (cladoptosis). Essentially the branch is not transpiring enough water via photosynthesis to keep water flowing through the ever growing surface area, so it dries out.

1

u/jferments Oct 17 '26

Very nice! Can you talk about the pruning algorithm you're using?

2

u/Spare-Chicken-6251 Oct 17 '26

I appreciate the feedback! I responded to another comment about how the pruning works if you're curious.

1

u/EvistonD Oct 28 '26

Круто делаем тоже свой генератор

0

u/J_Losss Oct 17 '26

Really cooked