Monte Carlo
Path Tracer
C++ / OpenGL / GLSL / QT
For my graduatelevel graphics course CIS 4610: Advanced Rendering, I implemented a GPUBased Monte Carlo Path Tracer, complete with features such as various light integrators (naive, direct, full, etc.), BxDFs, multiple importance sampling, and a variety of lights (area light, point light, environmental, etc.).
My responsibilities included:

Lighting Integrators

Naive

This was my first implementation of the Light Transport Equation (LTE). For each pixel, this integrator would cast multiple rays and then check the intersections between those rays and the scene. If a ray intersected with a light source, it would return its emitted light. Else, it would randomly reflect the ray within a hemisphere of possible directions and recursively trace the ray until it reached a depth limit. This gave the least biased solution to the LTE, but also resulted in grainy renders and took the longest convergence time due to the large number of ray samples taken per pixel.


Direct Lighting

This was my second implementation of the LTE. This integrator performed light source importance sampling and evaluated the light energy that a given point receives directly from light sources. This allowed for a much sharper render, but the integrator could not handle indirect lighting well.


Direct Lighting with Multiple Importance Sampling (MIS)

This was my third implementation of the LTE. In order to handle differently sized light sources as well as materials with various levels of glossiness, this integrator incorporated Multiple Importance Sampling into the Direct Lighting Integrator. This allowed for more effective estimation of direct illumination.


Full Lighting with Global Illumination

This was my final implementation of the LTE. In order to handle both direct and indirect lighting, this integrator combined the MIS Direct Lighting integrator with global illumination measured at every ray bounce. This allowed for much faster convergence time for images that contained both direct and indirect lighting.



Light sources

Area Lights

Point Lights

Spot Lights

Environment Lighting

I implemented environment lighting that would utilize a given environment map as a light source. This was done by cosinesampling the hemisphere at a ray intersection and including the map's color at the UV coordinates in the returned light.



BxDFs

Lambertian BRDF

Microfacet BSDF

Specular BRDF and BTDF

Matte Material


Sample Warping Functions

Uniform square to disc sampling:

This function served as a "polar" mapping, where one square axis mapped to a disc radius and the other axis mapped to an angle on the disc.


Concentric square to disc sampling:

This function implemented Peter Shirley's warping method, which better preserves relative sample distances.


Uniform square to sphere sampling

This function uniformly distributed all square samples across the surface of a sphere.


Uniform square to hemisphere sampling

This function uniformly distributed all square samples across the surface of a hemisphere.


Cosineweighted hemisphere sampling

This function implemented Malley's method in order to bias the warped samples towards the pole of the hemisphere and away from the base. This was done so that each sample has a more meaningful contribution to the overall sum.

