Skip to content

vrmiguel/lasercrab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lasercrab (WIP!)

Lasercrab is a KISS implementation of an al-Haytham's model based ray-tracer, written in Rust.

Lasercrab example Click on the image above to watch a small 4K60 animation made with Lasercrab. Hosted on YouTube.

Building

Lasercrab has no dependencies by default, but Rayon is available as an optional dependency, which can parallelize the rendering of frames. It was developed on rustc 1.47.0, but probably also builds on much older rustc versions.

Building without Rayon

cargo run --release

Building with Rayon

cargo run --release --features parallel

Warning: by default, this will render 600 frames at 1080p, where each one takes 5.9MiB of space.

Usage

As it stands, Lasercrab works on a suckless-like manner.

Spheres, lights and materials are all defined in main.rs, alongside other configurations such as the output's image width and height. Colors, such as the ones used on the checkerboard or the background, may be changed altering the const Vec3fs in shapes.rs.

ffmpeg is a good companion to Lasercrab when making animations, with an example usage being:

ffmpeg -framerate 60 -i output_%d.ppm -c:v libx264 -pix_fmt yuv420p output_anim.mp4

TODO

Things I want to implement in the future.

  • .obj loader;
  • Snell's law based refractions;
  • Add command-line arguments using Clap;
  • Add the image crate as an optional dependency.

About

Simple CPU-based raytracer in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages