Procedural Plants and Trees: Interactive Guide to Branching, L‑Systems, and Growth Models

EN NLESPT-BR


Procedural vegetation is where geometry meets biology: a handful of local rules can generate tree shapes that feel structured, organic, and species-specific. The algorithms behind procedural plants span a broad range, from simple recursive subdivision to full physiological simulations where branches compete for light and resources.

This article walks through three distinct approaches, each with its own interactive visualization. You will start with the simplest recursive model, see how L-systems turn symbolic grammars into branching geometry, and observe how resource competition and pruning shape a tree over many seasons. Together, these models form a complete picture of how procedural vegetation works, what each approach is best at, and where the tradeoffs are.

Recursive Branching: Geometry from Local Rules

The simplest tree model is built on one idea: a branch spawns smaller child branches, and those children spawn their own children. The process is purely geometric and recursive. Each generation shrinks in length, rotates by a branching angle, and optionally adds a small random perturbation so the result does not look symmetrical.

Recursive branching

Drag the orange handle on the first right branch to change the branching angle, and the same change propagates through every descendant. The controls below the canvas adjust length reduction (how much each generation shrinks), depth (how many recursive generations appear), and randomness (deterministic variation in angle and length that prevents the tree from looking like a rigid diagram).

This model teaches one of the most important ideas in procedural generation: repeating a local rule produces global complexity. Every branch in the tree follows the same instruction, splitting into two smaller copies, yet the tree still looks structured because the hierarchy preserves a natural taper from trunk to twig. The tree does not need a blueprint; it needs only a rule and a way to repeat it.

The limitation is equally clear: pure recursive branching produces a balanced, symmetrical skeleton. Real trees are not balanced. Their branches compete, some grow faster than others, and the crown fills unevenly. That is where the other approaches in this article provide additional realism.

How Recursive Branching Works

The algorithm is straightforward. Starting from a trunk of a given length and direction:

  1. Draw a segment from the current position in the current direction.
  2. At the end of the segment, decide whether to branch. If depth allows, split into two child branches: one rotated left by the branching angle, one rotated right.
  3. Each child branch is a smaller copy of the parent: its length is the parent length multiplied by a reduction factor (commonly 0.6–0.75), and its own children follow the same rule.
  4. Random perturbation adds a small angular and length variation to each split so repeated iterations do not produce a perfectly symmetric pattern.

The result is a hierarchy where Depth 0 is the trunk, Depth 1 is the first pair of major limbs, Depth 2 is their branches, and so on. The depth control in the visualization stops the recursion at a chosen level, which makes the fractal nature of the structure easy to inspect.

This model is the foundation for understanding the more sophisticated approaches below. The industry paper Creation and Rendering of Realistic Trees by Weber and Penn shows how geometric parameterization produces production-quality trees from the same recursive principle.

L-Systems: Grammar-Based Plant Growth

Recursive branching builds geometry from a direct rule, but many procedural plant models use a different strategy: first grow a symbolic string, then interpret that string as drawing commands. This two-stage approach is called an L-system (Lindenmayer system), and it is the most widely used formalism for procedural vegetation.

The idea has two parts:

  1. Rewrite stage: start with an axiom (an initial string of symbols) and repeatedly apply production rules that replace each symbol with a longer string. Each iteration produces a more detailed description.
  2. Turtle stage: interpret the final string as commands for a virtual turtle. F means draw forward, + and - mean turn left or right by a fixed angle, [ saves the current turtle state, and ] restores it.

The push/pop stack ([ and ]) is what creates branches. When the turtle encounters [, it remembers its current position and direction. When it encounters ], it returns to the saved state, which allows the next branch to spring from the same point in a different direction.

Rewrite & Turtle Stack

0 of 0
F draw + left right [ save ] restore
1 / 1
Stack 0 Pos (0, 0)
0 frames

The split view shows the rewrite strings on the left and the turtle drawing on the right for the selected iteration. The axiom F is short, but after one rewrite with the rule F → F[+F]F[-F]F, the string is nine symbols long. After two rewrites, it is much longer, and the turtle drawing begins to show branching structure.

Use the Iteration slider to step through rewrite generations and watch the string expand. Scrub the Command slider to execute the turtle commands one at a time: each F draws a segment forward, each [ saves the current state, each ] pops the stack and returns to the saved position. The Play button animates the entire drawing sequence so the structure appears stroke by stroke.

A Classic L-System Example

The production used in the visualization above, F → F[+F]F[-F]F, is one of the classic L-system rules from The Algorithmic Beauty of Plants. Applied to axiom F:

IterationString (abbreviated)Structure
0FSingle segment
1F[+F]F[-F]FTrunk with two side branches
2F[+F]F[-F]F[+F[+F]F[-F]F]F[+F]F[-F]F[-F[+F]F[-F]F]F[+F]F[-F]FMultiple branching levels
3(much longer)Fully articulated tree skeleton

The string grows exponentially: each F is replaced by nine symbols, so the string length multiplies by roughly the replacement length each iteration. This is characteristic of L-systems and is why even a small grammar can produce surprisingly detailed structures.

The turtle stack ([ and ]) is the mechanism that makes this work as a plant. Without it, the turtle would produce a single meandering line. With it, branches can fork and return to the fork point to branch again, exactly the way real trees grow from buds.

Stochastic and Parametric L-Systems

The deterministic L-system above always produces the same tree from the same axiom and rules. Real trees vary, so L-systems can be extended in two important ways:

  • Stochastic L-systems: multiple production rules for the same symbol, each with a probability. For example, F might become F[+F] 70% of the time and F[-F] 30% of the time. The same grammar then generates different trees on each run, creating species-like variation without changing the logic.
  • Parametric L-systems: symbols carry numeric parameters such as F(length, thickness) so the geometry can depend on branch age, resource state, or environmental conditions. This bridges the gap between symbolic grammars and continuous simulation.

Both extensions are active research areas and production techniques. The canonical reference for L-systems and plant modeling is The Algorithmic Beauty of Plants by Prusinkiewicz and Lindenmayer, available as a free PDF from the Algorithmic Botany project.

Functional-Structural Growth: Light, Resources, and Pruning

The most realistic procedural plant models go beyond geometry and grammar to simulate the biological constraints that shape a real tree. Functional-structural plant models (FSPMs) couple the branching structure to a resource budget: each leaf captures light energy, and each growing tip consumes it. Branches in well-lit positions thrive; shaded branches stall or die.

The visualization below implements a simplified functional-structural model. A tree grows over seasons, and its shape depends on where the sun is positioned and which branches are pruned.

canopy budget

Drag the sun (the yellow circle in the upper area) to change the light direction. A semi-transparent light cone shows which part of the canopy is illuminated. The tree responds in two ways:

  • Phototropism: branches bend slightly toward the light source, tilting the crown in the sun’s direction.
  • Resource allocation: well-lit branches (bright green) get a thicker resource budget. Shaded branches (olive to gray) stall and stop extending.

The canopy budget bar at the bottom shows the ratio of energy captured (light collected by leaves) to energy consumed (growth and maintenance). A green bar means the tree has surplus energy, orange means it is balanced, and red means it is under stress.

Pruning and Resource Reallocation

Click any branch segment to prune it. The pruned branch and all its descendants turn into faded dashed lines, as if they have been cut away. Because the pruned branches no longer consume resources, the remaining branches get a thicker budget and grow more vigorously.

This is one of the most instructive interactions in the visualization. Pruning is not just a visual edit; it reshapes the tree’s energy balance. A tree that is heavily pruned may have fewer leaves, but the remaining ones are better supported and grow larger. The same mechanism explains why real-world pruning redirects a plant’s energy into fruit or flower production.

The Season slider advances the tree through up to 20 growing seasons. Watch how branches that are shaded in early years never recover, while branches in good light extend season after season. The cumulative effect produces a realistic tree that is visibly lopsided toward the light, with dense branching on the sunlit side and sparse, stunted growth in the shade.

From Geometry to Physiology

The progression across this article’s three approaches is also a progression in realism:

  1. Recursive branching: pure geometry, no environment, no competition.
  2. L-systems: symbolic growth, still no environment, but the grammar can express complex branching patterns.
  3. Functional-structural growth: a full feedback loop where light, resources, and pruning determine which branches live and which die.

Each layer adds explanatory power at the cost of complexity. The right model depends on what you need: a quick tree for a game background, a realistic crown for a forest scene, or a biologically plausible growth simulation for visualization or research.

Choosing the Right Approach

ModelBest ForTradeoff
Recursive branchingTeaching recursion, quick tree sketches, abstract geometryNo environmental response, symmetrical by default
L-systemsBotanical accuracy, species-specific branching grammars, symbolic editingExponential string growth, manual rule design
Functional-structuralBiologically plausible growth, pruning response, light-driven shapeHigher complexity, more parameters to understand

Each approach has its place. The recursive tree is the best starting point for building intuition. L-systems give you control over branching topology. Functional-structural models add the biological feedback that makes growth feel alive.

If you are building procedural vegetation for a game or visualization, you will likely combine techniques: add an L-system-like branching rule for the trunk and major limbs, and apply a functional-structural resource check to determine which branches survive when trees compete.