Skip to content

shaba5h/asciiray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsciiRay

Simple Real-time ASCII raytracer in terminal, written in Rust with animation support.

Features

  • Real-time 3D scene rendering in ASCII
  • Animation support (orbiting cameras, pulsing objects, moving lights)
  • Customizable character palette for different effects
  • Automatic adaptation to terminal size

Installation

cargo build --release

Usage

Simple animation

cargo run --release

Custom parameters

# Set resolution
cargo run --release -- --width 120 --height 60

# Change FPS
cargo run --release -- --fps 30

# Use custom palette
cargo run --release -- --palette " .:-=+*#%@"

Benchmarks

cargo bench

Performance results (100x50)

Scene Time per frame FPS
Simple scene ~30 µs ~33,000
Screensaver (9 objects) ~118 µs ~8,400
Full animation cycle ~108 µs ~9,300

Architecture

The project tries to follow clean architecture principles:

  • src/scene/ - geometry, camera, animations
  • src/renderer/ - ASCII rendering
  • benches/ - performance benchmarks

Command-line options

Options:
  -p, --palette <PALETTE>  ASCII palette (lightest to darkest) [default: ASCII70]
  -f, --fps <FPS>          Frames per second (0 = single frame) [default: 24]
  -W, --width <WIDTH>      Width in characters
  -H, --height <HEIGHT>    Height in characters
  -h, --help               Display help

Palette examples

  • Default (ASCII70): `.-':_,^=;<>+!rc*/z?sLTv)J7(|Fi{C}fI31tlu[neoZ5Yxjya]2ESwqkP6h9d4VpOGbUAKXHm8RD#$Bg0MNWQ%&@
  • Simple: .:-=+*#%@
  • Blocks: ░▒▓█

License

MIT

About

Simple Rust CLI ray tracing application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages