Skip to content

Repository files navigation

Gray-Scott

Real-time Gray-Scott reaction-diffusion patterns — 100% GPU via WebGPU compute, in your browser.

Labyrinthine patterns from the Default preset

Run it

uv run uvicorn server:app --reload --port 8002

Open http://localhost:8002 in Chrome 113+ (WebGPU required).

Using Gray-Scott

  • 12 presets — spots, solitons, worms, mazes, holes, chaos, waves, U-Skate, and more from Pearson's (F, k) phase diagram.
  • Brush painting — click and drag on the field to seed activator V; brush radius 1–20 cells.
  • Live parameters — F (0.01–0.08) and k (0.03–0.07) sliders, with J/K and H/L keyboard nudges.
  • Speed — 1–64 substeps per frame (default 16).
  • Resolution — 256 / 512 / 1024 cells (default 512).
  • First visit opens an 11-step onboarding tour; replay it anytime via Replay the Tour in the guide.
  • The ? button opens the in-app guide — the full user manual.

Solitons — stable spot patterns Chaos & Holes — turbulent dynamics

Key Action
P Play / pause
M Step one frame while paused
R Reset to current preset
C Clear field
J / K Decrease / increase F by 0.001
H / L Decrease / increase k by 0.0001

Understanding & hacking Gray-Scott

Numbers

Verified against code:

  • 12 presets in static/js/presets.js
  • 11-step tour in static/js/tour.js
  • 1–64 substeps/frame, default 16
  • 256 / 512 / 1024 grid resolution, default 512
  • Du = 0.2097, Dv = 0.105, dt = 1.0
  • Stability ceiling dt ≤ 1/(4·Du) ≈ 1.19
  • Single WGSL compute shader, 8×8 workgroups, four storage buffers ping-pong

Develop

  • npm test — 33/33 Playwright; headed, port 8321, --enable-unsafe-webgpu
  • No build step — vanilla ES modules
  • Dockerfile + DEPLOYMENT.md for shipping

About

Real-time Gray-Scott simulator running on WebGPU compute shaders.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages