{
 "id": "gray-scott-reaction-diffusion",
 "title": "Gray-Scott reaction-diffusion",
 "aliases": [
  "Turing patterns",
  "Gray-Scott"
 ],
 "domain": "simulation",
 "subdomain": "pattern formation",
 "stage": "simulation",
 "realtime": "interactive",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "cpu"
 ],
 "year_introduced": 1993,
 "inputs": [
  "texture"
 ],
 "outputs": [
  "texture",
  "heightfield"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "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.",
 "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_use": "Choose it when you want organic, self-organising patterns (animal coats, coral, cracks of paint, worm textures) that animate or evolve. Prefer `physarum-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.",
 "cost": {
  "class": "cheap",
  "notes": "Cheap on a 512^2 grid but needs several substeps per frame."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1126/science.261.5118.189",
   "type": "paper",
   "title": "Complex Patterns in a Simple System",
   "authors": [
    "John E. Pearson"
   ],
   "year": 1993,
   "venue": "Science",
   "url": "https://doi.org/10.1126/science.261.5118.189",
   "ids": {
    "doi": "10.1126/science.261.5118.189"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1126/science.261.5118.189",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1126/science.261.5118.189",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1126/science.261.5118.189",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1126/science.261.5118.189",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1126/science.261.5118.189",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "pearson1993complex"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/122718.122749",
   "type": "paper",
   "title": "Generating textures on arbitrary surfaces using reaction-diffusion",
   "authors": [
    "Greg Turk"
   ],
   "year": 1991,
   "venue": "Proceedings of the 18th annual conference on Computer graphics and interactive techniques",
   "url": "https://doi.org/10.1145/122718.122749",
   "ids": {
    "doi": "10.1145/122718.122749"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122749",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122749",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122749",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122749",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122749",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "turk1991generating"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/122718.122750",
   "type": "paper",
   "title": "Reaction-diffusion textures",
   "authors": [
    "Andrew Witkin",
    "Michael Kass"
   ],
   "year": 1991,
   "venue": "Proceedings of the 18th annual conference on Computer graphics and interactive techniques",
   "url": "https://doi.org/10.1145/122718.122750",
   "ids": {
    "doi": "10.1145/122718.122750"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122750",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122750",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122750",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122750",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/122718.122750",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "witkin1991reaction"
  },
  {
   "role": "tutorial",
   "key": "url:https://www.karlsims.com/rd.html",
   "type": "tutorial",
   "title": "Reaction-Diffusion Tutorial",
   "authors": [
    "Karl Sims"
   ],
   "year": null,
   "venue": "karlsims.com",
   "url": "https://www.karlsims.com/rd.html",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261030072101/https://www.karlsims.com/rd.html",
     "timestamp": "20261030072101"
    },
    "page_title": "Reaction-Diffusion Tutorial",
    "host": "karlsims.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://www.karlsims.com/rd.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://www.karlsims.com/rd.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://www.karlsims.com/rd.html → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "simsreaction"
  }
 ],
 "presets": [
  {
   "id": "turing-pattern-look",
   "title": "Analytic reaction-diffusion look (no simulation)",
   "runtime": "glsl-fragment",
   "params": {
    "SCALE": 9,
    "WARP": 0.55,
    "EDGE": 0.18
   },
   "code": "// GLSL ES 3.0 - analytic Turing-pattern look (no buffers); written for this index\nconst float SCALE = 9.0;     // pattern frequency\nconst float WARP = 0.55;     // domain-warp strength\nconst float EDGE = 0.18;     // softness of the spot/stripe edge\nconst vec3 COL_A = vec3(0.04, 0.07, 0.16);\nconst vec3 COL_B = vec3(0.95, 0.80, 0.45);\n\nfloat waves(vec2 p, float t) {\n  float s = 0.0;\n  for (int i = 0; i < 6; i++) {\n    float a = 6.2831853 * float(i) / 6.0 + 0.3 * sin(t * 0.2 + float(i));\n    s += cos(dot(p, vec2(cos(a), sin(a))) + 1.7 * float(i));\n  }\n  return s / 3.0;\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  vec2 p = uv * SCALE;\n  float t = iTime;\n  p += WARP * vec2(sin(p.y * 0.7 + t * 0.3), cos(p.x * 0.7 - t * 0.25));\n  float v = waves(p, t);\n  v += 0.35 * waves(p * 2.1 + 3.0, t);\n  float m = smoothstep(-EDGE, EDGE, v);\n  float rim = exp(-pow(v / 0.35, 2.0));\n  vec3 col = mix(COL_A, COL_B, m);\n  col += 0.25 * rim * vec3(0.3, 0.5, 0.7);\n  fragColor = vec4(col, 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index; an analytic approximation of the look, not a simulation",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "gray-scott-reaction-diffusion",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4565,
      "std": 0.3521,
      "unique_colors": 77
     },
     "image": "/specimens/turing-pattern-look.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "physarum-transport-networks",
  "stable-fluids",
  "lattice-boltzmann-fluids"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/simulation/gray-scott-reaction-diffusion.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Pearson, 1993",
 "url": "https://texelatlas.vercel.app/t/gray-scott-reaction-diffusion/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 3.11,
  "tier": "light",
  "p50_ms": 0.1022,
  "p95_ms": 0.1056,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "turing-pattern-look",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 2.73,
   "tier": "light",
   "p50_ms": 0.0434,
   "p95_ms": 0.0441,
   "speedup_x": 2.35,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 1.98,
   "tier": "feather",
   "p50_ms": 0.0569,
   "p95_ms": 0.0569,
   "speedup_x": 1.8,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}