Tony Yiding Tian

CUDA Path Tracer

Monte Carlo path tracing on the GPU, with a BVH and OptiX denoising

CUDA, GLSL, C++ · Sep – Oct 2025

Glass and chrome chess pieces on a checkered board, path traced in CUDA

A physically based Monte Carlo path tracer in CUDA. It renders globally illuminated images of custom scenes: glTF models with their own materials and textures, under HDR environment maps. It grew from the CIS 5650 base code into everything below.

Materials

A dark, opaque sphere in a Cornell box under a ceiling light
Subsurface scattering off
The same sphere with subsurface scattering, pale and glowing with light from within
Subsurface scattering on

Light and sampling

Glass chess pieces on a marble board after 50 iterations, grainy with noise
50 iterations
The same 50 iterations through the OptiX denoiser, smooth and clean
50 iterations, denoised

Geometry

A glass Stanford Dragon on a checkered cloth, lit through high windows
Stanford Dragon, 134,995 triangles
A black 1975 Porsche 911 parked on a street under a blue sky
1975 Porsche 911, 241K triangles
Models from the Khronos glTF samples, and by Lionsharp Studios on Sketchfab.

Keeping the GPU busy

Each bounce runs as kernels over every live path: intersection, then shading. Three optimizations work on that loop. All the timings are on an RTX 5080 with an i9-13900H.

Trace depthWith compactionWithoutTime saved
426 ms29 ms10%
832 ms42 ms24%
1234 ms57 ms40%
1634 ms68 ms50%
2437 ms94 ms61%
3239 ms118 ms67%
Stream compaction. With it, frame time levels off at 34–39 ms; without, it grows with every bounce.
Trace depthNo rouletteFrom half depthFrom a quarter
838 ms32 ms30 ms
1242 ms36 ms32 ms
1645 ms40 ms35 ms
2448 ms45 ms39 ms
3250 ms48 ms44 ms
Russian roulette, starting at half or at a quarter of the trace depth. From a quarter, it saves 12–24% of the frame.
SceneTrianglesWith BVHWithoutSpeedup
Duck4K17 ms70 ms4.1×
Spartan armor42K30 ms765 ms25.5×
Dragon134K42 ms2,846 ms67.8×
Dodge Challenger196K27 ms3,023 ms112×
Porsche241K25 ms3,604 ms144×
Chess set1.5M270 ms43,343 ms160×
The BVH. On the 1.5M-triangle chess set, 43 seconds a frame becomes 270 ms.
SceneMaterialsSortedUnsorted
Duck317 ms15 ms
Dragon642 ms41 ms
Spartan armor1329 ms28 ms
Porsche1626 ms22 ms
Dodge Challenger2327 ms23 ms
Chess set18267 ms278 ms
Material sorting. It costs more than the coherence it buys, except on the 1.5M-triangle chess set, so it stays a compile-time switch, MATERIAL_SORTING.

Tools

An ImGui panel shows live statistics (frame rate, rays per second, iterations, active paths and per-kernel timings), orbits, pans and zooms the camera, loads another scene from its JSON file without a restart, drives the denoiser, and saves the image as a PNG.

GitHub

[email protected] · LinkedIn · GitHub · Resume