Better comments
[lasercrab.git] / README.md
blob075497166358da30129a8fe9c5a975529451bc19
1 # lasercrab (WIP!)
3 Lasercrab is a KISS implementation of an al-Haytham's model based ray-tracer, written in Rust.
5 [![Lasercrab example](https://user-images.githubusercontent.com/36349314/99178571-2f746e00-26f3-11eb-8b37-c1e484499a45.png)](https://youtu.be/zLz4_43jUxo "Lasercrab Animation")
6 _Click on the image above to watch a small 4K60 animation made with Lasercrab. Hosted on YouTube._
9 ## Building
11 Lasercrab has no dependencies by default, but [Rayon](https://github.com/rayon-rs/rayon) is available as an optional dependency, which can parallelize the rendering of frames.
12 It was developed on rustc 1.47.0, but probably also builds on much older rustc versions.
14 ### Building without Rayon
16 ```
17 cargo run --release
18 ```
20 ### Building with Rayon
22 ```
23 cargo run --release --features parallel
24 ```
26 _Warning_: by default, this will render 600 frames at 1080p, where each one takes 5.9MiB of space.
28 ## Usage
30 As it stands, Lasercrab works on a [suckless](https://suckless.org/)-like manner.
33 Spheres, lights and materials are all defined in `main.rs`, alongside other configurations such as the output's image width and height.
34 Colors, such as the ones used on the checkerboard or the background, may be changed altering the `const Vec3fs` in `shapes.rs`. 
36 `ffmpeg` is a good companion to Lasercrab when making animations, with an example usage being:
37 ```bash
38 ffmpeg -framerate 60 -i output_%d.ppm -c:v libx264 -pix_fmt yuv420p output_anim.mp4
39 ```
41 ## TODO
43 Things I want to implement in the future.
45 * `.obj` loader;
46 * Snell's law based refractions;
47 * Add command-line arguments using [Clap](https://github.com/clap-rs/clap);
48 * Add the [image](https://crates.io/crates/image) crate as an optional dependency.