Photonica

Ray tracing

The calculation of how rays pass through an optical system, surface by surface, using the law of refraction or reflection at each one. Exact ray tracing of a 10 mm beam through a 50 mm plano-convex lens puts the marginal focus 0.54 mm short of the paraxial focus and gives a best-focus RMS spot radius of 9.2 µm, against a 3.6 µm Airy radius.

Ray tracing computes the path of individual rays through a lens, mirror system or any other arrangement of surfaces. Each ray starts at a point on the object with a direction, travels in a straight line to the next surface, and is refracted by Snell's law or reflected there; repeating this for every surface gives where the ray crosses the image plane. Tracing many rays from one object point shows how well the system forms an image, and it is the basic calculation of lens design. Two levels are used: paraxial tracing, which is linear and gives focal lengths and image positions, and exact (real) ray tracing, which is used to find the aberrations.

Paraxial and exact tracing

In paraxial tracing, the paraxial approximation replaces sin⁡θ\sin\theta by θ\theta and each surface by its curvature at the vertex. Every element then becomes a 2 × 2 ray transfer matrix, the trace is a matrix product, and the result is the first-order properties of the system: focal length, principal planes, pupil positions and magnification. A paraxial trace has no aberrations by construction.

Exact ray tracing keeps the full geometry. The ray is intersected with the true surface shape (sphere, conic, polynomial asphere or freeform), the surface normal N^\hat{N} is computed at that point, and the ray direction s^\hat{s} is refracted into s^′\hat{s}' by the vector form of Snell's law:

n′ (s^′×N^)=n (s^×N^).n'\,(\hat{s}' \times \hat{N}) = n\,(\hat{s} \times \hat{N}).

Written out with μ=n/n′\mu = n/n' and c=−s^⋅N^c = -\hat{s}\cdot\hat{N}, the new direction is

s^′=μ s^+(μc−1−μ2(1−c2))N^,\hat{s}' = \mu\,\hat{s} + \left(\mu c - \sqrt{1 - \mu^2(1 - c^2)}\right)\hat{N},

and a negative value under the square root signals total internal reflection. The difference between where exact and paraxial rays land is the transverse or longitudinal aberration.

Worked example: a plano-convex lens

An N-BK7 plano-convex lens (n = 1.5168 at 587.6 nm) of 50 mm focal length has a radius of curvature of 25.84 mm. With 5.3 mm center thickness and the curved side toward a collimated beam, the paraxial back focal length is 46.51 mm. An exact ray at 5 mm height meets the curved surface at 11.2° incidence and crosses the axis 0.54 mm before the paraxial focus; reversing the lens increases this longitudinal spherical aberration to 2.19 mm. Tracing a grid of rays over the full 10 mm pupil gives the spot diagram: an RMS spot radius of 27.5 µm at the paraxial focus and 9.2 µm at the plane of smallest RMS spot, 0.36 mm closer to the lens. The Airy disk radius at f/5 is 1.22λN1.22\lambda N = 3.6 µm, so the geometric blur dominates and this lens is not diffraction limited at full aperture, consistent with the wavefront figures under aberrations.

Spot diagrams and ray fans

A spot diagram plots the image-plane intersections of rays launched from one field point through a grid of pupil positions, often hexapolar or square, and is repeated for several field points and wavelengths. Its RMS radius is a quick figure of merit, and its shape identifies the aberration: a symmetric halo for spherical aberration, a comet for coma, a line or ellipse for astigmatism. When the spot is comparable to or smaller than the Airy disk, the geometric picture is no longer adequate, and the design is evaluated from the optical path differences of the same rays, which give the wavefront error, the point-spread function and the MTF.

Sequential and non-sequential tracing

Sequential tracing sends every ray through the surfaces in a fixed order, which is fast and suits imaging design and optimization: the software adjusts radii, thicknesses and glasses to minimize a merit function built from spot sizes or wavefront errors. Non-sequential tracing lets each ray hit any surface in any order, split at partial reflections, and scatter from rough or painted surfaces according to a scattering model, which is needed for stray light and ghost analysis, illumination optics, light pipes and integrating cavities. It needs far more rays, often millions.

Pitfalls

  • Too few rays or a coarse pupil grid, which under-samples the edge of the pupil, where aberrations are largest.
  • Rays aimed at the paraxial entrance pupil, which do not fill the real stop when the pupil is aberrated.
  • Treating a geometric spot as the image when it is smaller than the diffraction limit.
  • Ignoring coatings and polarization; plain geometric tracing carries no amplitude or phase unless the software adds Fresnel and coating calculations along each path.

Common questions

What is the difference between paraxial and real ray tracing?

Paraxial tracing linearizes Snell's law and gives the ideal first-order image; real tracing uses the exact law and surface shapes and reveals the aberrations. In the example above the paraxial trace predicts a point focus and the real trace a 9 µm RMS blur.

When is ray tracing not enough?

When diffraction dominates: near a diffraction-limited focus, in waveguides comparable in size to the wavelength, and for grating efficiencies. Wave-optics methods take over there, often starting from a ray-traced wavefront at the exit pupil.

References: W. J. Smith, Modern Optical Engineering, 4th ed. (McGraw-Hill, 2008); R. Kingslake and R. B. Johnson, Lens Design Fundamentals, 2nd ed. (Academic Press, 2010); M. Born and E. Wolf, Principles of Optics, 7th ed. (Cambridge University Press, 1999); W. T. Welford, Aberrations of Optical Systems (Adam Hilger, 1986).