Skip to content
MwrnkPublic

About

A GPU-accelerated ASCII renderer: a character grid drawn in one instanced call, with bloom, smooth color tweens and particles

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

rusteezy pixel crab logo

rusteezy

CI License: MIT OR Apache-2.0

A GPU-accelerated ASCII renderer for Rust: a character grid with real glow, smooth color, and physics, at hundreds of frames per second.

The rusteezy crab walking under water

You fill a grid of character cells (glyph, colors and a glow amount), and rusteezy draws the whole grid in one instanced draw call into an HDR image. A bloom pass then lets bright cells bleed light onto their neighbours, which no terminal can do.

  • Fast: a full-window grid in a couple of milliseconds per frame (numbers)
  • Bloom: soft threshold, dual-filter blur, ACES tonemapping
  • Smooth: fixed-step simulation, easing curves, tweens, OKLab color fades
  • Particles: gravity, drag, wind, per-particle color, interpolated rendering
  • 3D-friendly: per-cell depth buffer for compositing ray-traced or splatted scenes
  • Batteries included: bundled fonts with glyph fallback, PNG capture, deterministic frame recording, an off-screen benchmark

Quickstart

[dependencies]
rusteezy = "0.1"
use rusteezy::{Config, Frame, Rgb, Scene};

struct Hello;

impl Scene for Hello {
    fn draw(&mut self, f: &mut Frame) {
        let (w, h) = f.size();
        let text = "hello, rusteezy";
        let x = (w as i32 - text.len() as i32) / 2;
        let pulse = 0.5 + 0.5 * (f.time as f32 * 3.0).sin();
        for (i, ch) in text.chars().enumerate() {
            // Hue sweeps across the word; `glow` feeds the bloom pass.
            let t = i as f32 / text.len() as f32;
            let color = Rgb::hex(0xff6a3d).lerp_oklab(Rgb::hex(0xffd23f), t);
            f.grid.overlay(x + i as i32, h as i32 / 2, ch, color, 0.5 + 1.5 * pulse);
        }
    }
}

fn main() -> Result<(), String> {
    rusteezy::run(Config::new("hello").with_args(), Hello)
}

Implement Scene::update(dt, time) for simulation (it runs at a fixed 240 Hz) and Scene::draw to fill the grid each frame. Grid::plot writes with a depth test and Grid::overlay writes unconditionally.

Examples

cargo run --release --example tree
Suspension bridge at golden hour
bridge: golden hour, every part drawn along its length; the water mirrors sky, sun and bridge
3D Christmas tree Fireworks over a city
tree: ray-traced cones, arc-length garland, snow, sparks fireworks: particles, bursts, crackle, bloom
Fire simulation Sine plasma
fire: per-cell heat diffusion with embers plasma: scalar field, cycling OKLab palettes
Spinning torus Starfield at warp speed
torus: lit surface points, depth buffer, specular bloom starfield: warp streaks with slope-matched glyphs

Performance showcase

These four push the CPU and print their own timings in the bottom-left corner. The heavy work is spread across all cores with rayon, which is a dev-dependency only.

Spiral galaxy of 300,000 stars 200,000 particles in a flow field
galaxy: 300,000 stars projected and splatted every frame flow: 200,000 particles, fading trails, glyphs follow the flow
Ray-marched metaballs Game of Life on a dense grid
raymarch: one ray per cell, soft shadows, AO, floor reflections life: Game of Life on 56,000+ cells with ember trails
Example Run Keys
hello cargo run --release --example hello
crab cargo run --release --example crab
bridge cargo run --release --example bridge R rebuild
tree cargo run --release --example tree R rebuild · G garland mode · B bloom
fireworks cargo run --release --example fireworks Space volley
fire cargo run --release --example fire
plasma cargo run --release --example plasma P palette
torus cargo run --release --example torus
starfield cargo run --release --example starfield
galaxy cargo run --release --example galaxy --stars <n>
flow cargo run --release --example flow --particles <n>
raymarch cargo run --release --example raymarch
life cargo run --release --example life Space turbo (240 gen/s)

Every example accepts the same flags (see rusteezy::cli):

Flag Effect
--font <px> cell size (default 10)
--size <W>x<H> window size
--hud show fps and timings (F1 toggles)
--uncapped no vsync
--bench [frames] off-screen benchmark, prints stats and quits
--shots <dir> <t1,t2,…> save PNGs at those times
--record <file.rgb> --fps N --start S --seconds S record raw frames (see scripts/gif.sh)

Performance

--bench renders the full pipeline (simulation, drawing, upload and every GPU pass) off-screen, and waits for the GPU on every frame. That is the most conservative measurement, with CPU and GPU fully serialized. Apple M2 (4 performance + 4 efficiency cores), 2560×1600 px window, default sizes, --bench 1200:

Example Work per frame Grid avg frame p99 frame
tree ray-trace every cell, garland, ~1,500 particles 213×66 2.2 ms (≈455 fps) 4.6 ms (≈220 fps)
bridge sky, length-based bridge, mirrored water with glitter 256×84 3.2 ms (≈310 fps) 5.8 ms (≈175 fps)
fireworks particles + bloom 213×66 2.2 ms (≈455 fps) 4.3 ms (≈235 fps)
galaxy 300,000 stars 213×66 2.9 ms (≈340 fps) 6.4 ms (≈155 fps)
life 56,658 cells, one generation each 1/30 s 426×133 2.9 ms (≈350 fps) 6.9 ms (≈145 fps)
flow 200,000 particles + trails 213×66 4.8 ms (≈210 fps) 7.3 ms (≈135 fps)
raymarch 26,700 rays + shadows + AO + reflections 284×94 4.8 ms (≈210 fps) 9.2 ms (≈110 fps)
galaxy --stars 1000000 1,000,000 stars 213×66 5.4 ms (≈185 fps) 9.3 ms (≈110 fps)

In a normal window, frames present at the display's refresh rate (even with --uncapped on macOS); the table shows the headroom behind that.

How it works

See docs/design.md for the frame pipeline, timing and the approaches that were considered.

Making the GIFs

scripts/gifs.sh            # all of them (needs ffmpeg)
scripts/gif.sh torus 0 5   # one example: start at 0 s, record 5 s

Fonts

The default-font feature (on by default) bundles Cascadia Mono (SIL Open Font License 1.1) with DejaVu Sans Mono as a fallback for glyphs Cascadia lacks (★ ✦). Their licenses are in assets/fonts/. To use your own font, set Config::font and Config::fallback_fonts, and turn off default features if you want to drop the bundled ones.

License

Licensed under either of Apache License 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A GPU-accelerated ASCII renderer: a character grid drawn in one instanced call, with bloom, smooth color tweens and particles

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages