chromapath 0.1.0

GPU-accelerated path tracer implementing 'Ray Tracing in One Weekend' with CPU, Vulkan compute, and hardware ray tracing backends
docs.rs failed to build chromapath-0.1.0
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

ChromaPath Output

A path tracer implementation in Rust inspired by Ray Tracing in One Weekend.

Features

Three rendering backends producing identical results:

  • CPU: Multi-threaded with SIMD optimization (glam)
  • GPU Compute: Vulkan compute shaders via Vulkano
  • Hardware RT: GPU-accelerated ray tracing with Vulkano RT extensions
  • Output formats: PNG and EXR with TEV viewer support

Architecture

GPU Compute Pipeline

The compute shader implementation uses Vulkan's general-purpose compute capabilities:

  • Scene data (spheres, materials) uploaded to GPU buffer storage
  • Ray generation and path tracing logic implemented in GLSL compute shaders
  • Monte Carlo sampling for realistic lighting and materials
  • Parallel execution across GPU compute units (one thread per pixel)
  • Results accumulated in output image buffer

Hardware Ray Tracing Pipeline

The hardware RT implementation leverages dedicated RT cores:

  • Acceleration Structures: Bottom-Level (BLAS) and Top-Level (TLAS) for fast ray-scene intersection
  • RT Shaders: Ray generation, closest hit, miss, and intersection shaders
  • Shader Binding Table (SBT): Links geometry to material shaders
  • Hardware-accelerated traversal: RT cores handle BVH traversal automatically
  • Significant performance gains on modern GPUs (RTX series)

Performance

AMD 7900X (24 threads) + RTX 3090, 800×600 resolution, 500 samples per pixel

Backend Time Speedup
CPU 101.79s 1.0×
GPU Compute 7.53s 13.5×
Hardware RT 0.66s 154.9×

Requirements

  • Vulkan SDK
  • Rust 1.70+
  • GPU with ray tracing support (for hardware RT mode)

Usage

# CPU rendering
cargo run --release -- -s 100

# GPU compute shaders  
cargo run --release -- --gpu -s 100

# Hardware ray tracing
cargo run --release -- --hardware-rt -s 100

# Benchmark all modes
cargo run --release -- --bench

# Output formats
cargo run --release -- --hardware-rt -s 100 -o output.png
cargo run --release -- --hardware-rt -s 100 -o output.exr

# Send to TEV viewer
cargo run --release -- --hardware-rt -s 100 --tev

Next Steps

  • Triangle primitive support
  • glTF 2.0 scene loading

References