<p align="center" <img src="assets/cosmostrix-logo.png" alt="cosmostrix logo" width="260" </p
<h1 align="center"cosmostrix</h1
<p align="center" <strongProfessional-grade cinematic Matrix rain renderer for serious terminal environments.</strong </p
<p align="center" Powered by the Cosmic Dragon diff-based rendering engine — only changed cells are redrawn, not the full screen. </p
<p align="center" <a href="https://ko-fi.com/rezky" <img src="https://img.shields.io/badge/Ko--fi-support-7C3AED?style=flat-square&logo=kofi&logoColor=white&labelColor=111827" alt="Support on Ko-fi" </a </p
Demo
<p align="center" <img src="assets/cosmostrix-v25-demo.gif" alt="cosmostrix v25 demo" width="800" </p
<p align="center" <img src="assets/cosmostrix-v25-demo-binary.png" alt="cosmostrix v25 binary charset demo" width="800" <br <img src="assets/cosmostrix-v25-demo-retro.png" alt="cosmostrix v25 retro charset demo" width="800" <br <img src="assets/cosmostrix-v25-demo-braille.png" alt="cosmostrix v25 braille charset demo" width="800" <br <img src="assets/cosmostrix-v25-demo-hacker.png" alt="cosmostrix v25 hacker charset demo" width="800" <br <img src="assets/cosmostrix-v25-demo-green-retro.png" alt="cosmostrix v25 green retro charset demo" width="800" </p
<p align="center" <a href="https://www.youtube.com/watch?v=KSk-DWFdg3A"YouTube</a </p
Signature Cinematic Cosmic, Monolith Rain, and message mode in a real terminal session.
Architecture — Not Just Matrix Rain
Cosmostrix is not a clone. It uses a novel diff-based rendering engine (the cosmic dragon architecture) that computes only the ~7.5% of cells that change between frames, rather than redrawing the entire screen. This enables cinematic effects — phosphor decay, depth fog, 3-layer parallax, density maps — at 38,000+ FPS while using only 4.7 MiB of RAM and a single CPU core. No GPU. No bloat.
Every other Matrix rain renderer redraws every cell every frame. Cosmostrix keeps a persistent back-buffer, compares each cell against the previous frame, and emits only the ANSI sequences for cells that actually changed. On a typical 120×40 terminal that means ~360 cell-writes per frame instead of 4,800 — a 13× reduction in I/O that compounds with screen size. At 400×200 (80,000 cells), the savings exceed 90%.
The engine is structured as five cooperating subsystems, each profiled and tuned:
- Diff-based cell renderer (frame.rs) — back-buffer comparison, RLE-batched ANSI output, dirty-region tracking. The core innovation.
- 3-layer parallax (cloud/parallax.rs) — far / mid / near layers with independent speed, brightness, length, density, and phosphor-decay multipliers. Three layers is the cinema-standard deep/mid/ground composition; more would collapse perceptually in a 24-row terminal.
- Phosphor persistence (cloud/phosphor.rs) — CRT afterglow with PHOSPHORTAILRESIDUAL=160 + PHOSPHORDECAYRATE=5.0, per-layer decay multipliers, bottom-row 3× acceleration, edge energy cap. Creates ~400 ms afterglow per glyph. Most terminal rain renderers have zero afterglow.
- Density noise & wind gusts (cloud/density.rs, cloud/wind.rs) — Perlin-style density maps for cinematic monolith formations, gust-driven column acceleration for organic motion that never repeats.
- Adaptive atmosphere engine (cloud/atmosphericevents.rs) — 5-phase time-driven modulation that smoothly transitions speed, density, brightness, glitch pressure, and color palette based on local wall-clock time.
Run cosmostrix --docs for the full technical breakdown, or cosmostrix --benchmark for reproducible performance measurements on your own hardware.
Features
- Cinematic terminal rain — calm, organic visual feel with crisp head/body/trail hierarchy and desynchronized column speeds (async mode default ON for organic feel)
- 13 built-in scenes — one-command visual profiles: 3 core atmospheres (cinematic, matrix, monolith), 8 curated scenes (classic, signal, calm, storm, cosmos, neon, hacker, low-power), the cosmicdragon milestone scene commemorating the temporal-prediction breakthrough (dirtyratio 18.33% → 0.39%, FPS 7,843 → 29,773), and the carbonic tribute scene (dense metallic carbon-fiber binary rain honoring the experiment that was reverted for cinematic quality)
- User-defined custom scenes — [scene-custom.<name] blocks in config for persistent personal themes, applied via --scene-custom; supports 12 configurable fields including density-map sculpting for monolith pillar formations
- Adaptive custom time scheduling — adaptive-custom.HH-MM config entries define your own 24-hour time-to-parameter mapping (color, scene, speed, density, FPS, charset, glitch-level) with smoothstep 5-minute blend transitions; overrides the default 5-phase adaptive engine when defined; sticky parameters keep previous values when unspecified; live config reload re-parses immediately on save
- Default adaptive atmosphere engine — 5-phase time-driven modulation (Deep Void → Compression → Pulse → Calm → Signal) that smoothly transitions speed, density, brightness, glitch pressure, and color palette based on local wall-clock time; opt-in via atmosphere-mode = controlled-live
- 43 built-in themes and 24 character sets (--color-tune turns all 43 into 43 × ∞ variants)