← All Tools

Barnsley Fern & IFS Fractal Renderer

Michael Barnsley’s chaos game: at each iteration pick one of four affine maps (x, y) → (a·x + b·y + e, c·x + d·y + f) with the listed probability, apply it to the current point, then plot the new point. After a few thousand iterations the point cloud converges to the attractor of the iterated function system — here, a leafy fern. Tweak the sixteen numbers below or pick a preset attractor to see how each affine coefficient bends the leaflet, stem, or side branches.

Affine transforms

#abcdefp

How the four fern transforms shape the plant

f1 collapses everything onto the stem (a rank-deficient map, a = d = 0) — it draws the vertical shoot. f2 is the dominant map (85% of the picks); it’s a near-identity that slightly rotates and translates upward, and repeatedly composing it walks up the frond, building the self-similar main body. f3 and f4 are the two side leaflets, small rotations that mirror-reflect the frond onto its left and right branches. Change any one row and re-render to see that role shift visibly: raise e in row 2 to make the fern lean, drop the probability of row 1 and the stem thins out.