Reaction, diffusion, self-organisation
Reaction-diffusion systems couple two effects that, on their own, do opposite things. Diffusion alone spreads any concentration difference out until everything is flat and featureless. A reaction between two or more chemical species alone can create local concentration spikes, but has no sense of space. Put them together — a chemical reaction happening simultaneously with diffusion across a 2D field — and something unexpected happens: instead of collapsing to uniformity, the system can lock into a stable, repeating pattern. Alan Turing proposed exactly this mechanism in 1952 to explain how a spatially uniform embryo could develop periodic structure like spots and stripes, decades before the actual biochemical "morphogens" were identified.
The Gray-Scott model
The Gray-Scott model tracks two chemicals U and V on a grid, where V catalyses its own production by consuming U (an autocatalytic reaction), and both diffuse at their own rates D_u and D_v:
∂u/∂t = D_u·∇²u − u·v² + F·(1−u) // U replenished at feed rate F ∂v/∂t = D_v·∇²v + u·v² − (F+k)·v // V removed at rate F+k D_u > D_v // U (the inhibitor here) diffuses faster than V (the activator)
The reaction term u·v² is what makes V autocatalytic — it needs both itself and U to grow, so a small local excess of V rapidly consumes nearby U and grows further, while F continuously replenishes U everywhere and (F+k) continuously drains V. The requirement that the inhibitor diffuse faster than the activator is the general Turing condition for pattern formation — remove it and the system just relaxes to a flat equilibrium.
The parameter zoo: F and k choose the pattern
The entire diversity of Gray-Scott output — spots, stripes, mazes, self-replicating blobs, or nothing at all — is selected by just two numbers, the feed rate F and the kill rate k. Small regions of (F, k) space border each other sharply: moving k by a few thousandths can flip the simulation from stable spots to a chaotic, ever-mutating maze. This sensitivity is exactly why the model produces such a rich visual "zoo" from a single fixed pair of PDEs.
Discretising on a grid: FTCS
The simulation advances with a Forward-Time Centred-Space (FTCS) scheme: the Laplacian ∇²u at each cell is approximated with a discrete stencil over its neighbours, and the whole grid is stepped forward explicitly:
laplacian(u, x, y) = u[x-1][y] + u[x+1][y] + u[x][y-1] + u[x][y+1] - 4*u[x][y] // 4-neighbour stencil u_new = u + dt * (D_u*laplacian(u) - u*v*v + F*(1-u)) v_new = v + dt * (D_v*laplacian(v) + u*v*v - (F+k)*v)
Stability requires a small enough time step relative to the grid spacing (an explicit-scheme CFL-type constraint); production implementations typically move this loop to WebGL2 so every cell updates in parallel on the GPU each frame, which is what makes real-time full-screen patterns possible in the browser.
Turing patterns in real biology
Turing's original mechanism — an activator and a faster-diffusing inhibitor — has since been confirmed in real developmental systems: zebrafish stripe formation, digit spacing in vertebrate limbs, and hair follicle patterning have all been traced to activator-inhibitor pairs behaving according to this same mathematics. The Gray-Scott equations are a simplified, simulatable stand-in for these much more complex biochemical networks, but they reproduce the same qualitative behaviour: uniform initial conditions plus local instability equals durable, repeating pattern.
Frequently asked questions
Why does the Gray-Scott model need two chemicals instead of one?
Because pattern formation requires an activator that reinforces itself locally and an inhibitor that diffuses faster and suppresses it at a distance — Turing's original insight. A single diffusing chemical only ever smooths out to a flat, featureless equilibrium; two coupled chemicals with different diffusion rates can instead lock into a stable, repeating pattern.
What do the F and k parameters actually control?
F is the feed rate at which chemical U is replenished from outside the system, and k is the rate at which V is removed. Together they set which region of the Gray-Scott parameter space the simulation sits in — different (F, k) pairs produce spots, stripes, mazes, self-replicating blobs, or a spatially uniform, pattern-free state.
How does this connect to real animal markings?
Alan Turing proposed in 1952 that two morphogens diffusing and reacting during embryonic development could account for periodic patterns like leopard spots, zebra stripes and fingerprint ridges — long before the actual biochemical morphogens were identified. The Gray-Scott model is a concrete, simulatable instance of Turing's general reaction-diffusion mechanism.
Try it live
Drag F and k in Reaction-Diffusion and watch spots turn into stripes turn into mazes in real time.
▶ Open Reaction-Diffusion simulation