Michael J Petrie

2019 · Personal project

A frame from RT 01's render: a black Mercedes-Benz 300 SL Gullwing, doors open, against a purple dusk sky
A frame from RT 01’s Mercedes-Benz 300 SL Gullwing animation.

A stochastic path tracer written from scratch in C, using an axis-aligned bounding box BSP tree for acceleration. SIMD ray tracing only paid off for the first bounce, so later bounces switched to scalar tracing, which turned out faster.

Much of the code is hard-wired to render its showcase: a one-million-polygon animation of a Mercedes-Benz 300 SL Gullwing.

The full render on YouTube.

Features

  • Normal mapping, and displacement to normals
  • Normal ray plane clamping
  • A pseudo-HDR sky using Perlin noise
  • Depth blur and motion blur
  • Per-pixel sample stratification, for smooth motion and depth blur
  • Intel’s Open Image Denoise for clean, noise-free output — even 16 rays per pixel gave reasonable results

It was my first attempt at a renderer that could draw more than just spheres. I built it for my own learning, and much of it isn’t especially efficient, but I was happy with how it turned out.

Learning resources

  • Ray Tracing Minibooks, Peter Shirley
  • Realtime Ray Tracing and Interactive Global Illumination, Ingo Wald
  • Ray–triangle intersection, Möller–Trumbore
  • Cramer’s rule
  • On Building Fast kd-Trees for Ray Tracing, Wald and Havran
  • Mathematics for 3D Game Programming and Computer Graphics

Source code on GitHub

All projects