The test at the heart of every ray tracer
Ray intersection lab
A ray tracer spends most of its life answering one question: does this ray hit that? The notes leave the details to the interested reader — here they are. Aim the ray and watch the algebra work, term by term, as the answer flips between hit and miss.
The geometry
Drag to aim the ray
the ray
nearest hit, t0
far hit, t1
the object
The algebra
—
Controls
Result
—
Nearest hit distance t
—
Discriminant
—
Arithmetic cost
—
—
Why this one function decides everything. A path tracer at 1080p with 500 samples and 4 bounces fires on the order of
1010 rays, and each one has to be tested against the scene. Testing every ray against every triangle is hopeless, which is why no renderer does it: they build a hierarchy of bounding volumes and test those first, throwing away whole branches of the model with a handful of comparisons. The third mode above is that idea in miniature. Everything else in rendering performance — BVHs, kd-trees, the dedicated ray-triangle silicon in an RTX card — exists to run this test fewer times, or faster.