Ray Tracing

Ray tracing is finding the path of a light ray through an optical system. A centred optical system has the centres of its spherical surfaces on a certain line, the optic axis. A meridional plane is a plane containing the optic axis. A meridional ray is a ray lying in a meridional plane. A skew ray does not lie in a meridional plane. We'll only consder the tracing of meridional rays in this article. It is much simpler than tracing a genaral skew ray, and often furnishes the desired information. Spherical and chromatic aberration can be studied with meridional ray tracing.

Computer assistance is indispensable for the tedious calculations of ray tracing. A computer does not commit computational errors, and can perform iterative optimization or trace skew rays. Many programs are available commercially, or a basic program is easily written by the ray tracer. The pocket calculator has completely superseded the use of logarithms, but the arrangement of logarithmic calculations may serve as a model. An HP-48, for example, can be programmed to perform the calculations for a spherical surface, so it will not be difficult to ray trace a simple system manually. Manual ray tracing with a calculator is easy and instructive. Anyone writing or using a ray-tracing program should be familiar with manual ray tracing.

The figure gives everything necessary for meridional ray tracing. Light is assumed to move from left to right. The quantities are positive when measured as shown. The radius r is negative when the centre of the surface C is left of the vertex V. Distances are measured from V, positive to the right and negative to the left. Angles are measured in the directions shown. Rays are specified by their slope U and intercept L. The indices of refraction are n left of the surface, n' to its right. If n'>n the incident ray (U,L) is refracted towards the axis as ray (U',L'). In this case, U' > U and L' < L. The angles made with the radius are I and I', the angles of incidence and refraction, related by Snell's Law. The height of the ray as it meets the surface is h = r sin(U + I) = r sin(U' + I'). Starting with the ray (U,L), the equations are used in order, solving for the quantity identified. To move to the next surface to the right, the distance between vertices is subtracted from L', and this becomes the new L, while U = U' does not change.

The Law of Sines is used twice, once to find the angle of incidence and again to find the intercept of the refracted ray. In both cases, triangles such as CPO are used. The slope angle U is opposite the radius r, while the angle of incidence I is opposite the distance between C and O, or L - r. When the surface is plane, that is, r = ∞, we find I = -U, n' sin I' = n sin I, and U' = -I'. The formula for L' does not give a result for this case, and must be replaced by L' tan U' = L tan U = h.

Confidence in using these formulas will be provided by doing calculations for a concave surface, r < 0, interchanged indices of refraction, and rays with negative slopes, intercepts, or both. The results should agree with expectations. Handling the signs properly is important. If this is done correctly, the formulas will apply to all cases. An interesting problem that can be solved by manual ray tracing is determining the spherical aberration of a simple lens, of any shape you choose.

As an example, consider a plano-convex lens with n = 1.5, r1 = 150 mm, r2 = ∞, and thickness 4.0 mm. The paraxial thick lens equations give f = f' = 300 mm, A2F' = 297.33 mm, A2H' = -2.667 mm. Trace a horizontal ray at h = 25 mm meeting the spherical face. Then I = 9.5941°, I' = 6.3794 °, U' = 3.2147° and L' = 447.207 mm at the first face. At the second, L = 443.207 mm, I' = 4.8252°, h = 24.8931 mm = L' tan 4.8252° so L' = 294.88 mm, which is the BFL. The spherical aberration is 294.88 - 297.33 = -2.45 mm.

If this lens is turned around, the paraxial focal length is still 300 mm, and this equals the BFL. An incident ray at h = 25 mm is not refracted at the first surface, while at the second surface I = 9.5941°, I' = 14.4775°, so U' = 4.8834° and the Law of Sines gives L' - r = 440.508, or L' = 290.51 (r is negative!), which is the BFL. The spherical aberration is now 290.51 - 300.00 = -9.49 mm, considerably greater than before.

Graphical ray tracing presents a vivid view of the passage of rays through an optical system. It may be useful for deciding the placement of stops, or as a check on trigonometrical ray tracing. The best method is Young's construction, which involves the use of two auxiliary circles of radii n'r/n and nr/n'. No measuring of angles or numerical calculations are necessary (except perhaps in the case of plane surfaces). Computer programs may display ray traces on the video screen or allow them to be plotted.

For tracing skew rays, the aid of a computer is essential, unless you have lots of time and patience. Only the method will be outlined here, to help in preparing a program. A skew ray is specified by four parameters, instead of the two required for meridional rays. These are any two of the three direction cosines in a unit vector a along the ray, and the transverse coordinates x,y where the ray pierces a reference plane perpendicular to the optic axis. The sum of the squares of the direction cosines is unity. It is easy to transfer a ray from one reference plane to another. To find the point where a ray pierces a spherical surface, first find the vector from the reference point of the ray to the centre of the surface. Let this distance be d. The scalar product of this vector and the unit ray vector is the distance s along the ray to the point closest to the centre of the surface. The shortest distance between the ray and the centre is h = √(d2 - s2). Finally, the distance back along the ray to the point of incidence is √(r2 - h2). It is also possible to solve an oblique triangle with the same result. When this is done, the normal r at the point can be found, which together with the incident ray vector a determines the refracted ray vector a' at that point, and the refracted ray can now be referred to any reference plane, such as the one at the vertex of the next surface. The vector law of refraction is r x (na - n'a') = 0. A program can usually be verified by a meridional ray trace, which is easy to do manually. Tracing skew rays is essential for studying coma and astigmatism.


B. K. Johnson, Optics and Optical Instruments (New York: Dover, 1960). pp. 19-21. Explains how a logarithmic solution was laid out.

F. A. Jenkins and H. E. White, Fundamentals of Optics, 2nd ed. (New York: McGraw-Hill, 1950). Chapter 8. Thick-lens formulas are on p. 69. Location of principal planes illustrated on p. 66. Young's construction on p. 137f (called Huygens').

Return to Optics Index

Composed by J. B. Calvert
Created 19 September 2007
Last revised 22 September 2007