Ego Death — mathematically-generated, no-AI WebGPU perceptual instrument: a fractal feedback fever-dream with image-driven world regeneration.
  • TypeScript 56.2%
  • WGSL 26.9%
  • HTML 11.3%
  • JavaScript 5.6%
Find a file
Sponge 999ddc537d
All checks were successful
deploy / deploy (push) Successful in 2m30s
Merge develop → main: rework tunnel into explicit log-polar tunnel
2026-06-22 17:31:07 -07:00
.forgejo/workflows Add Forgejo Actions deploy workflow → egodeath.git.unityailab.com 2026-06-22 01:19:53 -07:00
docs Rework tunnel mode into an explicit log-polar tunnel that actually reads 2026-06-22 17:30:56 -07:00
public Add social/Open-Graph metadata + preview image (og.jpg) 2026-06-22 01:34:27 -07:00
src Rework tunnel mode into an explicit log-polar tunnel that actually reads 2026-06-22 17:30:56 -07:00
tools Mathematical image-template analyzer (344 templates) + kaleidoscope-comes-and-goes 2026-06-22 00:24:15 -07:00
.gitignore Scaffold Ego Death: WebGPU perceptual field core 2026-06-20 22:54:37 -07:00
index.html Add an infinite-zoom tunnel mode (checkbox + speed slider) 2026-06-22 16:52:49 -07:00
package-lock.json Mathematical image-template analyzer (344 templates) + kaleidoscope-comes-and-goes 2026-06-22 00:24:15 -07:00
package.json Mathematical image-template analyzer (344 templates) + kaleidoscope-comes-and-goes 2026-06-22 00:24:15 -07:00
README.md Add an infinite-zoom tunnel mode (checkbox + speed slider) 2026-06-22 16:52:49 -07:00
tsconfig.json Wire 344 image templates into the engine: color + structure + composition regeneration 2026-06-22 00:48:21 -07:00
vite.config.ts Scaffold Ego Death: WebGPU perceptual field core 2026-06-20 22:54:37 -07:00

Ego Death

A mathematically-generated, GPU-driven perceptual instrument that runs entirely in the browser. No AI model anywhere in the render path. The core is a stateful, stochastic reaction-diffusion field computed on the fly every frame — not a closed-form animation — so what it grows is genuinely emergent, never repeats, and diverges between sessions and viewers.

A fractal feedback-recursion fever dream. The plane folds through dimensions, fractal structure blooms and recurses, the last three frames echo through each other, and the color cycles bright and vivid.

How it works

Stage What it does How
Generator Living content that never repeats Gray-Scott reaction-diffusion (spatially-varying regimes + live stochastic injection + physics-seeded sparks), ping-pong compute pass
Dimensional fold 2D→3D→4D→3D→2D, fractal self-similarity Lift the plane into 4D, rotate through the planes, KIFS-fold (abs-fold + rotate + scale), project back — a choreographed dimPhase drives the fold through dimensions
Pattern bank A cycling library of distinct math worlds Crossfades through Mandelbrot · Julia · Newton · Burning Ship · Multibrot · Moiré · golden/silver quasiperiodic (≈Penrose aperiodic) · hyperbolic Poincaré-disk · Hermann-grid/DoG · Kitaoka drift · Gray-Scott · Tricorn · Phoenix · Mandelbulb (3D ray-march) · Tesseract (4D polytope) · Penrose tiling (de Bruijn pentagrid) · Lorenz attractor + IFS chaos game (GPU particle-splat density) · 24-cell (4D polytope) · hyperbolic triangle-group tiling — golden↔silver ratio alternation drives the frequencies
Impossible-triangle weave Tiled Penrose tribars folded INTO the field SDF tessellation with cyclic corner occlusion (the intransitive trick), injected into the folded feedback content so it melts/recurses/recolors with the trip; presence via per-pixel temporal dither
Compute accumulation 3D chaotic flow & fractal dust 65k particle threads per attractor atomic-splat into a density buffer (cleared each frame; trails from the feedback engine)
Feedback engine Morphing, recursing, melting — with depth A 1280² ring holds the last 3 frames; each is sampled with its own offset/rotation (temporal echoes) and lighten-blended (keeps colors neon, no pastel washout) with fresh content + hue-drift
Infinite-zoom tunnel Optional forward tunnel travel A constant inward recursion zoom (pow(0.82, speed·dt), dt-scaled) so detail blooms out of the center dot and flies past — endlessly recursive via the feedback wrap; every other setting shapes the rushing walls. Toggle + 0.15.0 speed
Bright grade Vivid, bright, ever-shifting color Global animated hue rotation + strong saturation + brightness (no CRT/VHS)
Living motion Structures seeded & stirred with momentum Oimo.js rigid-body attractors disturb the generator where they pass; Anime.js drives the arc, fold, Julia morph, and glitch breaks
Sonification (OSLO) The worlds sing their own math Pure Web Audio generative synthesis driven by the SAME template + field as the visuals — a drone bed (color → EQ), a pluck sequencer (edge-density → tempo + note density, dominant-angle + attractor → pitch), echo (field decay → feedback), and injection transients. No samples, no AI. Opt-in, off by default.

Safety (non-negotiable)

This deliberately stimulates the visual system, so a photosensitive-epilepsy governor is built in and cannot be silently bypassed:

  • Every temporal rate (fold/feedback drift, dot-orbit, grain flicker) derives from a hard flickerCapHz, well under the WCAG 2.3.1 3-flash/second threshold; feedback decay < 1 (no runaway), and hue cycling is chroma, not luminance flicker.
  • prefers-reduced-motion respected; an explicit "gentle mode" lowers motion and grain further.
  • Soft tone-mapping + dither (no hard clipping).
  • An explicit informed-consent gate guards entry. A two-section modal spells out (1) the liability disclaimer + the medical conditions for which you should consult a professional and not proceed (epilepsy/photosensitive seizures, migraine-with-aura, schizophrenia/psychosis, dissociative disorders, severe anxiety/panic/PTSD, heart conditions, …), and (2) the effects it may induce — with or without substances — up to and including ego dissolution. The enter button stays disabled until you tick an explicit acceptance box. Esc exits at any time.
  • After acceptance, a real preloader initializes the GPU, compiles every pipeline, uploads the atlas, and waits on queue.onSubmittedWorkDone() for the first full frame before revealing anything — no flash of half-built output.

If you have epilepsy, photosensitive seizures, or migraine-with-aura, do not use this.

Run it

npm install
npm run dev      # http://localhost:5173
npm run build    # typecheck + production bundle to dist/

Requires a WebGPU-capable browser (current Chrome/Edge; Firefox/Safari with WebGPU enabled).

Controls

  • The field evolves on its own — it is not mouse-steerable. Soft-focus the whole screen and let your eyes roam.
  • Intensity slider — overall strength (safety-clamped).
  • focal — toggle the center focal-point distortion (zoom/radial warp) on/off.
  • randomize — randomized, non-looping segment + world transitions (off = sequential loop).
  • ⚙ settings — expanded panel. Up top, one-click presetsDefault · DMT · Acid · Dream — drop the whole panel into a vibe (they set the visual + sound character but never the master sound on/off or the gentle/reduced-motion toggle, so a preset can't override your accessibility/safety choice). Below: drag-to-pan viewpoint, focal distortion, infinite-zoom tunnel + zoom speed, mirror X/Y (propagating), kaleidoscope, randomize, glitch, image color/structure drive, saturation, hue speed, melt, sound (sonify, volume, bass, space, drone bed, panning), gentle.
  • sound — opt-in: the worlds sonify their own math (off by default; starts only on your click). Dials: volume, bass (sub-octave low end), space (reverb/air), drone bed (sustained pad), panning (plucks placed by edge motion).
  • Space — pause (holds the field, fades the sound) · Esc — exit.

Stack

Raw WebGPU + WGSL + TypeScript, three passes (reaction-diffusion compute generator → feedback-recursion → bright color grade). Oimo.js seeds/stirs the generator (physics, not rendered geometry); Anime.js drives the arc, the dimensional fold, the pattern cycle, and glitch breaks. The OSLO sonification layer (src/audio/sonify.ts) is pure Web Audio generative synthesis (drone bed + pluck sequencer + echo) — no samples, no inference. Vite as dev server / bundler. No inference runtime — both the render path and the sound are pure math.

Image-derived templates (the math, not the images)

tools/scan-images.mjs scans a folder of images and emits one mathematical template per image to src/imagery.json — dominant color palette, luminance-density aggregation (stats + 16-bin histogram + a 16×16 composition fingerprint), and Sobel edge-orientation vectors. Videos/gifs and (heuristically) text/emoji images are skipped. The raw images are never shipped; the engine uses the math to regenerate fractalized renditions as emergent influences (color, structure-seeding, parameter modulation).

node tools/scan-images.mjs /path/to/images   # → src/imagery.json

Sound — the Master Audio Equation (OSLO)

The optional sonification layer makes the worlds sing their own math — pure Web Audio generative synthesis (no samples, no AI), driven by the same template + field that paint the screen. It implements OSLO's spec: the image and the sound share one source. Per frame, from the coverage-weighted palette: brightness B, warmth W, saturation S; plus edge density E, dominant angle θ, contrast C from the template, and intensity / rotSpeed / decay / dimPhase / structDrive / pattern index / lead attractor from the field.

  • Music frame — the active scale is SCALES[p mod 5], the root r₀ = 12 + round((½sinΦ+½)·7) drifts the key slowly with the dimensional fold, and the dominant edge angle picks a scale degree .
  • color → tone / EQhighShelf = 6 + 16B, lowShelf = 11·clamp₀₁(0.6(1B)+max(0,W)), lowpass f_cut = 500 + 4200B + 1200I, resonance Q = 0.6 + 2S.
  • structure → drone bed — three sines (root/5th/octave), level A = 0.04 + 0.12(½σ+½C), detune 30ρ + 4(k1)¢.
  • line-vectoring → tempo + notes — step time Δt = 0.5 0.38·clamp₀₁(0.6E+0.5I); each step fires with probability 0.4 + 0.55E, pitch n = r₀ + Σ[d] + o (octave from the attractor), amplitude 0.06 + 0.26E, release τ = 0.18 + 1.12E (the vector-fadeout decay).
  • field decay → echodelay = 0.36 s, feedback = 0.28 + 0.42δ; stochastic injection → noise transients (bandpass @1700 Hz).

Chain: (drone + plucks + echo) → LPF[f_cut,Q] → lowShelf → highShelf → master → limiter. On top of the spec, four math-driven dials: bass (a sub an octave below the root), space (a reverb send for air/fidelity), drone bed (gates + fattens the sustained pad), and panning (plucks placed in the stereo field by the lead attractor — the geometry moving around your head).

Audio is opt-in (off by default); the AudioContext only ever starts inside a user gesture. The step tempo and all glides are rate-capped, reduced-motion slows the tempo + lowers levels + drops the noise transients, a brick-wall limiter guarantees a hard output ceiling, and the sound fades out with pause / tab-hide.

Deploy (Forgejo Actions → Forgejo Pages)

.forgejo/workflows/deploy.yml builds on every push to main and rsyncs dist/ to the lab's Forgejo Pages dir, serving it at https://egodeath.git.unityailab.com (generic wildcard vhost on the OVH edge — zero per-repo server setup). Uses the org-level PAGES_DEPLOY_KEY/HOST/USER secrets (rrsync-confined to /var/www/pages). Requires Actions enabled on the repo + the self-hosted unity-act:24.04 runner.

Social preview

index.html carries Open Graph + Twitter Card metadata (image public/og.jpg, 1200×630), so posting https://egodeath.git.unityailab.com/ unfurls a preview image + description on social platforms.