| Crates.io | chromapath |
| lib.rs | chromapath |
| version | 0.2.0 |
| created_at | 2025-09-04 19:02:35.268104+00 |
| updated_at | 2025-09-08 18:53:27.331684+00 |
| description | GPU-accelerated path tracer implementing 'Ray Tracing in One Weekend' with CPU, Vulkan compute, and hardware ray tracing backends |
| homepage | |
| repository | https://github.com/jromang/chromapath |
| max_upload_size | |
| id | 1824643 |
| size | 9,491,118 |

ChromaPath is a complete Rust implementation of Peter Shirley's "Ray Tracing in One Weekend" with GPU hardware ray tracing acceleration.
This project implements the exact same path tracer from the famous book, but with two key improvements:
glam math libraryBoth implementations produce identical images - the GPU version is just orders of magnitude faster!
# Install dependencies (Vulkan SDK required for default GPU mode)
# Then build and run:
# Hardware RT (default, orders of magnitude faster)
cargo run --release -- -s 100
# CPU mode (naive book implementation, for comparison/learning)
cargo run --release -- --cpu -s 100
# Compare both with benchmark
cargo run --release -- --bench
The GPU hardware ray tracing version delivers orders of magnitude performance improvements over the naive CPU implementation, especially for complex scenes with many objects.
RTX 3090, 800×600, 4000 samples per pixel, complex scene with Lucy model (448k triangles) + random spheres
🚀 Hardware Ray Tracing: 11.43s
├─ Ray tracing dispatch: 4.40s (436.6M rays/sec)
├─ Scene setup: ~2s
└─ Image readback: ~5s
📊 Performance: 436.6 million rays per second
🎯 Total pixels: 480,000 (4000 samples each = 1.92 billion rays)
The same scene on CPU would take days due to the naive O(n) intersection testing without acceleration structures.
# PNG output (hardware RT is default)
cargo run --release -- -s 100 -o image.png
# HDR/EXR for professional workflows
cargo run --release -- -s 100 -o image.exr
# Send directly to TEV viewer
cargo run --release -- -s 100 --tev
# CPU mode for comparison
cargo run --release -- --cpu -s 100 -o cpu_image.png
The CPU implementation faithfully follows "Ray Tracing in One Weekend":
The GPU version translates these concepts to Vulkan hardware RT:
ray_color() function → Ray generation + hit/miss shaders✅ Chapter 1: Output an Image
✅ Chapter 2: The vec3 Class → glam::Vec3A
✅ Chapter 3: Rays, a Simple Camera
✅ Chapter 4: Adding a Sphere
✅ Chapter 5: Surface Normals and Multiple Objects
✅ Chapter 6: Antialiasing
✅ Chapter 7: Diffuse Materials
✅ Chapter 8: Metal
✅ Chapter 9: Dielectrics
✅ Chapter 10: Positionable Camera
🚀 Bonus: Hardware Ray Tracing with Vulkan