---
id: "l-systems"
title: "L-Systems"
aliases: [Lindenmayer systems, turtle-graphics plants, parametric L-systems]
domain: "procgen"
stage: "procedural"
realtime: "realtime"
platforms: [cpu, webgl2, webgpu, blender, houdini, unity, unreal, godot, python]
year_introduced: 1968
outputs: [curves, mesh, graph]
style: "both"
dynamic: "static"
cost: "cheap"
authority: "Prusinkiewicz & Lindenmayer"
url: "https://texelatlas.vercel.app/t/l-systems/"
sources_verified_at: "2026-11-29"
---
# L-Systems (Prusinkiewicz & Lindenmayer)

> Parallel string-rewriting grammars whose output symbols are interpreted by a turtle to draw branching structures. Parametric, stochastic and context-sensitive variants model plant development.

## Reach for it when

- generate trees and plants procedurally
- need branching structures from simple rewrite rules
- make fractal growth patterns like ferns
- vary vegetation models without modeling each by hand

## How it works

An L-system consists of an alphabet, an axiom and productions applied to every symbol simultaneously in each generation, so growth is parallel like cell division. After n generations the string is interpreted by a turtle: F moves forward and draws a segment, + and - turn, [ and ] push and pop turtle state to create branches. Parametric versions attach numeric parameters (length, thickness, age) to symbols and condition productions on them, stochastic versions pick productions by probability, and context-sensitive versions let neighbours influence a rewrite so signals can travel along the plant. Open L-systems exchange information with an environment, enabling effects like phototropism or pruning. The Algorithmic Beauty of Plants gives the canonical treatment and examples.

## When to use it

Choose it for trees, ferns, flowers and fractal curves where the developmental rules are the creative control, and for architecture-style recursion. Prefer [Space Colonization Tree Modeling](https://texelatlas.vercel.app/t/space-colonization-trees.md) when branches should fill a volume or follow an attractor shape with minimal parameters, [Interactive Climbing Plant Modeling](https://texelatlas.vercel.app/t/climbing-plants-simulation.md) for vegetation interacting with geometry, and [CGA Shape Grammar (Procedural Buildings)](https://texelatlas.vercel.app/t/cga-shape-grammar.md) for building facades.

## Cost

cheap — String length grows exponentially with generations for branching rules, but typical plants need under 10 generations; meshing the result dominates.
Measured GPU Weight: 248.4× baseline (extreme) — 8.1725 ms median / 8.1936 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 240.54× baseline (extreme) — 3.8246 ms median (2.14× faster on L4).
Ampere A100 scaling: 161.14× baseline (extreme) — 4.6408 ms median (1.76× faster on A100).

## Failure modes

- Exponential string growth blows memory and time for deep derivations
- Turtle interpretation produces self-intersecting branches that require explicit collision handling
- Context-free rules look rigidly symmetric unless stochastic or parametric randomness is added
- Tuning production parameters is non-intuitive: tiny changes give wildly different plants
- No built-in environment awareness: trees ignore walls, light and neighbours unless open L-systems are used

## Dataflow

- Inputs: —
- Outputs: curves, mesh, graph
- Platforms: cpu, webgl2, webgpu, blender, houdini, unity, unreal, godot, python

## Presets

### Dragon curve drawn from an L-system rewrite (512 turtle segments) (glsl-fragment; rendered 2026-11-29)

```json
{
  "SEGS": 512,
  "UNIT": 0.028
}
```

```glsl
// Dragon curve as an L-system (F->F+G, G->F-G), 512 turtle segments; turn direction of step k read off the rewrite by its bit pattern.
const int SEGS = 512;
const float UNIT = 0.028;
const vec2 CENTER = vec2(0.5, 0.5);
float segd(vec2 p, vec2 a, vec2 b) {
    vec2 pa = p - a, ba = b - a;
    return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec2 pos = vec2(0.0), dir = vec2(1.0, 0.0);
    vec2 origin = CENTER - UNIT * vec2(8.0, 5.5);
    float best = 1e9, bi = 0.0;
    vec2 a = origin;
    for (int k = 1; k <= SEGS; k++) {
        vec2 b = a + dir * UNIT;
        float d = segd(uv, a, b);
        if (d < best) { best = d; bi = float(k) / float(SEGS); }
        a = b;
        int m = k;
        while ((m & 1) == 0) m >>= 1;
        dir = ((m & 3) == 1) ? vec2(-dir.y, dir.x) : vec2(dir.y, -dir.x);
    }
    vec3 bg = mix(vec3(0.04, 0.05, 0.09), vec3(0.09, 0.08, 0.14), uv.y);
    vec3 lc = 0.5 + 0.5 * cos(6.2831 * (bi * 0.9 + vec3(0.0, 0.33, 0.67)));
    float w = smoothstep(0.0042, 0.0016, best);
    vec3 col = bg + lc * w + lc * 0.12 * smoothstep(0.02, 0.0, best);
    fragColor = vec4(pow(col, vec3(0.8)), 1.0);
}

```

Attribution: written for this index

## Lineage

- extended by [CGA Shape Grammar (Procedural Buildings)](https://texelatlas.vercel.app/t/cga-shape-grammar.md)
- extended by [Procedural City Generation (L-system Road Networks)](https://texelatlas.vercel.app/t/procedural-city-roads.md)

## Sources

1. [primary] Przemyslaw Prusinkiewicz, Aristid Lindenmayer The Algorithmic Beauty of Plants. algorithmicbotany.org. https://algorithmicbotany.org/papers/abop/abop.pdf (verified via http on 2026-11-29)
2. [tutorial] Paul Bourke L-System User Notes. paulbourke.net. https://paulbourke.net/fractals/lsys (verified via http on 2026-11-29)

## Cite this entry

Texel. "L-Systems." https://texelatlas.vercel.app/t/l-systems/ (accessed 2026-12-01).
