What is a ray?

This article will discuss how rays are defined and how they're related to wavefronts. We will show how rays are used in OpticStudio and will discuss ray characteristics such as amplitude, phase, and optical path, as well as their interactions with media.

Authored By Ken Moore


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.

This article will show how rays are defined and used in OpticStudio.

Rays in OpticStudio

OpticStudio 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 OpticStudio 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 coordinates are measured in units of length commonly called "lens units".

Direction is defined by:



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:



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

OpticStudio 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:



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

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



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



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



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. The amplitude of the ray is also reduced when traveling through glass due to bulk absorption. All these effects are modeled as part of the polarization ray trace feature in OpticStudio, which are 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



where n is the index of refraction in the media, λ0 is the vacuum wavelength, and φ is measured in radians.

For homogeneous, isotropic media the optical path length (OPL) of a ray is the product of the distance traveled by the ray multiplied 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 = OPLray - OPLchief


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. OpticStudio uses OPD as the primary means of computing and displaying wavefront aberrations.


Ray sampling

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

Many OpticStudio features, such as PSF or MTF analysis, use grids of rays to sample the entire pupil. Usually, these grids are specified by N×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.


1. Shannon, R. R., The Art and Science of Optical Design, Cambridge University Press.
2. Bass, Michael, Handbook of Optics Volume I, McGraw Hill


Was this article helpful?
5 out of 5 found this helpful



Article is closed for comments.