A3d.rs

From The Hei Canon

a3d.rs (binary: a3d) is a GPU-accelerated ASCII 3D rendering engine in Rust. Renders OBJ / STL models as real-time ASCII art in the terminal, using wgpu compute shaders (Vulkan backend) for rasterization and glam for SIMD-accelerated math.

Stack: Rust 1.85+ (2024 edition), wgpu, glam. License: MIT. Public.

Inspired by voxcii, rebuilt from scratch in Rust for memory safety, performance, and extensibility.

Features

  • Real-time 3D rendering with ASCII shading.
  • Z-buffered scanline triangle rasterization with plane-equation depth interpolation.
  • Orthographic projection with terminal aspect-ratio correction.
  • OBJ (with MTL material colors) + STL (binary and ASCII) support.
  • Auto-rotation with golden-ratio oscillation; interactive mode (arrows + zoom).
  • Automatic terminal resize handling.
  • wgpu GPU context (Vulkan backend); transparently falls back to CPU renderer if no Vulkan atomic-int64 GPU is present.

Usage

a3d model.obj                   # auto-rotate
a3d model.obj --interactive     # arrow keys
a3d model.obj --color           # 24-bit ANSI true color
a3d model.obj --fps 60 --zoom 2.5

CI runs fmt --check, clippy -D warnings, build, and the full test suite on every push. A gpu_compare test renders the same scene on CPU + GPU and asserts they match; it skips when no GPU adapter is present, so the suite is green on GPU-less machines.

Use in the fleet

Renders the faceted-diamond fastfetch logo for hai-os's gem edition.

Sources

See also

  • hai-os — consumer of the a3d logo renderer.