This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a C++ implementation of the "Ray Tracing in One Weekend" tutorial series, containing three progressive raytracing renderers:
- rt-weekend: Basic raytracer (Ray Tracing in One Weekend)
- rt-next-week: Enhanced raytracer with textures, motion blur, and acceleration structures (Ray Tracing: The Next Week)
- rt-troyl: Monte Carlo pathtracer with advanced lighting (Ray Tracing: The Rest of Your Life)
Each directory contains a complete raytracer with shared header-only libraries for geometry, materials, cameras, and rendering utilities.
Uses CMake with C++23 standard. Build commands:
# Configure and build (from project root)
cmake -B build
cmake --build build
# Or using make directly in build directory
cd build && make
# Build specific targets
cmake --build build --target rt-weekend
cmake --build build --target rt-next-week
cmake --build build --target rt-troyl
cmake --build build --target pi_calcExecutables output PPM images to stdout:
# Render and save image
./build/rt-weekend > image.ppm
./build/rt-next-week > image.ppm
./build/rt-troyl > image.ppm
# Pi calculation utility
./build/pi_calc- Header-only design: All core functionality in
.hfiles for easy inclusion - Progressive complexity: Each tutorial builds on previous concepts
- Shared utilities: Common math/utility headers across all three implementations
- Modular materials: Separate material classes (lambertian, metal, dielectric, etc.)
- Acceleration structures: BVH trees for fast ray-object intersection in advanced versions
- Multi-threading: Thread pool implementation for parallel rendering
Key shared components:
vec3.h: 3D vector math and point operationsray.h: Ray class for ray-object intersectioncamera.h: Camera positioning and ray generationmaterial.h: Material properties and light scatteringhittable.h: Abstract interface for ray-intersectable objects
- Uses
.clangdconfig with modernize checks enabled - PPM format output for rendered images
- Images render to
renders/directory - Sample scenes defined as functions in main.cc files