Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Monte Carlo Path Tracer

C++ Build

A physically based, CPU-driven Monte Carlo Path Tracer built from scratch in C++. This project is a comprehensive implementation of advanced global illumination and ray tracing techniques, capable of rendering highly realistic scenes with complex light interactions.

✨ Core Features

  • Monte Carlo Integration & PDF: Implements Importance Sampling (Cosine and Light source sampling) via Probability Density Functions (PDF) to drastically reduce noise and converge faster.
  • BVH Acceleration: Uses Bounding Volume Hierarchies (bvh.h) for $O(\log N)$ ray-object intersection, enabling scenes with thousands of primitives.
  • Advanced Materials:
    • Microfacet-like behaviors including Dielectrics (glass/refraction), Metals (with fuzziness), and Lambertian diffuse.
    • Emissive materials (lights) and Volumetric materials (constant medium/fog/smoke).
  • Procedural & Image Textures: Support for solid colors, image-based mapping (stb_image), and procedural 3D Perlin noise (perlin.h).
  • Geometry: Supports spheres, oriented quads (rectangles/boxes), and compound volumes.

🛠️ Build & Run

Prerequisites

  • A modern C++17 compiler (GCC/Clang/MSVC)
  • CMake (3.10+)

Compilation

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

Output

Run the executable and redirect the output to a .ppm file:

./PathTracer > image.ppm

📷 Gallery

BallScene Cornell FinalScene

About

A C++ implementation on Monte-Carlo Method Path-Tracing. Complete version on RayTracing in one weekend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages