Möller–Trumbore: Photorealistic Lighting Starts With a Ray and a Triangle

An image rendered using path tracing, demonstrating notable features of the technique

"Path tracing 001.png" by Qutorial is licensed under CC BY-SA 4.0

Have you ever wondered how computers produce photorealistic lighting: shading, shadows, reflections, depth of field, etc.? Most commonly, this is done via ray tracing or one of its descendants (e.g., path tracing or photon mapping). The basic idea is to mimic the way rays of light travel around a scene and what colour the ray is when it reaches the eye/camera. There are many ways light rays interact within a scene, but they almost all require knowing where a ray hits an object. From this point it can bounce off, refract through, or be used to simulate the effect of many rays spraying out in all directions. This article will focus ray collisions with the most general of objects: the humble triangle. We will start with an intuitive understanding of the problem and work our way up to an elegant and efficient solution known as the Möller–Trumbore algorithm.

Improved Blogging Experience

MkDocs Material (the amazing MkDocs theme that powers this site) has hit their $12,000 goal, which means they have made their blogging platform available to non-insiders! It is still in beta, but I decided to go for it anyway, because I really wanted my blog to feel more like a real blog.