A Rust reimplementation of a simple ray tracer introduced in Ray Tracing in One Weekend.
This project is heavily influenced by a similar one: ray-tracing-in-one-weekend.
See CHANGELOG for version details.
- BVH (Bounding Volume Hierarchies) from Ray Tracing: The Next Week.
- Parallel computing powered by
Rayon.
The results below are of 1920x1080, sample rate 1000, max depth 50.
- scene: lined-up scene (with camera focus)
- rendering time:
201.0s
- scene: final scene (with camera focus)
- rendering time:
163.8s
- scene: lined-up scene (without camera focus)
- rendering time:
217.1s
With benchmark feature (from v0.2.1) enabled (which limits most of the randomness), we get a not-so-serious (but useful enough) benchmark system to measure the performance (rendering time) difference between versions.
Configuration of the benchmark:
- resolution
1200x800, sample rate100, max depth50 - run
cargo build --release --features benchmark - run
hyperfine --warmup 1 -r 10 'target/release/ray-tracing --ns 100' - use the
mingiven byhyperfineas the result
| Version | Best Rendering Time (s) | Speed (sample/s) | Rel-Speed | Note |
|---|---|---|---|---|
v0.1.0 |
39.179 | 2.45M | 1 | |
v0.2.0 |
32.212 | 2.98M | 1.22 | implemented BVH |
v0.2.1 |
- | - | - | no perf improvement |
v0.2.2 |
19.109 | 5.02M | 2.05 | limited BVH depth |
v0.3.0 |
8.256 | 11.63M | 4.75 | * see below |
v0.4.0 |
- | - | - | no perf improvement |
v0.4.1 |
- | - | - | no perf improvement |
v0.5.0 |
7.870 | 12.20M | 4.98 | removed bench timer |
- "Rel-Speed" is the relative speed compared to
v0.1.0. - Note for
v0.3.0:- Switched to stratified pixel sampling.
- Optimized
AaBb::hit()by removing branches, enabling better SIMD utilization. - Refactored
Materialtrait as an enum to reduce runtime overhead. - Enabled
ltoand tunedcodegen-unitsfor improved performance.


