Reaction-Diffusion Textures (Turk)
Simulate two interacting chemicals that diffuse at different rates to produce spots, stripes, labyrinths and other organic patterns, either in texture space or directly over a mesh surface.
Also known as Gray-Scott, Turing patterns, reaction-diffusion
In the family Procedural generation, pattern synthesis
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 reaction-diffusion texture generator. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Two scalar fields A and B evolve by dA/dt = Dalaplacian(A) - AB^2 + f(1-A) and dB/dt = Dblaplacian(B) + AB^2 - (k+f)B (Gray-Scott), where diffusion rates differ and feed f and kill k select the pattern regime: spots, worms, mazes, solitons. Turk's contribution is running the simulation on arbitrary surfaces: generate a uniform point mesh over the surface, compute Laplacians in that mesh, and render the chemical concentration as a texture, so patterns follow the geometry without UV distortion. Alternatively, the simulation runs on a 2D grid in texture space, as ping-pong render targets in a fragment shader. Anisotropic diffusion or spatially varying f and k create stripes oriented along a direction field or patterns that change across a surface.
When to choose it
Reach for it when
- want organic bump or colour maps like animal skin
- need coral, spots and labyrinth textures on a mesh
- emergent growth patterns rather than noise
- pattern should flow across a surface without uv seams
Choose it for animal-coat patterns, corals, organic bump or colour maps and growth effects that should feel emergent. Prefer Domain Warping for cheaper swirled textures without simulation, Perlin Noise (gradient lattice noise) family for stateless patterns, and Wang Tiles (Aperiodic Tile Synthesis) when you need tileable texture synthesis from a source.
Field marks
- Pattern depends on seed and parameters in a narrow regime: slightly off f,k values die out to a flat field or blow up
- Texture-space simulation shows distortion and seams on UV-mapped meshes
- Time step too large makes explicit Euler integration unstable (checkerboard or NaNs)
- Result is not tileable unless the grid wraps
- Mesh-based versions need uniformly sampled vertices; irregular meshes produce directional artifacts
Presets
Toy Turing-pattern look (plane-wave approximation, not a simulation)
{
"WAVES": 6,
"WAVELENGTH": 0.07,
"BLEND": 0.6
}Show GLSL (23 lines)
// Toy: Turing-style spots/stripes/labyrinth via superposed plane waves at one wavelength (the linear-regime look of reaction-diffusion), not a simulation.
const int WAVES = 6;
const float WAVELENGTH = 0.07;
const float BLEND = 0.6; // 0 = spots-like, 1 = labyrinth-like threshold shift
float h(float n) { return fract(sin(n * 91.345) * 43758.5453); }
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution.xy;
vec2 p = uv + 0.03 * vec2(sin(uv.y * 9.0 + iTime * 0.2), cos(uv.x * 8.0));
float s = 0.0;
for (int i = 0; i < WAVES; i++) {
float a = 3.14159 * (float(i) + 0.3 * h(float(i))) / float(WAVES);
vec2 k = vec2(cos(a), sin(a)) * 6.2831 / WAVELENGTH;
s += cos(dot(k, p) + 6.2831 * h(float(i) + 3.0));
}
s /= float(WAVES) * 0.5;
// regime sweep: top of the image has spots (offset threshold), bottom has stripes/labyrinth
float thr = mix(0.9, 0.0, smoothstep(0.1, 0.9, uv.y) * BLEND + (1.0 - BLEND) * 0.0 + 0.4 * smoothstep(0.1, 0.9, uv.y));
float u = smoothstep(thr - 0.12, thr + 0.12, s);
vec3 col = mix(vec3(0.95, 0.9, 0.75), vec3(0.12, 0.1, 0.3), u);
col = mix(col, vec3(0.8, 0.3, 0.2), smoothstep(0.15, 0.0, abs(s - thr)) * 0.5);
fragColor = vec4(pow(col, vec3(0.8)), 1.0);
}
Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| reaction-diffusion-textures-specimen | Tesla T4 1920x1080 | 1.92× baseline (feather) · 0.063 ms / 0.065 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| reaction-diffusion-textures-specimen | NVIDIA L4 1920x1080 | 1.42× baseline (feather) · 0.023 ms / 0.023 ms · 2.8× faster on L4 | opengl-timer-query · Cross-architecture validation |
| reaction-diffusion-textures-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 1.08× baseline (feather) · 0.031 ms / 0.031 ms · 2.0× faster on A100 | opengl-timer-query · Cross-architecture validation |
Sources
- 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