Four affine maps and a weighted coin, thrown a hundred thousand times at an eight-thousand-pixel canvas.
The chaos game
Start at the origin. Pick one of four affine maps with fixed probabilities, apply it,
plot where you land, repeat. What the walk converges on is the set the four maps
leave unchanged — the attractor — and nothing else about the fern is stored anywhere.
var rand = random.NextDouble();
if (rand <= 0.01) { newX = 0; newY = 0.16f * y; }
else if (rand <= 0.7) { newX = 0.76f * x + 0.04f * y; newY = -0.04f * x + 0.85f * y + 1.6f; }
else if (rand <= 0.93) { newX = 0.2f * x - 0.26f * y; newY = 0.23f * x + 0.22f * y + 1.6f; }
else { …right frond… }
A hundred points, and some of the first few are not on the fern at all. The walk has
to fall onto the attractor before it can stay there, which it does within a dozen
steps because every one of the four maps contracts distances.
Not quite Barnsley’s numbers
This is the classic Barnsley fern with one coefficient changed. Barnsley’s main
frond scales by 0.85 in x; this one uses 0.76:
newX = 0.76f * x + 0.04f * y;
newY = -0.04f * x + 0.85f * y + 1.6f;
Contracting horizontally more than vertically makes the fern narrower than the
canonical one — taller in proportion, with the leaflets held closer to the spine.
That is why the canvas is 5000 × 8000 rather than square: the aspect ratio of the
attractor changed, and the frame followed it.
The probabilities are unchanged at 1%, 69%, 23% and 7%. They are not aesthetic
choices — they are roughly proportional to the area of the attractor each map is
responsible for covering, which is what makes the point density even across the whole
shape.
Two thousand points and the shape is settled.
Twenty thousand. Each leaflet is a copy of the entire fern — the main frond map
applied once more, at 0.76 by 0.85 and a few degrees of rotation.
The stem has no area
The first map is degenerate:
newX = 0; newY = 0.16f * y;
Its linear part has determinant zero: it collapses the whole plane onto a vertical
segment. There is no area for it to cover, and one throw in a hundred is simply how
often the fern needs a stem drawn at all.
Half the points. From here the picture stops changing shape and starts changing tone.
A hundred thousand. The last regions to fill are the leaflet tips, which are reached
only through long chains of the two side maps and are therefore the rarest
destinations in the walk.
Points are drawn as filled marks with no blending, so a pixel hit twice looks like a
pixel hit once — tone comes from coverage, not accumulation. Raising the count
brightens the sparse regions and does nothing to the dense ones.
One fern, seven renderings
The maps are identical in all seven renderings, so the plant is always the same
fern. What changes is what each rendering does with it — how close it stands, how
much ink it throws, what marks it throws, and how many passes:
| Rendering | Points | Mark | Composition | Ink |
|---|
| Matrix Green | 100,000 | 12 px squares | full frond, apex clear of the top edge, stem exiting the bottom | neon green on black |
| Crown | 140,000 | 10 px squares | 1.95× crop of the upper frond, bleeding every edge | teal-to-mint ramp |
| Halo | 200,000 | two passes: 26 px, then 10 px | full frond | dim green aura, bright frond |
| Drift | 30,000 | 8 px discs | centred at 0.6× | lavender dotwork on violet-black |
| Sumi | 85,000 | 14 px squares | full frond | ink on paper |
| Nocturne | 150,000 | 8 px squares | full frond | ivory on ink-navy |
| Ember | 70,000 | 15 px squares | full frond | amber on warm charcoal |
Crown stands close enough that the leaflets stop reading as a plant and become a
field of abstract forms; Halo draws the walk twice, a coarse dim under-pass
whose big marks bloom past the silhouette and a fine bright pass over it; Drift
sets the whole plant small and sparse, as round dots, with room to breathe around
it. The other four keep the full-frond composition and differ in mark size, density
and palette — deliberate, curated choices rather than recolors of one drawing.
The gallery closes with the piece as it would hang: the canonical fern on a warm
wall, behind an off-white mat and a near-black frame that casts a soft shadow.
That plate is a presentation of the lead, not an eighth rendering — the frame is a
layer drawn around the artwork’s own pixels, and there is no framed copy of any
other variant.
Determinism
Every walk is seeded from its preset’s Seed — or, for layered renderings, from
each layer’s own — so the same points land in the same places every run. The
generator is System.Random, which the project’s determinism policy flags as not
guaranteed stable across .NET versions: reproducible on a given runtime, not
pinnable by hash across all of them.