All Tools
STEM

Optics & Ray Tracing Playground

Simulate geometric & physical optics in real time with laser beams, convex & concave lenses, mirrors, prisms, Snell's Law refraction, total internal reflection, and chromatic dispersion.

Source:
Optics:
Presets:
Ambient Medium:
Optical Bench Canvas • Drag components to move • Drag edge rings to rotate • Click to inspect Active Rays: 0
Drag elements with mouse/touch. Press Delete to remove selected element.
Selected Element None
Click any light source, lens, mirror, or prism on the bench to adjust its properties.
X
Y
Nudge:
Active Components 0
Live Ray-Tracing Analytics
Move rays or components to view dynamic Snell's Law & critical angle readouts.
Live Step-by-Step Optical Calculation Walkthrough Geometric Optics
1. Laws of Reflection & Snell's Law of Refraction
Law of Reflection:

For any specular reflective surface, the incident ray, the reflected ray, and the surface normal all lie in the same plane, and:

θi = θr
Angle of incidence equals angle of reflection (measured from the surface normal).
Snell's Law of Refraction (Willebrord Snell, 1621):

When light crosses the boundary between two optical media with differing refractive indices (n1 and n2):

n1 • sin(θ1) = n2 • sin(θ2)
where n = c / v is the medium refractive index (ratio of vacuum speed of light to medium phase velocity).
Physical Insight: Entering a denser medium (n2 > n1), light slows down and bends towards the normal. Entering a rarer medium (n2 < n1), it speeds up and bends away from the normal.
2. Total Internal Reflection (TIR) & Critical Angle
Total Internal Reflection Condition:

When light travels from an optically denser medium to a rarer medium (n1 > n2), there exists an angle of incidence for which the refracted ray travels along the boundary (θ2 = 90°).

sin(θc) = n2 / n1
θc = arcsin(n2 / n1)
If θ1 > θc, 100% of the light is reflected internally with zero transmission loss.
Practical Critical Angles (into Air, n2 = 1.00):
Material Refractive Index (n) Critical Angle (θc) Application
Water 1.333 48.6° Underwater Snell's Window
Crown Glass 1.520 41.1° Porro Prisms in Binoculars
Diamond 2.417 24.4° Brilliant gem sparkle via light trapping
3. Thin Lens Equation & Magnification
Gaussian Thin Lens Equation:

Relates object distance (do), image distance (di), and focal length (f):

(1 / f) = (1 / do) + (1 / di)
Transverse Magnification (M):
M = hi / ho = −(di / do)
Cartesian Sign Conventions:
  • Convex (Converging) Lens: Focal length f > 0 (positive).
  • Concave (Diverging) Lens: Focal length f < 0 (negative).
  • Real Image: Formed on opposite side of lens (di > 0, inverted).
  • Virtual Image: Formed on same side as object (di < 0, upright).
4. Chromatic Dispersion & Lensmaker's Formula
Lensmaker's Equation (Thin Lens in Air):
(1 / f) = (n − 1) • [ (1 / R1) − (1 / R2) ]
where R1 and R2 are the radii of curvature of the two lens surfaces.
Cauchy's Dispersion Equation:

The refractive index of transparent media decreases with increasing wavelength (λ):

n(λ) = A + (B / λ2) + (C / λ4)
Shorter wavelengths (blue/violet, λ ≈ 400 nm) experience a higher refractive index than longer wavelengths (red, λ ≈ 700 nm), causing angular dispersion (rainbow creation through prisms).