L-System Fractal Plants: Growing Trees with Grammar

simulator intermediate ~10 min
Loading simulation...
Fractal tree — 5 iterations, 25° branching

A fractal tree with 5 iterations of L-system rewriting at 25° branching angle. The result is a realistic branching structure demonstrating how simple production rules generate complex, natural-looking forms.

Formula

F → F[+F]F[-F]F (example production rule)
String length ≈ k^n (exponential growth with iterations)

Grammar of Growth

In 1968, Hungarian biologist Aristid Lindenmayer proposed a simple formalism for describing plant growth: start with an initial string (axiom) and repeatedly apply rewriting rules (productions) to every character simultaneously. The resulting string is then interpreted as a sequence of turtle graphics commands — move forward, turn left, turn right, save position, restore position. From these minimal ingredients emerge stunningly realistic plant forms.

Production Rules

An L-system is defined by its alphabet, axiom, and production rules. For example, the rule F → FF+[+F-F-F]-[-F+F+F] replaces each line segment with a branching structure. Applied once, it creates a simple fork. Applied five times, it produces a dense, realistic bush. The key insight is that the same rule applied to every segment simultaneously models parallel growth — just like a real plant where all buds develop at once.

Self-Similarity and Fractal Structure

L-system plants are fractal: each branch is a scaled-down copy of the whole tree. This self-similarity is not just a mathematical curiosity — real plants exhibit it because the same genetic program controls growth at every scale. The fractal dimension of L-system plants typically falls between 1.5 and 2.0, matching measurements of real trees. Higher iterations reveal finer detail, but the overall shape is established early.

From Biology to Hollywood

L-systems revolutionized computer graphics. Before Prusinkiewicz's 1990 book 'The Algorithmic Beauty of Plants,' creating realistic vegetation for films and games required painstaking manual modeling. L-systems automated this entirely — a few lines of grammar rules can generate entire forests. Today, every major film with outdoor scenes uses procedural plant generation descended from Lindenmayer's original idea.

FAQ

What is an L-system?

An L-system (Lindenmayer system) is a formal grammar that uses string rewriting rules to model the growth of biological organisms. Starting from an axiom string, production rules are applied iteratively, and the resulting string is interpreted as drawing instructions (F=forward, +=turn right, -=turn left, [=save state, ]=restore state).

Who invented L-systems?

L-systems were invented by Hungarian biologist Aristid Lindenmayer in 1968 to describe the growth patterns of algae. They were later extended by Przemyslaw Prusinkiewicz to model complex plant structures and are now widely used in computer graphics.

How do L-systems create realistic plants?

L-systems encode branching by using bracket symbols to save and restore the drawing state. The rule F → F[+F]F[-F]F, for example, creates a stem that branches left and right at each iteration. After several iterations, this produces a convincingly natural tree structure.

Are L-system plants actually fractal?

Yes — L-system plants exhibit self-similarity at different scales, which is the defining property of fractals. A branch of an L-system tree looks like a smaller version of the whole tree, just as real trees show similar branching patterns from trunk to twig.

Sources

Embed

<iframe src="https://homo-deus.com/lab/art-mathematics/l-system-plants/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub