⇐   October 9th, 2022   ⇒ 

Copyright 2022 Michael Anttila

When I first joined the Stadia team I spent a bit of time resurrecting my raytracer project from university. While I was happy that it was alive again, I wanted to make it better, and use more modern rendering techniques. Specifically, I wanted to turn it from a raytracer into a pathtracer. When Stadia shutdown was announced, I suddenly found myself with free time at work, so I decided to use some of it to finally implement a pathtracer.

Path tracing takes a probabilistic approach to rendering. When you are raytracing an image, you shoot one ray per pixel, figure out which object it hits first, and then try to figure out what lights are shining on that object and what colour it is, and use that information to determine the colour of that pixel. This is great, but it ignores things like light bouncing off other objects.

There are ways to hack raytracers to approximate global illumination effects, but they are not that great. One way of getting global illumination "for free" is by path tracing. The way path tracing works is that you shoot thousands of rays per pixel, and when each ray hits an object, you bounce it in a random direction (determined by a probability cone based on the object's material properties). You then keep tracing the ray as it bounces off other objects, up to some maximum depth of bouncing.

Path tracing gives you all sorts of neat global illumination effects for free, and makes scenes look much more natural. The downside is that it can take a LOT of time to trace all those extra rays and all those extra bounces. You have to do thousands of times the amount of work as an old-school raytracer does.

After I converted my raytracer into a pathtracer, I wanted to compare the results with my old university assignment. If you hover your mouse over the image, it should show you the old raytraced version of the scene so you can see the difference.

Some technical notes:

Technical Details: This scene was rendered using my new pathtracer. Rendering took approximately 8 days on a 36-core CPU.

POTW - Photo Map - Home - Feedback

Hosted by theorem.ca