A glass dish of living coral patterns in raw WebGL2: a real GPU reaction-diffusion solver, relief shading, live seeding and regime changes.

A glass dish of living coral patterns in raw WebGL2: a real GPU reaction-diffusion solver, relief shading, live seeding and regime changes.
coveragePct sits between 5% and 65% (visible pattern, not blank or solid), and performance.getEntriesByType("resource").length === 0.coveragePct by at least +12 percentage points with zero NaN pixels.bloomsSeeded by 1.regimeSwitches by 1 and produces a measurable spatial variance / coverage shift over 4 s without wiping the dish flat to 0%.regimeSwitches >= 2), seeds >= 1 bloom, keeps coveragePct healthy (8%–85%), and logs zero console errors.TURING REEF: Living Reaction-Diffusion Coral Dish
HOOK OBJECT: window.__turing
Build "TURING REEF": a macro laboratory glass petri dish in raw WebGL2 and GLSL (no Three.js, no libraries) where a real GPU Gray-Scott reaction-diffusion simulation grows living 3D-shaded coral labyrinths, dividing mitosis spots, pulsing solitons and zebra ridges across a 256 x 256 chemical field. Changing the two chemical rates (feed f, kill k) reorganizes the entire living colony right before your eyes.
LOOK
- Style: backlit marine-biology studio macro shot, palette deep lab slate #070C14, glass rim #9ECAE1, substrate indigo #0E233A, coral ridge teal #1ED6C1, warm polyp coral #FF6B5B, bright crest ivory #FFF4DC.
- Subject: a centered circular glass petri dish with subtle refractive rim sheen filling at least 74% of the screen height, rendering the live GPU Gray-Scott `B` concentration field with normal-mapped 3D height relief, specular wet sheen, and organic color grading, plus a compact parameter readout and 4 regime buttons outside the dish.
- FIRST FRAME (t = 0, no input): the petri dish fills 74%+ of screen height with an already-sprouting coral colony (pre-stepped 240 PDE iterations from seed 360 so crisp ridges are immediately visible at t = 0, never a blank disc).
MOTION / PLAY
- Controls: click/drag inside the dish to pipette fresh chemical B seed blooms; keys 1–4 or buttons switch Gray-Scott (f, k) regimes (CORAL 0.0545/0.0620, MITOSIS 0.0367/0.0649, LABYRINTH 0.0290/0.0570, PULSING SPOTS 0.0180/0.0510); W/S and A/D fine-tune f and k live; R reseeds the dish; setCamera(panX, panY, zoom) inspects fine ridge details.
- Real GPU PDE solver: ping-pong floating-point (or RGBA8/half-float fallback) WebGL2 framebuffers running genuine 9-point Laplacian Gray-Scott equations `dA/dt = Da*lapA - A*B^2 + f*(1-A)`, `dB/dt = Db*lapB + A*B^2 - (k+f)*B` at 8–12 PDE steps per animation frame, masked smoothly inside the circular glass dish.
- ATTRACT MODE: with no input, a hands-free 28–30 s growth timelapse runs on load: grows CORAL across the dish, shifts parameters into MITOSIS so spots visibly pinch and divide, drops a pipette bloom in LABYRINTH, and transitions to PULSING SPOTS. Any input takes over; after 8 s idle it resumes.
SOUND
- Pipette chemical drop -> soft liquid glass bloop.
- Regime transition -> warm harmonic swell pitched by feed rate `f`.
- Living colony growth -> subtle organic bubbling marimba clicks whose rate tracks measured colony growth rate (`|dCoverage/dt|`).
COUNTERS
stats() returns { fps, pdeSteps, coveragePct, feedF, killK, regimeSwitches, bloomsSeeded }.
- pdeSteps: exact cumulative count of GPU Gray-Scott PDE passes executed.
- coveragePct: real measured percentage (0–100) of dish pixels where chemical B exceeds threshold 0.22 (read back from the simulation texture).
- regimeSwitches: +1 each time the (f, k) regime switches after load. Never on load.
- bloomsSeeded: +1 each time a pipette seed bloom is injected onto the dish.
- On screen: top-left pill "REGIME <NAME> · COVER NN% · f=0.0NNN k=0.0NNN · STEPS NNNN", never over the dish.
CHECKS for ?test=1
With ?test=1, run an accelerated self-test that measures real positions and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults:
1. First frame & self-contained: petri dish spans at least 70% of screen height, initial `coveragePct` sits between 5% and 65% (visible pattern, not blank or solid), and `performance.getEntriesByType("resource").length === 0`.
2. Genuine PDE growth: advancing 3 s in CORAL regime executes >= 1,200 PDE steps and increases `coveragePct` by at least +12 percentage points with zero NaN pixels.
3. Pipette seeding: dropping a chemical B bloom at an empty dish location increases local B concentration there above 0.40 and increments `bloomsSeeded` by 1.
4. Regime reorganization: switching from CORAL to MITOSIS increments `regimeSwitches` by 1 and produces a measurable spatial variance / coverage shift over 4 s without wiping the dish flat to 0%.
5. Attract showcase: advancing 28 s hands-free visits >= 3 regimes (`regimeSwitches >= 2`), seeds >= 1 bloom, keeps `coveragePct` healthy (8%–85%), and logs zero console errors.
KEEP IT SHORT
- Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes.
- Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs.
BUILD RULES (all required):
- Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}}
- It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps).
- It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height.
- SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "🔊 TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top.
- Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same.
- Every on-screen counter must count a real event you can see happen. No fake numbers.
- No text overlapping the subject; any label must be readable in a paused frame.
- No brand logos, no real people, no copyrighted characters, brand names or logos.
FAILURE MODES TO AVOID
- Faking reaction-diffusion with animated Perlin noise instead of real ping-pong Gray-Scott PDE buffers.
- Relying on unsupported float FBO extensions without checking/falling back so the dish renders solid black.
- Starting from a blank dish at t = 0 with nothing visible until seconds later.
- Chemical B blowing out to 100% solid fill or dying completely to 0% after a regime switch.
- HUD overlapping the petri dish.
- The same variable declared twice, or methods called on objects that don't exist yet.
SELF-TEST LOOP
- If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results.
- If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file.
- Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged".
Built one? Post it on X and tag @wikiwaynePost on X