Algorithmic Botany

In 2021, I became familiar with Aristid Lindenmayer’s L-System (a grammar that is used to describe recursive structures). Inspired by that, I implemented a “graph-based L-System”, which is similar to L-Systems in that the L.H.S. of every rule is a variable, however in my version the R.H.S. is a graph of nodes containing arbitrary data/behaviors, some of which may contain recursive references to other variables. I started modeling various abstract shapes with this system, including trees.

I was doing these explorations in Unity, which doesn’t provide any API to do procedural 3D modeling, and I created my own 3D meshing library in the process. Below are some outputs from the first version of my tree system, which models trees as a collection of recursively generated Bézier curves. I also modeled simple tendencies like phototropism and gravitropism.

I also experimented with attaching behaviors to the nodes of the rule graphs, which allowed me to create animations like these:

However, I soon realized that the grammar of L-Systems is not the most intuitive when trying to inject artistic controls into the trees being modeled, and began exploring other approaches to do the same. I added various customizations to the L-System (and making it a maintenance nightmare in the process), and I achieved some interesting results. Below are some plants I modeled with an “improved” (or, frankensteined) L-System.

After a complete re-write, I have arrived at an approach where I model trees recursively with two distinct “units” of behaviors: growths and phyllotaxies. “Growth” covers the tendencies and paths that the tips of branches take as they move in space, and phyllotaxies represent the “emit behavior” of an underlying growth. Recursion happens via references to other growths from phyllotaxies.

I often spent a lot of time at botanical gardens observing details in various plants, and I incorporated some of those into my algorithm. Here are some of the tendencies I currently have in my system:

  • Gravitropism: Tendency to grow away from gravity

  • Phototropism: Tendency to grow towards a light source (taking shadows into account)

  • Light interception optimization: the leaves of many plants are rotated so that they may catch as much light from the sky/sun as possible.

  • Growth inertia (a term I coined): whenever something grows out of a parent branch, the parent branch is “pushed back” a little

  • Periodic bends: While it’s easy to assume adding noise to something will make it “look like a tree”, I noticed two distinct types of randomness in branches: one is very chaotic with seemingly no pattern (i.e., where the randomness is consistent throughout growth, but constrained by physical properties, giving an appearance of smooth but continuous random turns), and slightly larger bends at longer intervals.

  • Spiral tendency: (e.g., pea tendrils) Often times, growths that are in “search of something” tend to spiral during the search process, creating helical patterns

  • Effect of age (and the effect of weight): In order to model the effect of weight and age on branches, twigs, etc properly, I’d need to run a longer simulation, but I created a hack (at the time I was interesting in making it realtime), by using parameters as functions of the instantaneous age of a growth point and cumulative growth time/distance from the global and local root points.

Example below of the effect of enabling “light interception optimization” - first image (disabled), second image (enabled)

Currently, I am in the process of extending this system to be more genetically inspired - whereby traits of several different species are specified in a large “gene pool”, whereby different genes can be combined to inherit attributes from several different species in order to create chimera plants. I am also in process of combining this system with another procedural 3D system that I’m working on. That will likely take quite a while to implement, but this has been quite a long project, and I anticipate spending a few more years on it.

In short, I have devised an algorithmic botany playground where I can model multiple species with ease with a large number of numeric parameters (with the option of adding new code to inject highly custom behavior). It runs as an emergent simulation where each growth can run in parallel, with its own frequency, and is independent of the resolution of the 3D model that is output.

Here are renders of some outputs and animations from the latest iteration of this system :)

Carefully controlled randomness for stable growth

Uncontrolled randomness

Next
Next

Procedural 3D