Lasercrab is a KISS implementation of an al-Haytham's model based ray-tracer, written in Rust.
Click on the image above to watch a small 4K60 animation made with Lasercrab. Hosted on YouTube.
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.
cargo run --release
cargo run --release --features parallel
Warning: by default, this will render 600 frames at 1080p, where each one takes 5.9MiB of space.
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
Things I want to implement in the future.