Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ChromaPath - Ray Tracing in One Weekend: Rust & Hardware RT
ChromaPath is a complete Rust implementation of Peter Shirley's "Ray Tracing in One Weekend" with GPU hardware ray tracing acceleration.
What is this?
This project implements the exact same path tracer from the famous book, but with two key improvements:
- Pure Rust: Using modern Rust idioms and the
glam
math library - Hardware RT: Optional GPU acceleration using Vulkan ray tracing extensions
Both implementations produce identical images - the GPU version is just orders of magnitude faster!
Quick Start
# Install dependencies (Vulkan SDK required for default GPU mode)
# Then build and run:
# Hardware RT (default, orders of magnitude faster)
# CPU mode (naive book implementation, for comparison/learning)
# Compare both with benchmark
Performance
The GPU hardware ray tracing version delivers orders of magnitude performance improvements over the naive CPU implementation, especially for complex scenes with many objects.
Real-world Example
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.
Output Formats
# PNG output (hardware RT is default)
# HDR/EXR for professional workflows
# Send directly to TEV viewer
# CPU mode for comparison
How it works
The CPU implementation faithfully follows "Ray Tracing in One Weekend":
- Same sphere scene from Chapter 1
- Same camera, materials, and ray tracing logic
- Deliberately naive: No BVH, no advanced optimizations - just like the book
- Simple linear search through all objects (O(n) complexity)
- Perfect for learning, but slow for large scenes
The GPU version translates these concepts to Vulkan hardware RT:
ray_color()
function → Ray generation + hit/miss shaders- Manual ray-sphere intersections → Hardware acceleration structures (O(log n))
- CPU loops → GPU parallel execution across thousands of cores
- Massive speedup comes from both parallelization AND better algorithms
Requirements
- Rust 1.70+
- Vulkan SDK (for hardware RT mode)
- GPU with RT support (RTX 20xx+ or RDNA2+) for hardware acceleration
Book Chapters Implemented
✅ 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
References
- Ray Tracing in One Weekend - The original book
- Vulkano - Rust Vulkan bindings
- glam - Fast 3D math library
- TEV - HDR image viewer