This article explains:

- What a ray is
- Rays and wavefronts
- Coordinates, cosines, and propagation
- Refraction, reflection, and diffraction
- Amplitude. phase and optical path

Authored By: Ken Moore

Published On: July 25, 2005

**What is a ray?**

Rays are used to model the propagation of light through optical systems. For homogeneous, isotropic media, such as common optical glass, rays are straight lines. Rays are normal to the local wavefront and point along the direction of energy flow. Rays have position, direction, amplitude, phase, and possibly polarization data associated with them.
At surfaces between different types of media, rays can refract, reflect, or diffract. The interface between different media will generally alter the direction and other properties of the ray.

Zemax uses ray tracing to model the propagation of light from the source point, through the optical system, and on to the final image surface. The resulting distribution of amplitude, phase, and polarization of a collection of rays can be used to predict a wide range of optical phenomena.

The ray model is a very convenient, powerful, and accurate means for propagating light.

When tracing through inhomogeneous media, such as gradient index glass, rays will in general follow curved paths. Some materials, such as uniaxial crystals, are not isotropic, and within these types of media rays are not normal to the wavefront. Both of these cases are handled by Zemax and are described in other articles. Polarization ray tracing is a complex subject and is also described in a separate article.

**Rays and wavefronts**

Rays are closely related to wavefronts. A wavefront is an imaginary surface where the electric field of an optical beam has a uniform phase with respect to some reference point. For example, imagine a coherent point source radiating into a sphere. At any distance away from the source, there is a spherical wavefront with a uniform phase.

It is numerically difficult to propagate wavefronts directly. Fortunately, direct propagation of the wavefront is often only required near the focus of a beam. Far from focus, it is much easier to convert the wavefront to rays and then propagate the rays.

At any point on a wavefront, some small area may be selected. The small area can be thought of as a piece of a plane wave. The ray position and coordinates are defined by the position of the small area and the orientation of the normal vector to this small plane wave, respectively. The integrated energy or flux of the beam over this small area may be assumed to be entirely represented by the ray. For computations near focus, such as the Huygens Point Spread Function, the rays can be converted back into wavefronts.

Coordinates, cosines, and propagation

The two most fundamental properties of a ray are position and direction.

Position is defined by the vector **r** = {x, y, z}. The coordinates are measured in units of length commonly called "lens units".

Direction is defined by the vector **k** = {l, m, n}. The values are the direction cosines of the unit vector that points along the ray.

Both **r** and **k** may be measured in surface local coordinates, or in global coordinates relative to some reference frame.

If a ray is propagated a distance t, where t is a length in lens units, the new coordinates are given by **r**' = **r** + t **k**.

For a discussion of how rays are traced to specific types of optical surfaces, see reference 1.

Zemax can trace a single ray and create a table of the ray coordinates and cosines, as well as other data, using the Analysis > Calculations > Ray Trace feature.

The coordinates of the ray are listed at each surface, starting from the object. The direction cosines listed for a surface are always after refraction, reflection, or diffraction into the next surface.

**Refraction, reflection, and diffraction**

Rays are traced to the point of intersection with a surface that defines the boundary between different media. At this interface, rays will refract according to Snell's famous law, here written in the vector form:

n' (**N** x **k'**) = n (**N** x **k**)

where **N** is the unit normal vector of the surface at the point of intersection, and **k** is the ray direction cosine vector. Primed quantites are after refraction, and unprimed quantities are prior to refraction.

For reflection, the index of refraction is unimportant, and Snell's law simplifies to

**N** x **k'** = -**N** x **k**

This expression may be derived by setting n' = -n, and this convention is often used by ray tracing programs to eliminate the distinction between refraction and reflection.

Some optical surfaces, such as diffractive gratings, also bend rays. The general form of the diffraction expression, which includes refractive or reflective effects, is

n' (**N** x **k'**) = n (**N** x **k**) + M (l/p) **q**

where M is the diffraction order, l is the wavelength, p is the local grating period (length per 2p period), q is a unit vector tangent to the surface and parallel to the local grating lines. Note if M is zero, or p is infinite, the general grating expression simplifies to Snell's law.

For a more comprehensive discussion of this topic, see reference 2.

**Amplitude, phase and optical path**

A ray models propagation of an electric field, and therefore has both magnitude and phase. The ray amplitude is a complex number of the form
Ae^{-if}

The intensity of a ray is given by the square of the ray amplitude, or A*A. The intensity of the ray can be measured in units of power, energy, power per unit time, or energy per unit time. What units are appropriate to use for rays depends on the details of the specific computation being performed. Note the term intensity used here is not the same as is commonly used in radiometry, where intensity is power per solid angle.

The ray amplitude is generally reduced whenever the ray crosses an index boundary, such as refracting from air into glass. The presence of thin films on the glass alters the amount of amplitude loss. Amplitude is also reduced due to bulk absorption traveling through glass. All of these effects are modeled as part of the polarization ray trace feature in Zemax discussed in a separate article.

As a ray propagates, the phase of the ray changes. The phase change due to propagation of a distance t is given by

f = 2ptn / l

where n is the index of refraction in the media, l is the wavelength, and f is measured in radians.

For homogeneous, isotropic media the optical path length of a ray is the product of the distance traveled by the ray multipled by the refractive index through which the ray travels:

OPL = nt

where n is the index of refraction and t is the distance traveled. The OPL may be computed for a complete optical system, from source point to image surface, by summing the OPL for each media between each optical surface.

For best image quality, every ray should intercept the image at the same point, and with the same phase. For this reason, it is more convenient to keep track of the optical path length of a ray as the difference between the ray and some reference ray, usually the chief ray. It is also convenient, for reasons described in reference 1, to measure the OPL not from the source to the image, but from the source to the reference sphere. The reference sphere is a spherical surface centered on the point where the chief ray intersects the image surface. The radius of the reference sphere is defined by the distance from the image surface to the paraxial exit pupil. This quantity is called optical path difference (OPD):

OPD = OPL_{ray }- OPL_{chief}

Where both OPL values are measured from the source to the reference sphere. The OPD is what is displayed on the OPD fan:

The OPD can be used to reconstruct the wavefront from the ray data. Zemax uses OPD as the primary means of computing and displaying wavefront aberrations.

**Ray sampling**

A single ray is generally not adequate to to model a wavefront. Instead, a collection of rays is used. The most common collection of rays is a rectangular grid.

Many Zemax features, such as PSF or MTF analysis, use grids of rays to sample the entire pupil. Usually, these grids are specified by N x N, where N is an integer power of 2. For example, the grid sizes are typically 32 x 32, 64 x 64, 128 x 128, etc.

The higher the pupil sampling, the greater the accuracy of the computation and the longer the data will take to compute.

The amount of energy associated with each ray is proportional to the pupil area associated with each ray. If more rays are traced in the pupil, each ray will have less energy.

**Summary and references**

This article has provided a general description of what a ray is. In summary:

- Rays are lines that model energy propagation through media such as glass.
- Rays have position and direction, and may also have associated phase, amplitude, and polarization data.
- The direction of a ray is normal to the wavefront (surfaces of constant phase) in isotropic media. Energy flows along the ray direction.
- The amplitude of the ray indicates how much energy or power the wavefront has over some local area.
- The optical path length of a ray indicates the phase of the electric field, which is useful for performing wavefront aberration and diffraction calculations.
- Collections of rays, such as grids of rays, may be used to model entire wavefronts. Each ray in the collection is associated with a fininte amount of power, energy, or flux.

**References**
1. Shannon, R. R., The Art and Science of Optical Design, Cambridge University Press.

2. Bass, Michael, Handbook of Optics Volume I, McGraw Hill