Gray-Scott reaction-diffusion
Two chemicals diffusing and reacting on a grid or surface produce spots, stripes, mazes and coral-like patterns that can drive textures, displacement or growth.
Also known as Turing patterns, Gray-Scott
In the family Simulation & animation, pattern formation
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | No built-in Gray-Scott reaction-diffusion simulation. |
| Unity | None found | |
| Unreal 5.7 | None found | No built-in Gray-Scott reaction-diffusion solver. |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Two concentration fields A and B update by A' = A + (Da*lap(A) - A*B*B + f*(1-A))*dt and B' = B + (Db*lap(B) + A*B*B - (k+f)*B)*dt. The feed rate f and kill rate k pick the regime: spots, worms, mazes, solitons. The Laplacian is a 3x3 stencil on a texture; on GPUs the update is a ping-pong fragment pass or compute pass, run many substeps per frame because the system evolves slowly. On meshes the Laplacian is a cotangent or graph Laplacian, or the pattern is simulated in a UV atlas (Turk, Witkin and Kass). The resulting B field is mapped to colour, bump, or used as a mask for growth and material.
When to choose it
Reach for it when
- want spots, stripes or maze patterns that grow
- need animal-coat or coral textures that evolve
- static noise textures look too artificial
- generate organic self-organising patterns on a grid
Choose it when you want organic, self-organising patterns (animal coats, coral, cracks of paint, worm textures) that animate or evolve. Prefer Physarum agent transport networks when you want branching network paths, noise-based procedural textures when you need direct per-pixel evaluation without a simulation state, and Stable Fluids when the pattern should advect with flow.
Field marks
- Parameter space is narrow; most (f,k) values give a flat or dead field
- Pattern is resolution dependent: features scale with the grid and Da/Db
- Explicit stencil requires small dt to stay stable
- On meshes with uneven triangles, patterns stretch and have visible seams in UV space
Presets
Analytic reaction-diffusion look (no simulation)
{
"SCALE": 9,
"WARP": 0.55,
"EDGE": 0.18
}Show GLSL (30 lines)
// GLSL ES 3.0 - analytic Turing-pattern look (no buffers); written for this index
const float SCALE = 9.0; // pattern frequency
const float WARP = 0.55; // domain-warp strength
const float EDGE = 0.18; // softness of the spot/stripe edge
const vec3 COL_A = vec3(0.04, 0.07, 0.16);
const vec3 COL_B = vec3(0.95, 0.80, 0.45);
float waves(vec2 p, float t) {
float s = 0.0;
for (int i = 0; i < 6; i++) {
float a = 6.2831853 * float(i) / 6.0 + 0.3 * sin(t * 0.2 + float(i));
s += cos(dot(p, vec2(cos(a), sin(a))) + 1.7 * float(i));
}
return s / 3.0;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec2 p = uv * SCALE;
float t = iTime;
p += WARP * vec2(sin(p.y * 0.7 + t * 0.3), cos(p.x * 0.7 - t * 0.25));
float v = waves(p, t);
v += 0.35 * waves(p * 2.1 + 3.0, t);
float m = smoothstep(-EDGE, EDGE, v);
float rim = exp(-pow(v / 0.35, 2.0));
vec3 col = mix(COL_A, COL_B, m);
col += 0.25 * rim * vec3(0.3, 0.5, 0.7);
fragColor = vec4(col, 1.0);
}
Attribution: written for this index; an analytic approximation of the look, not a simulation
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| turing-pattern-look | Tesla T4 1920x1080 | 3.11× baseline (light) · 0.102 ms / 0.106 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| turing-pattern-look | NVIDIA L4 1920x1080 | 2.73× baseline (light) · 0.043 ms / 0.044 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| turing-pattern-look | NVIDIA A100-SXM4-40GB 1920x1080 | 1.98× baseline (feather) · 0.057 ms / 0.057 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Tiger-bush drylands: Semi-arid biomes with the banded, spotted and maze-like vegetation patterns real drylands show. A reaction-diffusion field with a downhill drift decides where plants can survive, and an ecosystem simulation fills those patches with individual species.
Sources
- primaryJohn E. Pearson (1993). Complex Patterns in a Simple System. Science.Verified via crossref · 2026-11-29doi:10.1126/science.261.5118.189
- primaryGreg Turk (1991). Generating textures on arbitrary surfaces using reaction-diffusion. Proceedings of the 18th annual conference on Computer graphics and interactive techniques.Verified via crossref · 2026-11-29doi:10.1145/122718.122749
- primaryAndrew Witkin, Michael Kass (1991). Reaction-diffusion textures. Proceedings of the 18th annual conference on Computer graphics and interactive techniques.Verified via crossref · 2026-11-29doi:10.1145/122718.122750