https://github.com/armansito/ray-tracing-in-one-weekend
🦀 A Rust implementation of the Ray Tracing In One Weekend series 🦀
https://github.com/armansito/ray-tracing-in-one-weekend
graphics ray-tracing raytracing raytracing-one-weekend renderer rust
Last synced: about 1 month ago
JSON representation
🦀 A Rust implementation of the Ray Tracing In One Weekend series 🦀
- Host: GitHub
- URL: https://github.com/armansito/ray-tracing-in-one-weekend
- Owner: armansito
- License: mit
- Created: 2022-03-12T04:39:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-16T08:51:46.000Z (almost 2 years ago)
- Last Synced: 2025-03-26T13:38:42.456Z (about 2 months ago)
- Topics: graphics, ray-tracing, raytracing, raytracing-one-weekend, renderer, rust
- Language: Rust
- Homepage:
- Size: 1.62 MB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ray Tracing In One Weekend - in Rust
This is my implementation of the [_Ray Tracing in One
Weekend_](https://raytracing.github.io/books/RayTracingInOneWeekend.html) series. I had been
thinking about making my own Rust port for this series for a long time now, so here it is!I tried to keep the code as close to the book as possible with only a few minor deviations in
type and variable names. All of the CPU renderer code is self-contained but I decided to use the
following third-party crates for a few things that are implemented directly in the book:- [images](https://crates.io/crates/image) to convert sRGB to the stored image format (in this case
PPM)
- [rand](https://crates.io/crates/rand) and [rand_distr](https://crates.io/crates/rand_distr) to
sample from uniform distributions. I made use of the
[UnitSphere](https://docs.rs/rand_distr/0.4.3/rand_distr/struct.UnitSphere.html) and
[UnitDisc](https://docs.rs/rand_distr/0.4.3/rand_distr/struct.UnitDisc.html) utilities instead of
implementing rejection sampling myself (which wouldn't be hard but I chose to explore the crate
for learning purposes).---
You can build and run the code by executing the following inside the `cpu-renderer` directory:
```
cargo run --release
````cargo run --release -- --help` will output the following:
```
Usage: cpu-renderer [-p ] [-m ] [-s ] [-w ] [-h ]Ray Tracing In One Weekend: CPU renderer
Options:
-p, --samples-per-pixel
number of samples per pixel
-m, --max-bounces maximum number of ray bounces per traced path
-s, --scene the scene to render ("simple" or "cover")
-w, --width image width
-h, --height image height
--help display usage information
```## Images


