Test scene with diffuse, metallic, and glass spheres, rendered with depth of field (100 samples per pixel, render time: ~7s).
- Download the latest GLFW source packages from here and copy them into
include/glfw/
. - Download the latest GLAD loaders from here with the following settings:
- Language:
C/C++
- Specification
OpenGL
- API gl:
Version 4.6
- Profile:
Core
- Options: Tick
Generate a loader
- Language:
- Copy the
glad.h
file intoinclude/glad/
, thekhrplatform.h
file intoinclude/KHR/
, and theglad.c
file intosrc/
. - Clone the GLM repo from here and copy the contents of the
glm
directory intoinclude/glm/
. - Install dependencies:
sudo apt install cmake xorg-dev
(For non X11 on Unix users, check out this guide for more details). - Give permission to the build script:
chmod +x build.sh
- Build and run the program
./build.sh -r
.
This is a toy path tracer meant to explore concepts in computer graphics, parallel programming, as well as various statistical methods e.g. Monte Carlo estimation, multiple importance sampling, low-discrepancy samplers etc. Thus, some features present in production path tracers may not be implemented.
RandomWalkIntegrator
: For every ray intersection, uses importance sampling on the BSDFs of materials to choose the next ray direction, then recursively samples that direction.SimplePathIntegrator
: Similar to theRandomWalkIntegrator
, but changes the recursive function calls to an iterative one, and additionally carries out next event estimation by sampling the lights in the scene to further minimize error.PathIntegrator
: Builds on theSimplePathIntegrator
by using multiple importance sampling to weigh the BSDF and light samples. Implements Russian roulette path termination to cut down on low contribution rays and improve Monte Carlo efficiency.
As seen from these images, the noise present in the scene rendered by the SimplePathIntegrator
is much smaller despite the shorter rendering time and equal number of samples per pixel.
However, new artefacts (the bright pixels) are introduced into the image. This is resolved in PathIntegrator
which has an even shorter rendering time.
IndependentSampler
: returns a uniform sample.
Lambertian
: perfectly diffuse material. Modifiable attributes:- Color
- Emission
Metal
. Modifiable attributes:- Color
- Fuzz
Dielectric
: glass-like material that both refracts and reflects light. Modifiable attributes:- Index of refraction
- Spheres
- Quadrilaterals
- Quadrilateral area lights
- Parallelization using OpenMP (~7.4x speedup on 16 core machine).
- Bounding Volume Hierarchies (BVHs) to speed up ray intersection tests (~4.7x speedup).
This project uses material from the following sources: