Skip to content

Explainers

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.