In this post, we will present a brief review of ray tracing.
Intersection of a light beam and a surface
As defined in the book Mathematics for 3D Game Programming and Computer Graphics, the term ray tracing refers to any algorithm that follows beams of light to determine with which objects they interact in the world. Ray tracing has many applications, such as
- light map generation
- visibility determination
- collision detection
- line-of-sight testing
From the math perspective, the problem can be translated into a root-finding problem. A beam of light is defined as
Suppose a surface is defined as an equation \( f(\mathbf{P}) = 0 \), then the problem becomes finding the root of the equation of \( f(\mathbf{P}(t)) = 0 \).
There are two types of solutions to a root-finding problem
- analytic solutions
- numeric solutions such as Newton's method
Newton's method is an iterative process that constructs a series that converges to the actual root of the equation. It has a quadratic convergence rate. The basic formula is:
For more details, please check the wiki page of Newton's method.
Note that Newton's method is not guaranted to converge to a solution. In practice, we need to make sure our initial guess of the root is close enough to the actual value. It's straightforward to make a reasonable guess. For example, when we try to determine the intersection of a light beam and a complex object, we can first calculate the intersection of the light beam and a simple bounding volume of the object.
Oftentimes, we find ourself calculate the intersection of a beam and a plane. But what we really want to know is the intersection of the beam and the face of the object. So we need to check if the intersection point lies inside a face. For example, after we determine the intersection of the beam emitted from the point \(\mathbf{P}\) and the plane of the triangle ABC, we need to check if the intersection point lies inside the triangle ABC.

A point in a convex area can be represented as barrycenter. In this case, it can be represented as
where \( w_i \gt 0 \) and \( w_1 + w_2 + w_3 = 1 \).
Reflection and Refraction

----- END -----
©2019 - 2022 all rights reserved