In physics, **ray tracing** is a method for calculating the path of waves or particles through a system with regions of varying propagation velocity, absorption characteristics, and reflecting surfaces. Under these circumstances, wavefronts may bend, change direction, or reflect off surfaces, complicating analysis. Ray tracing solves the problem by repeatedly advancing idealized narrow beams called *rays* through the medium by discrete amounts. Simple problems can be analyzed by propagating a few rays using simple mathematics. More detailed analysis can be performed by using a computer to propagate many rays.

When applied to problems of electromagnetic radiation, ray tracing often relies on approximate solutions to Maxwell's equations that are valid as long as the light waves propagate through and around objects whose dimensions are much greater than the light's wavelength. Ray theory does not describe phenomena such as interference and diffraction, which require wave theory (involving the phase of the wave).

- Dispersion leads to chromatic aberration
- Polarization
- Laser light effects
- Thin film interference (optical coating, soap bubble) can be used to calculate the reflectivity of a surface.

For the application of lens design, two special cases of wave interference are important to account for. In a focal point, rays from a point light source meet again and may constructively or destructively interfere with each oth

For the application of lens design, two special cases of wave interference are important to account for. In a focal point, rays from a point light source meet again and may constructively or destructively interfere with each other. Within a very small region near this point, incoming light may be approximated by plane waves which inherit their direction from the rays. The optical path length from the light source is used to compute the phase. The derivative of the position of the ray in the focal region on the source position is used to obtain the width of the ray, and from that the amplitude of the plane wave. The result is the point spread function, whose Fourier transform is the optical transfer function. From this, the Strehl ratio can also be calculated.

The other special case to consider is that of the interference of wavefronts, which are approximated as planes. However, when the rays come close together or even cross, the wavefront approximation breaks down. Interference of spherical waves is usually not combined with ray tracing, thus diffraction at an aperture cannot be calculated. However these limitations can be resolved by an advanced modeling technique called Field Tracing. Field Tracing is a modelling technique, combining geometric optics with physical optics enabling to overcome the limitations of interference and diffraction in designing.

The ray tracing techniques are

The other special case to consider is that of the interference of wavefronts, which are approximated as planes. However, when the rays come close together or even cross, the wavefront approximation breaks down. Interference of spherical waves is usually not combined with ray tracing, thus diffraction at an aperture cannot be calculated. However these limitations can be resolved by an advanced modeling technique called Field Tracing. Field Tracing is a modelling technique, combining geometric optics with physical optics enabling to overcome the limitations of interference and diffraction in designing.

The ray tracing techniques are used to optimize the design of the instrument by minimizing aberrations, for photography, and for longer wavelength applications such as designing microwave or even radio systems, and for shorter wavelengths, such as ultraviolet and X-ray optics.

Before the advent of the computer, ray tracing calculations were performed by hand using trigonometry and logarithmic tables. The optical formulas of many classic photographic lenses were optimized by roomfuls of people, each of whom handled a small part of the large calculation. Now they are worked out in optical design software. A simple version of ray tracing known as ray transfer matrix analysis is often used in the design of optical resonators used in lasers. The basic principles of the most frequently used algorithm could be found in Spencer and Murty's fundamental paper: "General ray tracing Procedure".^{[4]}

In seismology, geophysicists use ray tracing to aid in earthquake location and tomographic reconstruction of the Earth's interior.^{[5]}^{[6]} Seismic wave velocity varies within and beneath Earth's crust, causing these waves to bend and reflect. Ray tracing may be used to compute paths through a geophysical model, following them back to their source, such as an earthquake, or deducing the properties of the intervening material.^{[7]} In particular, the discovery of the seismic shadow zone (illustrated at right) allowed scientists to deduce the presence of Earth's molten core.

Energy transport and the propagation of waves plays an important role in the wave heating of plasmas. Power-flow trajectories of electromagnetic waves through a spatially nonuniform plasma can be computed using direct solutions of Maxwell's equations. Another way of computing the propagation of waves in the plasma medium is by using Ray tracing method. Studies of wave propagation in plasmas using ray tracing method can be found in.^{[8]}

In general relativity, where gravitational lensing can occur, the geodesics of the light ray

Energy transport and the propagation of waves plays an important role in the wave heating of plasmas. Power-flow trajectories of electromagnetic waves through a spatially nonuniform plasma can be computed using direct solutions of Maxwell's equations. Another way of computing the propagation of waves in the plasma medium is by using Ray tracing method. Studies of wave propagation in plasmas using ray tracing method can be found in.^{[8]}

In general relativity, where gravitational lensing can occur, the geodesics of the light rays receiving at the observer are integrated backwards in time until they hit the region of interest. Image synthesis under this technique can be view as an extension of the usual ray tracing in computer graphics.^{[9]}^{[10]} An example of such synthesis is found in the 2014 film *Interstellar*.^{[11]}