L-systems: How Biology Gave Computer Graphics a Grammar for Growth
A fern does not contain a list of its fronds. Whatever is written in its cells is not a description of the finished plant but a set of instructions for growing one, applied over and over as tissue divides. That distinction sounds like philosophy until you try to write it down, at which point it turns into a concrete question about formalism: what kind of mathematical object describes a process of development rather than a finished shape?
In 1968 a theoretical biologist named Aristid Lindenmayer answered it, for the narrow case of thread-like organisms, with a construction so plain that it fits in three lines. Within twenty years it had been adopted almost wholesale by computer graphics, and it remains the reason a game can ship a forest without an artist modelling every tree. This is one of the cleanest instances of the traffic this site is about, and it runs in the direction people usually forget: a biologist handed computer science the algorithm, not the other way round.
Rewriting, In Parallel
Lindenmayer was studying filamentous organisms: algae and fungi that grow as chains of cells. Their development is tractable precisely because it is nearly one-dimensional. A cell in a given state divides into cells in states determined by its own, and the organism at any moment can be written as a string of symbols, one per cell [1]. Development is then a rule for turning one string into the next.
The formalism he wrote down looks like a Chomsky grammar, and one detail separates them. A Chomsky grammar rewrites one symbol per step, because it models a derivation carried out by something outside the string. An L-system rewrites every symbol at once, because it models cells that all divide on their own clock with no one taking turns. Parallel rewriting is not a computational convenience; it is the biological commitment, and everything characteristic about L-systems follows from it.
The smallest useful example is the algae filament that motivated the model. Two cell
states, A for a young cell and B for one ready to divide, and
two rules:
axiom A
rules A -> AB
B -> A
n = 0 A
n = 1 AB
n = 2 ABA
n = 3 ABAAB
n = 4 ABAABABA
n = 5 ABAABABAABAAB
The filament lengths are 1, 2, 3, 5, 8, 13: the Fibonacci sequence, which appears here not because anyone put it there but because each generation contains the whole of the previous one plus the descendants of the generation before that. A second paper the same year extended the scheme to filaments where a cell's fate can depend on its neighbours and to branching structures, which is where the model stops being about algae and starts being about plants [2].
The Formal Object
A deterministic context-free L-system - a D0L-system, the class in the example above - is a triple : an alphabet , an axiom which is the starting string, and a set of productions assigning each symbol a successor. Symbols with no production stand for themselves. One derivation step applies the whole of everywhere simultaneously:
Because rewriting is context-free and parallel, the number of each symbol in is a fixed linear function of the counts in . Collect the counts in a vector and the productions in a growth matrix , where counts how many times symbol occurs in the successor of symbol :
String length therefore grows like the largest eigenvalue of , raised to the number of steps. For the Fibonacci filament is the golden ratio. For the branching grammar below it is 8, so the fourth derivation is already eleven thousand symbols long. Exponential blow-up from a two-line specification is the entire commercial proposition of the technique, and also the reason the simulation's iteration slider has a hard stop.
None of this has produced a picture yet. The string is a sequence of symbols; turning it
into geometry needs a second, entirely separate map, and the standard one is turtle
interpretation. A turtle carries a position and a heading. F means move
forward one step, drawing; + and - mean turn by a fixed angle
. Alvy Ray Smith, then at Lucasfilm, made
the case for the whole apparatus to a graphics audience in 1984 and named the payoff
database amplification: a few hundred bytes of grammar expanding into as much
geometry as anyone cares to render
[3].
Brackets Make Trees
A turtle with only F, + and - can draw a curve, and
curves are what the classical fractals are: Koch snowflakes, dragon curves, Sierpinski
gaskets all fall out of three-line grammars. But a plant is not a curve. It is a structure
that goes out along a branch and then comes back to continue up the trunk.
Two more symbols buy exactly that. [ pushes the turtle's position and heading
onto a stack, ] pops them. Everything between a matching pair is a branch,
drawn and then abandoned, with the turtle restored to where the branch began:
axiom F rule F -> FF+[+F-F-F]-[-F+F+F] angle 22 degrees n = 1 8 line segments, 20 symbols n = 2 64 line segments, 172 symbols n = 3 512 line segments, 1,388 symbols n = 4 4,096 line segments, 11,116 symbols
The bracketed string is a tree in the computer-science sense being drawn as a tree in the botanical one, and the correspondence is not a pun: the stack depth at any point in the string is the branching order of the twig being drawn. That is why the renderer in the accompanying simulation can taper and shade branches without any extra information - it reads the depth straight off the brackets.
Four Extensions, Four Failures They Fix
A plain D0L-system, run twice, gives the same plant twice, and no forest looks like that. Stochastic L-systems attach probabilities to competing successors for the same symbol, so one grammar defines a family of individuals rather than a single specimen - precisely the relationship a species has to its members. Context-sensitive productions let a symbol's rewriting depend on its neighbours, which is how a signal travels along the structure, and is the L-system analogue of a hormone moving through tissue.
Parametric L-systems attach continuous values to symbols - an internode's length, a bud's age, a branch's diameter - and let productions carry arithmetic and conditions. This is the version that models real plants, because real development is governed by quantities and thresholds rather than by symbols alone. It is also what makes developmental modelling possible rather than merely structural: Prusinkiewicz, Lindenmayer and Hanan reconstructed specific herbaceous species this way, capturing not only the branching topology but the order in which flowers open along a stem as the plant ages [4].
The fourth extension addresses the deepest problem: a plain L-system grows in a vacuum. Real plants bend towards light, run out of room and collide with obstacles. Open L-systems let the string query an external environment mid-derivation and receive answers that steer subsequent productions, which is enough to model climbing plants, canopy competition and pruning [5]. A later refinement drove development from positional information - a module's fate determined by where it sits along an axis - which is closer to how gradients organise real tissue and produces far more convincing inflorescences [6].
What It Is Actually Used For
Vegetation is the obvious answer and the smallest one. The same machinery generalises to any structure with recursive, self-similar articulation, most visibly cities: Parish and Müller's 2001 system grows a road network with an L-system whose productions consult a map of population density and terrain, then fills the resulting blocks with buildings from a second grammar [7]. Street layouts, façade subdivision, cave systems and blood vessels have all been attacked the same way, and the reason is always database amplification: the rules are small enough to author by hand and to tweak, while the output is large enough that hand-authoring it would be out of the question.
Honest Limits
The first limit is the one built into context-free rewriting: a branch cannot see anything outside itself. Real trees are shaped mostly by competition - for light, for space, for the resources a shared vascular system has to allocate - and none of that is expressible in a production that only knows about its own symbol. The tell is that state-of-the-art tree modelling has partly moved away from pure grammars. Self-organising models grow buds that compete for light in a shared space and allocate resources by flux through the structure, producing the response to crowding and pruning that a grammar has to be told about [8]. Leaf venation is modelled the same way, by veins racing towards sources of a growth signal rather than by any rewriting at all [9]. Open and parametric L-systems narrow this gap by letting the environment answer back, but the interaction is bolted on rather than intrinsic.
The second limit is that the grammar under-determines the plant. Two people can interpret one string into wildly different shapes by changing the turn angle, the step length or the tapering rule, as the simulation makes obvious the moment you sweep the angle slider with the rules held fixed. It is worth being clear about what is being claimed when an L-system "reproduces" a species: the grammar captures the branching topology, and a good deal of what your eye responds to lives in the interpretation.
The third limit is the important one, and it is a limit on interpretation rather than on the model. An L-system is generative, not mechanistic. It reproduces the form without modelling cell walls, auxin transport or mechanical load, so a grammar that fits a plant is evidence that the plant's form is compressible, not evidence that the plant computes anything resembling that grammar. The clearest illustration is the phenomenon L-systems are most often wrongly credited with. The spiral florets of a sunflower are not an L-system result. Vogel's construction reproduces the pattern by placing each floret at a fixed golden angle from the last [10], Douady and Couder showed that the same spirals emerge from purely physical repulsion between successive primordia - reproducing them with ferrofluid droplets, no biology involved [11], and the mechanistic account rests on auxin transport concentrating the hormone at the points where new primordia appear [12]. Different mechanism, different formalism, same lesson: matching the pattern is not the same as explaining it.
Why It Matters
The lasting idea is compression. A genome does not store an organism; it stores a procedure whose execution produces one, and the ratio between the two is enormous. L-systems are the smallest honest model of that relationship: in the simulation accompanying this article, a twenty-nine-character grammar expands into a hundred thousand symbols and twenty-four thousand line segments, and every one of those segments is implied by the rules rather than stored anywhere. Procedural generation as a field is the systematic exploitation of that ratio, and it was found by a biologist asking how a filament of algae grows.
The traffic has also gone back the other way, which is the part that makes this more than an anecdote about graphics. Having a formal language for development means differences between species become differences between grammars, and can be compared. Prusinkiewicz and colleagues showed that the inflorescence architectures of several plant families - the way flowers are arranged on a stem, long treated as a taxonomic given - are captured by a single model in which a small change to one parameter moves a species from one architecture to another, matching mutants observed in the laboratory [13]. A formalism invented to describe growth turned into a hypothesis about how growth evolves.
The grammars in this article are all short enough to read, and reading them is not the same as watching them run. The L-system simulation expands seven of them symbol by symbol and draws the result, including the stochastic bush that grows a different individual from every seed. Change the angle, hold the rules fixed, and watch how much of a plant lives outside its grammar. Better still, write your own: every preset loads into an editable grammar box, and the fastest way to understand a production is to break one and see what the turtle makes of it.