In physics, ray tracing is a method for calculating the path of
wave
In physics, mathematics, and related fields, a wave is a propagating dynamic disturbance (change from equilibrium) of one or more quantities. Waves can be periodic, in which case those quantities oscillate repeatedly about an equilibrium (r ...
s or
particle
In the physical sciences, a particle (or corpuscule in older texts) is a small localized object which can be described by several physical or chemical properties, such as volume, density, or mass.
They vary greatly in size or quantity, fro ...
s through a system with regions of varying propagation
velocity
Velocity is the directional speed of an object in motion as an indication of its rate of change in position as observed from a particular frame of reference and as measured by a particular standard of time (e.g. northbound). Velocity i ...
, absorption characteristics, and reflecting surfaces. Under these circumstances,
wavefront
In physics, the wavefront of a time-varying ''wave field'' is the set ( locus) of all points having the same '' phase''. The term is generally meaningful only for fields that, at each point, vary sinusoidally in time with a single temporal fre ...
s 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
In physics, electromagnetic radiation (EMR) consists of waves of the electromagnetic (EM) field, which propagate through space and carry momentum and electromagnetic radiant energy. It includes radio waves, microwaves, infrared, (visible ...
, ray tracing often relies on approximate solutions to
Maxwell's equations
Maxwell's equations, or Maxwell–Heaviside equations, are a set of coupled partial differential equations that, together with the Lorentz force law, form the foundation of classical electromagnetism, classical optics, and electric circuits.
Th ...
that are valid as long as the
light waves propagate through and around objects whose dimensions are much greater than the light's
wavelength
In physics, the wavelength is the spatial period of a periodic wave—the distance over which the wave's shape repeats.
It is the distance between consecutive corresponding points of the same phase on the wave, such as two adjacent crests, tr ...
. Ray theory does not describe phenomena such as
interference and
diffraction, which require
wave theory
In historical linguistics, the wave model or wave theory (German ''Wellentheorie'') is a model of language change in which a new language feature (innovation) or a new combination of language features spreads from its region of origin, affecting ...
(involving the
phase of the wave).
Technique

Ray tracing works by assuming that the particle or wave can be modeled as a large number of very narrow beams (
rays), and that there exists some distance, possibly very small, over which such a ray is locally straight. The ray tracer will advance the ray over this distance, and then use a
local derivative of the medium to calculate the ray's new direction. From this location, a new ray is sent out and the process is repeated until a complete path is generated. If the simulation includes solid objects, the ray may be tested for intersection with them at each step, making adjustments to the ray's direction if a collision is found. Other properties of the ray may be altered as the simulation advances as well, such as
intensity,
wavelength
In physics, the wavelength is the spatial period of a periodic wave—the distance over which the wave's shape repeats.
It is the distance between consecutive corresponding points of the same phase on the wave, such as two adjacent crests, tr ...
, or
polarization
Polarization or polarisation may refer to:
Mathematics
*Polarization of an Abelian variety, in the mathematics of complex manifolds
*Polarization of an algebraic form, a technique for expressing a homogeneous polynomial in a simpler fashion by ...
. This process is repeated with as many rays as are necessary to understand the behavior of the system.
Uses
Astronomy
Ray tracing is being increasingly used in astronomy to simulate realistic images of the sky. Unlike conventional simulations, ray tracing does not use the expected or calculated PSF of a telescope and instead traces journey of each photon from entering the upper atmosphere to the detector. Most of the dispersion and distortion, arising mainly from atmosphere, optics and detector are taken into account. While this method of simulating images is inherently slow, advances in CPU and GPU capabilities has somewhat mitigated this problem. It can also be used in designing telescopes. Notable examples include
Large Synoptic Survey Telescope where this kind of ray tracing was first used with PhoSim to create simulated images.
Radio signals

One particular form of ray tracing is
radio
Radio is the technology of signaling and communicating using radio waves. Radio waves are electromagnetic waves of frequency between 30 hertz (Hz) and 300 gigahertz (GHz). They are generated by an electronic device called a transm ...
signal ray tracing, which traces radio signals, modeled as rays, through the
ionosphere where they are refracted and/or reflected back to the Earth. This form of ray tracing involves the
integration
Integration may refer to:
Biology
* Multisensory integration
* Path integration
* Pre-integration complex, viral genetic material used to insert a viral genome into a host genome
*DNA integration, by means of site-specific recombinase technolo ...
of differential equations that describe the propagation of
electromagnetic waves
In physics, electromagnetic radiation (EMR) consists of waves of the electromagnetic (EM) field, which propagate through space and carry momentum and electromagnetic radiant energy. It includes radio waves, microwaves, infrared, (visible) lig ...
through dispersive and
anisotropic
Anisotropy () is the property of a material which allows it to change or assume different properties in different directions, as opposed to isotropy. It can be defined as a difference, when measured along different axes, in a material's phys ...
media such as the ionosphere. An example of physics-based radio signal ray tracing is shown to the right. Radio communicators use ray tracing to help determine the precise behavior of radio signals as they propagate through the ionosphere.
The image at the right illustrates the complexity of the situation. Unlike optical ray tracing where the medium between objects typically has a constant
refractive index
In optics, the refractive index (or refraction index) of an optical medium is a dimensionless number that gives the indication of the light bending ability of that medium.
The refractive index determines how much the path of light is bent, o ...
, signal ray tracing must deal with the complexities of a spatially varying refractive index, where changes in ionospheric
electron
The electron (, or in nuclear reactions) is a subatomic particle with a negative one elementary electric charge. Electrons belong to the first generation of the lepton particle family,
and are generally thought to be elementary partic ...
densities influence the refractive index and hence, ray trajectories. Two sets of signals are broadcast at two different elevation angles. When the main signal penetrates into the ionosphere, the magnetic field splits the signal into two component waves which are separately ray traced through the ionosphere. The
ordinary wave (red) component follows a path completely independent of the
extraordinary wave (green) component.
Ocean acoustics
Sound velocity in the
ocean
The ocean (also the sea or the world ocean) is the body of salt water that covers approximately 70.8% of the surface of Earth and contains 97% of Earth's water. An ocean can also refer to any of the large bodies of water into which the wo ...
varies with depth due to changes in
density
Density (volumetric mass density or specific mass) is the substance's mass per unit of volume. The symbol most often used for density is ''ρ'' (the lower case Greek letter rho), although the Latin letter ''D'' can also be used. Mathematicall ...
and
temperature
Temperature is a physical quantity that expresses quantitatively the perceptions of hotness and coldness. Temperature is measured with a thermometer.
Thermometers are calibrated in various temperature scales that historically have relied on ...
, reaching a
local minimum near a depth of 800–1000 meters. This local minimum, called the
SOFAR channel, acts as a
waveguide
A waveguide is a structure that guides waves, such as electromagnetic waves or sound, with minimal loss of energy by restricting the transmission of energy to one direction. Without the physical constraint of a waveguide, wave intensities de ...
, as sound tends to bend towards it. Ray tracing may be used to calculate the path of sound through the ocean up to very large distances, incorporating the effects of the SOFAR channel, as well as
reflections and
refraction
In physics, refraction is the redirection of a wave as it passes from one medium to another. The redirection can be caused by the wave's change in speed or by a change in the medium. Refraction of light is the most commonly observed phenomen ...
s off the ocean surface and bottom. From this, locations of high and low signal intensity may be computed, which are useful in the fields of
ocean acoustics,
underwater acoustic communication
Underwater acoustic communication is a technique of sending and receiving messages below water. There are several ways of employing such communication but the most common is by using hydrophones. Underwater communication is difficult due to facto ...
, and
acoustic thermometry.
Optical design
Ray tracing may be used in the design of
lenses
A lens is a transmissive optical device which focuses or disperses a light beam by means of refraction. A simple lens consists of a single piece of transparent material, while a compound lens consists of several simple lenses (''elements ...
and
optical systems, such as in
camera
A camera is an optical instrument that can capture an image. Most cameras can capture 2D images, with some more advanced models being able to capture 3D images. At a basic level, most cameras consist of sealed boxes (the camera body), with a ...
s,
microscope
A microscope () is a laboratory instrument used to examine objects that are too small to be seen by the naked eye. Microscopy is the science of investigating small objects and structures using a microscope. Microscopic means being invisibl ...
s,
telescopes
A telescope is a device used to observe distant objects by their emission, absorption, or reflection of electromagnetic radiation. Originally meaning only an optical instrument using lenses, curved mirrors, or a combination of both to obser ...
, and
binoculars
Binoculars or field glasses are two refracting telescopes mounted side-by-side and aligned to point in the same direction, allowing the viewer to use both eyes ( binocular vision) when viewing distant objects. Most binoculars are sized to be hel ...
, and its application in this field dates back to the 1900s. ''Geometric ray tracing'' is used to describe the propagation of light rays through a lens system or
optical
Optics is the branch of physics that studies the behaviour and properties of light, including its interactions with matter and the construction of instruments that use or detect it. Optics usually describes the behaviour of visible, ultrav ...
instrument, allowing the image-forming properties of the system to be modeled. The following effects can be integrated into a ray tracer in a straightforward fashion:
*
Dispersion leads to
chromatic aberration
In optics, chromatic aberration (CA), also called chromatic distortion and spherochromatism, is a failure of a lens to focus all colors to the same point. It is caused by dispersion: the refractive index of the lens elements varies with the ...
*
Polarization
Polarization or polarisation may refer to:
Mathematics
*Polarization of an Abelian variety, in the mathematics of complex manifolds
*Polarization of an algebraic form, a technique for expressing a homogeneous polynomial in a simpler fashion by ...
**
Crystal optics
**
Fresnel equations
*
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
Focal point may refer to:
* Focus (optics)
* Focus (geometry)
* Conjugate points, also called focal points
* Focal point (game theory)
* Unicom Focal Point, a portfolio management software tool
* Focal point review, a human resources process for ...
, 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
In mathematics, the derivative of a function of a real variable measures the sensitivity to change of the function value (output value) with respect to a change in its argument (input value). Derivatives are a fundamental tool of calculus. ...
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
The amplitude of a periodic variable is a measure of its change in a single period (such as time or spatial period). The amplitude of a non-periodic signal is its magnitude compared with a reference value. There are various definitions of a ...
of the plane wave. The result is the
point spread function, whose
Fourier transform
A Fourier transform (FT) is a mathematical transform that decomposes functions into frequency components, which are represented by the output of the transform as a function of frequency. Most commonly functions of time or space are transformed, ...
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 used to optimize the design of the instrument by minimizing
aberrations, for photography, and for longer
wavelength
In physics, the wavelength is the spatial period of a periodic wave—the distance over which the wave's shape repeats.
It is the distance between consecutive corresponding points of the same phase on the wave, such as two adjacent crests, tr ...
applications such as designing microwave or even radio systems, and for shorter wavelengths, such as
ultraviolet
Ultraviolet (UV) is a form of electromagnetic radiation with wavelength from 10 nm (with a corresponding frequency around 30 PHz) to 400 nm (750 THz), shorter than that of visible light, but longer than X-rays. UV radiati ...
and
X-ray
X-rays (or rarely, ''X-radiation'') are a form of high-energy electromagnetic radiation. In many languages, it is referred to as Röntgen radiation, after the German scientist Wilhelm Conrad Röntgen, who discovered it in 1895 and named it ' ...
optics.
Before the advent of the
computer, ray tracing calculations were performed by hand using
trigonometry and
logarithm
In mathematics, the logarithm is the inverse function to exponentiation. That means the logarithm of a number to the base is the exponent to which must be raised, to produce . For example, since , the ''logarithm base'' 10 of ...
ic 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
laser
A laser is a device that emits light through a process of optical amplification based on the stimulated emission of electromagnetic radiation. The word "laser" is an acronym for "light amplification by stimulated emission of radiation". The firs ...
s. The basic principles of the most frequently used algorithm could be found in Spencer and Murty's fundamental paper: "General ray tracing Procedure".
Seismology

In
seismology
Seismology (; from Ancient Greek σεισμός (''seismós'') meaning "earthquake" and -λογία (''-logía'') meaning "study of") is the scientific study of earthquakes and the propagation of elastic waves through the Earth or through other ...
, geophysicists use ray tracing to aid in earthquake location and
tomographic reconstruction of the
Earth's interior.
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. In particular, the discovery of the
seismic shadow zone (illustrated at right) allowed scientists to deduce the presence of Earth's molten core.
General relativity
In
general relativity
General relativity, also known as the general theory of relativity and Einstein's theory of gravity, is the geometric theory of gravitation published by Albert Einstein in 1915 and is the current description of gravitation in modern physics. ...
, where
gravitational lens
A gravitational lens is a distribution of matter (such as a cluster of galaxies) between a distant light source and an observer that is capable of bending the light from the source as the light travels toward the observer. This effect is known ...
ing 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.
An example of such synthesis is found in the 2014 film ''
Interstellar''.
See also
*
Atmospheric optics ray-tracing codes Atmospheric optics ray tracing codes - this article list codes for light scattering using ray-tracing technique to study atmospheric optics phenomena such as rainbows and halos. Such particles can be large raindrops or hexagonal ice crystals. Such ...
*
Atmospheric refraction
Atmospheric refraction is the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height. This refraction is due to the velocity of ligh ...
*
Gradient-index optics
*
List of ray tracing software
*
Ocean acoustic tomography
Ocean acoustic tomography is a technique used to measure temperatures and currents over large regions of the ocean. On ocean basin scales, this technique is also known as acoustic thermometry. The technique relies on precisely measuring the ti ...
*
Ray tracing (graphics)
*
Ray transfer matrix analysis
References
{{Reflist
Computational physics
Geometrical optics