A physically based Monte Carlo path tracer written in C++, implementing global illumination, volumetric media, acceleration structures, and polygonal geometry from scratch.
This project is a custom stochastic path tracing renderer designed to simulate realistic light transport using Monte Carlo integration. The renderer supports indirect lighting, participating media, emissive geometry, and complex scene construction.
While inspired by the Ray Tracing in One Weekend book series, this implementation extends beyond the introductory material by integrating additional geometry types, a full BVH acceleration structure, and volumetric effects.
- Spheres with analytic ray–sphere intersections
- Triangle primitives using the Möller–Trumbore intersection algorithm
- Quadrilaterals (quads) for walls, floors, and area lights
- Instancing via translation and rotation transforms
- Manually constructed meshes composed of triangle groups
- Global Illumination using recursive Monte Carlo path tracing
- Diffuse (Lambertian) materials
- Metallic materials with adjustable roughness
- Dielectrics (glass/water) using refraction and Schlick approximation
- Emissive materials for physically based area lights
- Volumetric media (fog/smoke) via constant-density participating media
- Image textures with UV mapping (e.g., Earth texture)
- Procedural Perlin noise for marble and turbulence effects
- Checkerboard procedural textures
- Bounding Volume Hierarchy (BVH) for accelerated ray–object intersection
- Motion blur via temporal ray sampling
- High sample-count rendering with importance-driven recursion limits
- Clone the repository.
- Open
RayTracer.vcxprojin Visual Studio. - Set configuration to Release.
- Build and run (
Ctrl + F5). - Output is written to
image.ppm.
g++ main.cpp -O3 -o raytracer
./raytracer > image.ppm