L-System Fractal Garden (3D)

Grow 3D L-system trees in a Blender terracotta pot: branch by branch, with tapering, jitter and leaves.

Presets

Playback

L-system

Pick a preset, then change iterations, angle and ratios.

Growth and look

Animation speed and thickness.

Display

Camera

Layers

Quality

Model checks

The science

Lindenmayer systems

An L-system is a string-rewriting game: start from an axiom and, in every iteration, replace all symbols at the same time using the production rules (for the Koch curve F -> F+F--F+F). A turtle then reads the final string: F moves forward and draws, + and - turn by the fixed angle, [ saves the position and heading and ] returns to them, which is how branches are made. In 3D the turtle also pitches (&, ^) and rolls (\, /) with the heading, left and up vectors H, L, U rotated by H' = H cos d + L sin d and so on. The symbol ! thins the branches (width times a ratio), the double quote shortens the step, and L marks a leaf.

Growth counts

For a rule that replaces one segment by m segments the count after n iterations is m^n: the Koch curve has 4^n segments, and with the step shrunk to 3^-n its length is (4/3)^n, which diverges although the curve fits in a finite box. The Hilbert curve has 4^n - 1 unit steps and visits every cell of a 2^n x 2^n grid exactly once. The first and third checks verify exactly these facts on the generated strings.

Fractal dimension

Each iteration multiplies the segment count by N = 4 while the figure grows by s = 3 (fixed step), so the similarity dimension is D = ln N / ln s = ln 4 / ln 3 = 1.2619. The same number is measured independently by box counting: count the boxes of size e that the curve touches, N(e) ~ e^-D, and fit the slope on a log-log plot (second check). Space-filling curves approach D = 2; a tree's apparent dimension depends on the length and width ratios.

Plants

Branching systems such as A -> F[+A][-A] double the number of tips every iteration; tapering (!) and shortening (") make daughter branches thinner and shorter than their parents, as in real trees where branch length falls off roughly geometrically. Random angle jitter is a simple way of imitating the variation between real branches.

Honest simplifications

These are geometric models, not growth physics: no light, gravity, water transport or competition between branches, so they illustrate recursion and self-similarity rather than predict how a particular species grows. The drawn segment count is capped at 60,000 for speed; leaves are simple discs or cards at branch tips.

What to try

  • Pick Koch snowflake, raise n step by step and watch the segment count quadruple and the box-count dimension settle near 1.26.
  • Change the turn angle of the Koch curve from 60 to 72 degrees: the self-similarity (and the dimension) changes because the rule no longer closes up.
  • Switch to Hilbert curve: the dimension rises towards 2 as the curve fills the square.
  • In the tree presets lower the width ratio to thin the twigs, or raise the jitter to make a more natural, asymmetric crown.
  • Set the growth speed to 0 to show the final shape at once, or press New random jitter for another individual.
Loading model...
Loading Blender model...
Segments against iteration (log scale)
Size of the figure against iteration
Growth factor per iteration
Similarity dimension against iteration
Made with 🟠 Blender · Three.js