https://github.com/ahamez/ray-tracer
The Ray Tracer Challenge in Rust
https://github.com/ahamez/ray-tracer
challenge ray-tracer rust
Last synced: 12 months ago
JSON representation
The Ray Tracer Challenge in Rust
- Host: GitHub
- URL: https://github.com/ahamez/ray-tracer
- Owner: ahamez
- Created: 2020-12-11T18:14:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-18T17:11:18.000Z (almost 4 years ago)
- Last Synced: 2025-04-04T07:22:37.488Z (over 1 year ago)
- Topics: challenge, ray-tracer, rust
- Language: Rust
- Homepage: https://pragprog.com/titles/jbtracer/the-ray-tracer-challenge
- Size: 34.5 MB
- Stars: 41
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ray Tracer Challenge
This is an implementation in Rust of the book [The Ray Tracer Challenge](http://www.raytracerchallenge.com) . Go get it, it's one of the best book I read!
My main objective is to be fluent in Rust 🗣🦀. So, if some seasoned rustacean comes across this, don't hesitate to pinpoint the problems 😉!
## Differences from the book and other points of interest
* Parallelization with [rayon](https://github.com/rayon-rs/rayon) (I can't believe how easy it was!)
* Matrices inversion are cached (which provides a significant speedup!)
* Don't explicitly store the w component for tuples. Instead, it's up to the implementation of the Tuple trait to return the correct value (1.0 or 0.0)
* Avoid creating a new vec for each call to a shape intersects() method using a kind of closure (it provides an interesting speedup as it prevents the dynamic allocation of many temporaries)
* Use f64 everywhere
* Naive anti-aliasing
* Use enums rather than traits to describe polymorphic behaviors (shapes, lights, etc.)
## Some samples
















