Non-sequential ray tracing
Rays find the nearest surface wherever it is. Beams double back, re-enter components and cross the table in any order — nothing is pre-sorted into a column of elements.
Build the setup. Watch the light do what light actually does.
A full optical bench in your browser, flat or in three dimensions. Drag lasers, lenses, prisms and interferometer arms onto a 25 mm breadboard and every beam is ray-traced live — real Snell refraction, real dispersion, real interference.
The tour walks you from an empty breadboard to a working measurement. After that you get a goal and a parts list, and you align it yourself. Nothing checks whether you clicked the right button — the criteria are read off the traced beam, so they tick when the optics genuinely works.
Every thumbnail below is the actual traced output of that setup — not an illustration. Pick one and it opens on the bench, live and editable.
The 3D bench gives every part a height and a tilt, so the beam can leave the table — a periscope, a two-level dog-leg, and screens that image in two dimensions instead of reading a single line.
Nothing here is a canned animation. Each ray carries a direction, a wavelength, a complex polarisation state and an accumulated optical path, and the picture is whatever falls out of that.
Rays find the nearest surface wherever it is. Beams double back, re-enter components and cross the table in any order — nothing is pre-sorted into a column of elements.
Prisms and windows refract through real index data for N-BK7, N-SF11, fused silica
and PMMA, including total internal reflection. Blue bends harder because n(λ) says so.
Two complex field components per ray, in-plane and vertical. Malus's law comes out exact, and a λ/4 plate at 45° produces genuinely circular light.
Fields are added as complex amplitudes with their phase, per wavelength. Fringes are a result of optical path difference, never a texture painted on.
A 40-micron slit collects light from a beam sampled every few hundred microns, the way a real mask does, and re-radiates it with the correct sinc envelope.
Power meters integrate over their aperture in mW, µW or nW. Screens report pitch and visibility — and say so when a pattern is finer than the sensor can resolve, rather than reporting a number they cannot measure.
The 3D mode is a separate tracer with its own verification, not the flat one dressed up. Rays carry a moving transverse basis, so polarisation decomposes exactly into s and p at every oblique surface.
The engine was run against analytic predictions before release. Residuals below are one or two screen bins — the sampling limit, not a modelling error.
| Test | Simulated | Theory | Note |
|---|---|---|---|
| Malus's law, 0–90° | exact | I₀cos²θ | 0.1% floor is the 1000:1 extinction ratio |
| Michelson fringe pitch | 0.867 mm | 0.906 mm | λ ∕ 2θ at 0.02° mirror tilt |
| Mach–Zehnder pitch | 0.600 mm | 0.604 mm | complementary output ports |
| Young's fringes, d = 0.2 mm | 1.524 mm | 1.582 mm | λL ∕ d, invariant to ray count |
| Grating order m = ±1, 550 nm | ±41.4 mm | ±41.4 mm | d(sinθ − sinθᵢ) = mλ |
| Lens focal spot | min at z = 100 | f = 100 mm | rms width symmetric about focus |
| Prism, 430 → 670 nm | +15.1 → −4.4 mm | monotonic in n | N-SF11, V = 25.7 |
A simulator that hides its boundaries teaches the wrong lesson. These are the edges.
Diffraction is flat-mode only. The 3D bench carries 17 of the 19 components; the double slit and the single slit stay in the top-down mode, where their fans are traced in one plane. In 2D, screens also read a line profile rather than an image.
No Fresnel coefficients. Glass faces use a flat 98.5% transmission with no angle or polarisation dependence, so there is no Brewster angle and no ghost reflections. Total internal reflection is modelled.
Geometric rays, not Gaussian beams. There is no waist, Rayleigh range or diffraction limit in free propagation, so a perfect lens focuses to a mathematical point.
Ideal thin lenses. No spherical aberration, coma or astigmatism, and no thick-lens geometry. Chromatic aberration is available, because that one follows from n(λ).
It opens on a live Michelson interferometer with tilt fringes on the screen. Nudge a mirror by a hundredth of a degree and watch them sweep.
A guided tour, then ten setups to build yourself.
Defaults are what the rig shipped with.