
A physically-based path tracer written from scratch in WebGL 1.0, rendering the Cornell box. Advanced graphics course project, NCSU.

Overview
I built a Monte Carlo path tracer from scratch, no engine, no ray-tracing library, and pointed it at a version of Cornell box wih spheres. Path tracing simulates light in reverse: rays leave the camera, bounce randomly around the room, and gather the light they find. Averaging many samples per pixel produces a physically accurate image.

Global illumination
Light bouncing off the red and blue walls tints the white surfaces nearby. That subtle color bleed is indirect lighting, the effect that only global illumination, not traditional direct lighting, can reproduce.

Convergence
Monte Carlo noise falls off slowly, the finished image is the average of thousands of light paths per pixel. What's left is soft shadows, smooth gradients, and clean indirect light.
Oops
Writing a renderer from scratch means breaking it in visually spectacular ways. A few of my favorite failures...

Bug
High-variance samples divided by a near-zero probability blow up into bright specks scattered across the frame. Mathematically wrong, weirdly starry.

Bug
A missing clamp let energy escape through the walls, washing the whole scene in an impossible, dreamy glow.

Bug
An error in spacial sample frequency. A scene split into an even grid of squares, each converging at its own pace.
Reflection
Building a path tracer bottom-up made the rendering equation click in a way no lecture could, and the bugs were half the fun. Next time I'd reach for WebGL 2.0 or WebGPU to escape the 1.0 constraints.