Ray–Surface Intersection

An interactive geometry primer

A ray tracer renders images by casting rays from a camera through every pixel and finding where each ray hits a surface. This tool explores the core mathematical question: how do you compute that intersection?

Choose a geometry — sphere, cylinder, or torus — and explore it across three lenses:

📐
Theory
Derive the intersection polynomial step by step
🎮
Intuition
Aim a ray interactively and watch the roots move
💻
Code
Edit live GLSL — see the shader render in real time
§ 1 — Ray Casting
drag to orbit
§ 2 — 🔵 Sphere — Degree-2 Polynomial
drag to orbit
§ 3 — 🔷 Cylinder — Degree-2 Barrel + Caps
drag to orbit
§ 4 — 🍩 Torus — Degree-4 Polynomial
drag to orbit