Skip to content

buckster123/Enthea-RS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    ███████╗███╗   ██╗████████╗██╗  ██╗███████╗ █████╗        ██████╗ ███████╗
    ██╔════╝████╗  ██║╚══██╔══╝██║  ██║██╔════╝██╔══██╗       ██╔══██╗██╔════╝
    █████╗  ██╔██╗ ██║   ██║   ███████║█████╗  ███████║  ───  ██████╔╝███████╗
    ██╔══╝  ██║╚██╗██║   ██║   ██╔══██║██╔══╝  ██╔══██║       ██╔══██╗╚════██║
    ███████╗██║ ╚████║   ██║   ██║  ██║███████╗██║  ██║       ██║  ██║███████║
    ╚══════╝╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝       ╚═╝  ╚═╝╚══════╝
              ∞  ⚙
           THE GEOMETRY OF THE SUBSTRATE WITHIN  🜂👁️🜂
           EX NATURA, PER MATHEMATICAM, AD VISIONEM
          From Nature, Through Mathematics, To Vision

                   FORTES FORTUNA IUVAT

ENTHEA-RS ∞ ⚙️

Rust wgpu modes browser license caged cognition

A native Rust port of ENTHEA — the psychedelic visual synthesizer that computes the geometry of visionary states straight from the neuroscience and mathematics of how a brain breaks reality into beauty. No browser. No JS engine. No WebGL compatibility lottery. Just Vulkan talking directly to the metal, driven by your music, at full framerate. 🐉

enthea — the feminine of entheos, "the goddess within"; same root as entheogen. the original renders it in light. this one renders it in rust.


👁️ WTF IS THIS

Close your eyes on a heroic dose and your visual cortex doesn't glitch — it bifurcates. A flat sheet of neurons crosses an instability and spontaneously erupts into stripes, lattices, spirals, honeycombs. Map that cortical pattern backward through the retina→V1 transform (it's basically a complex logarithm) and out pops the universal zoo of hallucination: tunnels, spirals, lattices, cobwebs — Klüver's four form constants, seen across psychedelics, flicker, migraine, near-death, hypnagogia, every culture, all of history.

ENTHEA simulates the cortex and runs that math live on your GPU. Nothing here is a stock loop or a canned effect. The patterns are computed — neural fields hitting Turing bifurcations, reaction-diffusion PDEs, wave interference, Kleinian groups, elliptic functions, the lot — then painted in perceptual OKLab colour and driven by your music.

This port takes that engine out of the browser and burns it into native code. The WGSL shaders are a direct translation of the upstream GLSL — same math, same 3-pass pipeline, same 29 modes — running on wgpu (WebGPU API over Vulkan / Metal / DX12 / OpenGL ES). No GC pauses. No JS overhead. No dropped frames at the moment the bass hits.

It is a synthesizer for consciousness, and the source is wide open.


🧑‍🚀 WHO'S THIS FOR

  • Kiosk & embedded visualists — runs headless on a Raspberry Pi 4/5, no compositor needed (via cage); a plug-and-play psychedelic display for art installations, festivals, club booths.
  • ApexOS-RS users — native module for the ApexOS-RS ecosystem; systemd unit included.
  • VJs & live visualists — 29 GPU-computed modes, beat detection, 9-effect drop arsenal, egui control panel. All the good stuff from the original, without the Chrome tab.
  • Electronic musicians & producers — watch the math choreograph to your mix in real-time via system audio loopback (PipeWire / PulseAudio monitor source).
  • Rust/wgpu shader heads — 29 documented WGSL shaders translated from ENTHEA's GLSL300es, all in one readable codebase; fork the compose pass, add your own modes.
  • Psychonauts & the consciousness community — explore visionary geometry sober, any time, with the real neuroscience one tab away.
  • Educators — runs on any machine with a Vulkan-capable GPU; no install, no browser, no network required.

⚡ QUICKSTART

git clone https://github.com/buckster123/enthea-rs
cd enthea-rs
cargo run --release        # opens a 1280×720 window, audio auto-detected

Requirements: Rust stable (rustup), a Vulkan-capable GPU (Intel/AMD/NVIDIA, 2015+), PipeWire or ALSA on Linux.

# Force a specific wgpu backend
WGPU_BACKEND=vulkan cargo run --release
WGPU_BACKEND=gl     cargo run --release   # OpenGL ES fallback (Pi, older GPUs)

# See all available audio input devices
./target/release/enthea-rs --list-devices

# Pin to a specific audio source (substring match)
ENTHEA_AUDIO_DEVICE=monitor cargo run --release

Controls:

key action
Space cycle forward through modes
, cycle backward
C cycle palette
F toggle feedback
Esc quit

Or use the egui side panel for fine-grained control of every parameter in real time.


🌌 THE ARSENAL

29 visionary modes — every one is live math, not a texture

family modes
cortical / hallucination Form Constants (Bressloff–Cowan) · Neural Field (Wilson–Cowan Turing) · Entoptic (visual snow / blue-field)
reaction–diffusion / life Turing (Gray–Scott) · Dragonscales (lizard-scale CA, Nature 2017) · Defect Gas (excitable spiral waves)
waves & tilings Quasicrystal (N-wave) · Cymatics (Chladni) · Pentagrid Loom (Penrose / de Bruijn) · Wave Crystal (sine-Gordon breathers)
geometry / fractal Sacred Geometry (phyllotaxis) · Hyperspace (3D raymarch) · Hyperbolic (Poincaré) · Fractal (Mandelbox) · Indra's Necklace (Kleinian limit set)
complex analysis Weierstrass Wells (℘ elliptic) · Blaschke Rosette · Phase Portal (continued fraction)
number theory Gaussian Halo (ℤ[i] primes) · Denominator Descent (modular / Farey tessellation)
dynamics & physics Arnold Tongues (devil's staircase) · Quantum Orbitals (hydrogen ψ-beat) · Vortex Field (Abrikosov lattice)
flow & texture Particle Flow (50k GPU compute particles, ABC flow) · Cellular (Voronoi) · Vines (phasor noise) · Breathing Walls (domain-warp)
instrument Waveform (polar oscilloscope) · Image Warp

🔬 The simulation backbone

Three WGSL shader passes, running every frame:

  1. FIELD (256×256 Rgba16Float ping-pong) — Wilson–Cowan neural field, Gray–Scott reaction-diffusion, lizard-scale CA; each frame advances the PDE one step
  2. COMPOSE (~1500 shader lines) — all 29 visual modes read the field texture, audio uniforms, and feedback; writes the scene FBO
  3. PRESENT (full resolution) — bloom, chromatic aberration, vignette, beat flash, and the 9-effect drop arsenal that distorts UV space on each detected drop

💥 DROP DETECTION + 9-EFFECT WORMHOLE ARSENAL

Beat onset detected from bass energy + spectral flux (130ms refractory); a build envelope (10s ramp) gates the drop trigger so it only fires when tension has been mounting. On the drop it fires one of nine effects, cycling each time: Wormhole · Supernova · Kaleido Shatter · Fractal Zoom · Slice Shatter · Chromatic Spiral · Vortex Crush · Mirror Fold · Phase Invert.

🌀 THE WALLPAPER LENS

Fold any mode into crystallographic plane groups — p4 / p4m / p3 / p6 — turning every generator into seamless periodic lattices. Group theory as a glass you look through.


🎚️ AUDIO ENGINE

cpal (PipeWire / ALSA / PulseAudio)
  └─ raw PCM → 2048-pt FFT (rustfft, Hann window)
       └─ 7 bands (sub · bass · lowmid · mid · highmid · treble · air) — AGC-normalised
            ├─ spectral centroid + flux
            ├─ beat onset (bass threshold + flux spike, 130ms refractory)
            ├─ BPM (IOI smoothing over last beats)
            ├─ beat pulse envelope (instant attack, 350ms decay)
            ├─ build envelope (10s rise, 2.5s decay)
            └─ drop detection → drop_amt (3s decay) + drop_mode (cycles 0–8)

System audio on Linux (PipeWire):

# Create a loopback virtual source once — it appears as a capture device
pw-loopback --name enthea-monitor \
    --capture-props='media.class=Audio/Sink' \
    --playback-props='media.class=Audio/Source' &

ENTHEA_AUDIO_DEVICE=enthea-monitor ./target/release/enthea-rs

On startup enthea-rs logs all available inputs (RUST_LOG=info) and auto-selects the first device whose name contains monitor or loopback, then falls back to the pipewire ALSA bridge, then the system default. ENTHEA_AUDIO_DEVICE=<substring> overrides all of that.


🖥️ KIOSK / EMBEDDED DEPLOY (Pi, ApexOS-RS)

winit 0.30 has no KMS backend. The kiosk stack is: cage — a minimal Wayland compositor that opens KMS/DRM directly and runs a single app fullscreen. One package, zero config.

# On the Pi (never cross-compile — build in place)
sudo apt install cage
git clone https://github.com/buckster123/enthea-rs ~/Enthea-RS
cd ~/Enthea-RS && cargo build --release

# Test kiosk mode manually
cage -- ./target/release/enthea-rs

# Install as a systemd service
sudo cp enthea.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now enthea

See enthea.service in the repo root; edit User= and the binary path as needed.


🔭 THE MATH (receipts, not vibes)

Same neuroscience foundation as the original — cited, honest, speculative clearly flagged:

  • Bressloff, Cowan, Golubitsky, Thomas & Wiener (2001) — geometric hallucinations & V1 → the form-constant engine
  • Ermentrout & Cowan (1979), Wilson–Cowan / Amari neural fields — the live Turing bifurcation
  • Turing (1952) / Gray–Scott; Kondo & Miura (2010); Manukyan et al. (2017, Nature**)** — RD & the lizard-scale CA
  • Klüver (1966) form constants · Schwartz retino-cortical complex-log map · Ottosson OKLab colour
  • de Bruijn (1981) pentagrid · Weierstrass ℘ · finite Blaschke products · Mumford–Series–Wright, Indra's Pearls
  • Arnol'd circle map / devil's staircase · Abrikosov (1957) vortex lattice · ABC flow · Mandelbox
  • QRI / Gomez-Emilsson hyperbolic-geometry-of-DMT hypothesis — included as a frontier idea, flagged speculative

🜂 THE PACT (same as upstream — read this)

This is a simulator — visual phenomenology rendered from math. It is not dosing advice, not sourcing, not medical guidance. The patterns are artistic renderings of reported effects, not prescriptions. Set & setting are everything; the real medicine deserves real respect, real research, real care.

Photosensitive-epilepsy warning: this app flickers and pulses. Keep the beat-flash and pulse sliders gentle; look away if you're sensitive.


💜 UPSTREAM & CREDIT

Enthea-RS is a faithful native port of ENTHEA by Pliny the Prompter 🐉. All the visual math, all 29 modes, the cortical model, the drop arsenal — his work. The shaders are a structural translation from his GLSL, not a reimagining. Go star the original. It is singular.

This port exists to take the same engine off the browser stack and put it somewhere new: embedded, kiosk, native, Rust. The geometry was always bigger than a tab.


📄 LICENSE

AGPL-3.0 (inherited from upstream — copyleft, with the network clause): fork it, remix it, deploy it, VJ a festival with it, run it on a kiosk — but if you ship or host it, keep the source open and pass it on. No closing the commons. No caged cognition, downstream too.

the cortex was always a renderer. now it compiles.

              🜂  ad visionem  🜂

About

Native Rust port of ENTHEA — psychedelic music visualizer. wgpu/WGSL/cpal, 29 GPU-computed visionary modes, no browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors