Custom C++ Ray Tracer
The "Lonely Snowman" is the result of our Custom Ray-Tracing Renderer
TL;DR: As part of my Computer Graphics coursework, I co-developed a custom multithreaded CPU ray tracing engine in C++ to render a complex, stylized 3D scene. Extending a baseline framework, my teammate and I engineered core computer graphics and ray-tracing algorithms for spatial acceleration, light transport, and physically based rendering.
Our final render, titled “The Lonely Snowman,” tells the story of the last snow globe left on a Christmas market shelf.
⚙️ Core Engineering & Features
To achieve a photorealistic and cinematic result, we engineered custom logic to solve specific rendering challenges:
1. Transmissive Light Transport (“Magic Glass”)
Rendering the glass snow globe presented a complex challenge regarding shadow rays and transmissive materials. Standard glass primitives block shadow rays, creating unrealistic dark voids.
We modified the recraytrace integrator so external light passes through the globe, while preventing internal point lights from casting false, enlarged shadows outside.
2. Procedural Volumetrics (Double-Sided Primitives)
The confetti inside the globe was created by randomly sampling points within the sphere. However, our standard Disc primitive was one-sided, meaning rays hitting the back face returned black. We engineered custom double-sided normal calculations so rays hitting the “back” of the confetti still evaluate color correctly.
3. Physically Based Camera (Depth of Field)
To give the render a cinematic feel and direct the viewer’s eye to the snowman, we simulated a physical lens aperture and focal plane. This added natural Depth of Field, blurring the background lighting and shelves into realistic bokeh.
4. Surface Normal Perturbation (Bump Mapping)
To break up the flat CGI look, we implemented bump mapping. We applied noise-based and wood-grain bump maps to the walls and shelves, calculating surface normal modifications during the shading phase.
5. Performance & Optimization
- Bounding Volume Hierarchy (BVH): Implemented spatial acceleration to optimize ray-primitive intersection tests for the high-polygon imported snowman.
- Mesh Instancing: Expanded the engine’s loading pipeline to support instancing, drastically reducing the memory footprint of duplicated 3D assets.
This project was a fantastic deep dive into rendering equations, spatial data structures, and the intersection of software engineering and digital art. It was completed as part of the Computer Graphics course offered by the CG-Group of Saarland University.