Wavefront detector
Fits ray angle against position across its face to report whether the beam is collimated, converging or diverging, and its full cone angle.
Open in the canvas →In the real world
Every other detector on this bench answers how much light arrived, and maybe what colour it was. A wavefront sensor answers a different question entirely: what shape is the light. A beam's wavefront is the surface joining points of equal phase, and it is always perpendicular to the local direction of travel. A perfectly collimated beam has flat wavefronts; a beam converging to a focus has spherical ones centred on that focus. Real optics never produce either exactly — aberrations, thermal lensing, atmospheric turbulence and mounting stress all leave the wavefront misshapen, and that misshape is what limits how tightly a beam can be focused.
You cannot photograph a wavefront. Detectors respond to intensity, and phase information is lost the instant light is absorbed. So every wavefront sensor works indirectly, by converting phase structure into something an intensity detector can see. The Shack–Hartmann sensor does it by measuring direction.
From Hartmann's mask to Shack's lenslets
The lineage starts with a mask. In 1904 Johannes Hartmann tested telescope optics by covering the aperture with a screen of holes and photographing where each pencil of light landed[1] — displaced spots meant the rays were not going where a perfect optic would send them. The method worked but wasted almost all the light and gave fuzzy shadow spots that were hard to locate precisely.
In the late 1960s Roland Shack and Ben Platt made the change that turned it into an instrument: they replaced each hole with a small lenslet[1]. A hole casts a shadow; a lenslet focuses. The array now uses essentially all the incident light, and each sub-aperture produces a tight, bright spot whose centroid can be located to a small fraction of a pixel. That single substitution is what makes the modern sensor both efficient and precise.
What the spots actually measure
Each lenslet samples one small patch of the incoming wavefront. Over a patch that small the wavefront is essentially a tilted plane, and a tilted plane wave focuses to a spot displaced from the lenslet's axis in proportion to that tilt. With lenslet focal length f, a local wavefront slope θ moves the spot by
So a Shack–Hartmann sensor is fundamentally a gradient sensor. It returns an array of local slopes, and the wavefront is recovered afterwards by integrating them — either zonally, stitching patch to patch, or modally, by least-squares fitting an orthogonal set such as the Zernike polynomials, whose low-order terms are the familiar named aberrations: tilt, defocus, astigmatism, coma, spherical. Reporting a beam as "0.2 waves RMS with 0.15 waves of coma" means exactly this fit was performed on the slope map.
The tradeoff every design lives with
Two numbers fight each other. Sensitivity improves with lenslet focal length, since a longer f converts the same small slope into a larger, more measurable displacement. Dynamic range works the other way: a spot must stay inside its own sub-aperture cell to remain attributable to its lenslet, so the largest measurable slope is roughly the lenslet pitch p over twice the focal length[2].
Spatial resolution is a third constraint: the wavefront is only sampled once per lenslet, so structure finer than the pitch is simply averaged away. Conventional refractive arrays sit around a hundred lenslets per square millimetre, which is why classical Shack–Hartmann sensors suit smooth, slowly varying wavefronts and not sharply structured ones. Recent work replaces the refractive lenslets with metasurfaces, which set phase by subwavelength structure rather than by curvature and so decouple the packing density from the focal length: a 2024 demonstration reached a sampling density of 5963 lenslets/mm² with an 8° acceptance angle, and used it for single-shot phase imaging of biological tissue[3].
One limit is structural rather than technical. Because the instrument measures a gradient, a genuine discontinuity in the wavefront is invisible to it[1] — a step or a branch point has no finite slope to sample, so no amount of sensitivity or sampling density recovers it.
Where they are used
In adaptive optics, a wavefront sensor and a deformable mirror form a closed loop: the sensor measures the distortion, the mirror applies its negative, and an astronomical telescope recovers near-diffraction-limited imaging through atmospheric turbulence. The same loop sharpens deep imaging in multiphoton microscopy, where the specimen itself is the aberrating medium. In ophthalmology, aberrometry of the eye's own wavefront is what makes wavefront-guided LASIK and PRK possible[1]. And in the laboratory, wavefront sensors characterise laser beam quality and M², verify collimation, test optical surfaces in transmission or double-pass reflection, and align systems in real time[4].
In OpticalSetup
OpticalSetup traces rays, and a ray is by definition perpendicular to the wavefront — so ray direction is local wavefront slope, already available without any lenslets. The wavefront detector uses that directly: at its sensor face it takes every arriving ray's height h across the face and its angle θ to the face normal, and least-squares fits a straight line through the resulting θ(h).
That fit is the measurement. Its intercept is the mean tilt of the whole bundle and is discarded, which is why steering the beam in at an angle does not change the reading — a tilted flat wavefront is still flat. Its gradient dθ/dh is the wavefront curvature, and its sign says which way: negative for a converging beam, positive for a diverging one, and a magnitude below 0.05° across the beam reports as collimated.
Both quantities come out exact rather than approximate. A 20 mm beam through an f = 100 mm lens gives a measured full angle of 11.43°, against 11.42° from the geometry; and the fitted 1/R tracks the signed distance to focus to the tenth of a millimetre — −20.0 mm when the sensor face sits 80 mm past that lens, +5.0 mm when it sits 5 mm beyond the focus. The reported cone angle is constant on both sides of the focus, as it should be: the beam narrows and re-expands, but the cone it belongs to does not change.
A straight line through θ(h) has exactly one shape term in it, and that term is defocus. Tilt is fitted and thrown away; everything above defocus — astigmatism, coma, spherical aberration, and every higher Zernike — has nowhere to go. Send a deliberately aberrated beam in (a fast singlet with visible spherical aberration, say) and the fan of ray angles is still collapsed to one average slope and reported as a single clean convergence angle. The aberration is precisely the departure from that straight line, and it is exactly what the fit discards. This instrument tells you whether a beam is converging, diverging or collimated, and how hard; it does not tell you whether it is any good.
Some of that is structural rather than unimplemented. The tracer is a 2D meridional section with one transverse axis, so astigmatism — different curvature in x and y — is not representable in the first place, and neither is any azimuthal aberration. There is also no sensor: no lenslet array, no spots, no centroiding, no pixel noise, and therefore none of the sensitivity-versus-dynamic-range tradeoff that dominates real instrument design. Every arriving ray is used at full precision, so there is no maximum measurable slope and no minimum detectable one.
The reading is geometric throughout: an angle in degrees, never an optical path difference in waves, and with no wavelength dependence at all. There is no RMS or peak-to-valley wavefront error, no Zernike decomposition, and no Strehl ratio. Finally, the fit needs at least two rays at different heights — a single ray, or a source in line mode, has no gradient to measure and reports collimated by default rather than declining to answer.
Related components
References
- Shack–Hartmann wavefront sensor — Wikipedia (Hartmann’s 1904 mask, Shack and Platt’s lenslet substitution, insensitivity to wavefront discontinuities, ophthalmic and astronomical use)
- RP Photonics Encyclopedia — Shack–Hartmann Wavefront Sensors (lenslet geometry, sensitivity and dynamic-range limits)
- Go et al., “Meta Shack–Hartmann wavefront sensor with large sampling density and large angular field of view,” Light: Science & Applications 13, 187 (2024)
- Axiom Optics — Wavefront sensing applications (optical testing, beam diagnostics and M², adaptive optics, real-time alignment)