Two chemicals, one that eats the other, diffusing at different speeds — and the difference is the pattern.
Two chemicals and one reaction
The Gray–Scott model is a pair of partial differential equations, discretised onto a
200 × 200 grid:
∂u/∂t = Du ∇²u − u·v² + F(1 − u)
∂v/∂t = Dv ∇²v + u·v² − (F + K)·v
u is a feedstock and v is a catalyst that consumes it. The reaction term u·v²
is the same in both, with opposite signs: every unit of u destroyed becomes a unit
of v. F is the rate at which fresh u is fed in, and K the rate at which v
is removed.
Nothing about the equations describes a shape. The shapes are what the equations do.
Two hundred steps. The grid starts as u = 1 everywhere and v = 0, with a small
square in the centre perturbed to u ≈ 0.5, v ≈ 0.25 and a little noise. This is
that square, barely changed.
The whole trick is that the rates differ
public float Du { get; init; } = 0.2097f;
public float Dv { get; init; } = 0.105f;
u diffuses twice as fast as v. That single asymmetry is the reason anything
interesting happens, and it is Alan Turing’s 1952 result: a system that is stable
when everything is mixed can become unstable when the components spread at
different speeds. Turing called the outcome morphogenesis and proposed it as an
explanation for animal markings.
If Du and Dv were equal the seed would diffuse into a uniform grey and stay there.
Make the activator spread more slowly than the inhibitor and the uniform state stops
being a stable answer.
Eight hundred steps. The front is moving outward and is already not circular.
F and K choose the species
Those two numbers are the whole parameter space, and the three renderings sit at
three points in it:
| Rendering | F | K | Steps | Behaviour |
|---|
| Coral | 0.0545 | 0.062 | 8000 | branching fingers, growing tips |
| Maze | 0.029 | 0.057 | 8000 | labyrinth of even-width channels |
| Spots | 0.025 | 0.060 | 6000 | discrete blobs that divide |
| Archipelago | 0.0545 | 0.062 | 3200 | three colonies growing into reefs |
| Orbit | 0.0545 | 0.062 | 2800 | eight-fold radial growth |
These are not merely stylistic variants. Coral, Maze, and Spots occupy different
regions of the Gray–Scott parameter map; Archipelago and Orbit show how seed
composition, field scale, and elapsed time reshape the same branching regime.
The map has been explored in detail and is mostly dull: nearly all of it decays to
uniform. The interesting behaviours live in a narrow band, and the three presets are
three points inside it.
Two thousand steps. Fingers have formed. Each tip is a place where the front is
consuming feedstock faster than diffusion can replace it behind, so the tip advances
and the trailing region starves.
Four thousand. The pattern advances at a roughly constant speed, because the
mechanism at every tip is the same and it is local.
Eight thousand. Growth has stopped where the pattern has already been — a tip cannot
advance into a region that has been depleted — so the structure is essentially
permanent from here. Running four thousand more steps would change very little.
Simulation grid, output canvas
The simulation runs at 200 × 200 and the output is 900 × 900. Each cell therefore
becomes a 4.5-pixel block, and the concentration is mapped through a seven-stop
palette to give the field its depth.
Running the simulation at output resolution would be twenty times the work for a
pattern whose feature size is several cells wide — the physics has a natural length
scale, set by the diffusion rates, and resolving beyond it buys nothing.
Determinism
The initial perturbation is seeded from the preset with a local PCG32 generator and
consumed in a fixed order over the seed square.
Everything after that is arithmetic: the same seed and the same step count produce the
same field, and the same field bit for bit on any machine.