In physics, ray tracing is a method for calculating the path of
wave
In physics, mathematics, engineering, and related fields, a wave is a propagating dynamic disturbance (change from List of types of equilibrium, equilibrium) of one or more quantities. ''Periodic waves'' oscillate repeatedly about an equilibrium ...
s or
particle
In the physical sciences, a particle (or corpuscle 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, from s ...
s through a system with regions of varying propagation
velocity
Velocity is a measurement of speed in a certain direction of motion. It is a fundamental concept in kinematics, the branch of classical mechanics that describes the motion of physical objects. Velocity is a vector (geometry), vector Physical q ...
, absorption characteristics, and reflecting surfaces. Under these circumstances,
wavefront
In physics, the wavefront of a time-varying ''wave field (physics), field'' is the set (locus (mathematics), locus) of all point (geometry), points having the same ''phase (waves), phase''. The term is generally meaningful only for fields that, a ...
s may bend, change direction, or
reflect off surfaces, complicating analysis.
Historically, ray tracing involved analytic solutions to the ray's trajectories. In modern
applied physics
Applied physics is the application of physics to solve scientific or engineering problems. It is usually considered a bridge or a connection between physics and engineering.
"Applied" is distinguished from "pure" by a subtle combination of fac ...
and
engineering physics
Engineering physics (EP), sometimes engineering science, is the field of study combining pure science disciplines (such as physics, mathematics, chemistry or biology) and engineering disciplines (computer, nuclear, electrical, aerospace, medic ...
, the term also encompasses numerical solutions to the
Eikonal equation. For example,
ray-marching involves 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) is a self-propagating wave of the electromagnetic field that carries momentum and radiant energy through space. It encompasses a broad spectrum, classified by frequency or its inverse, wavelength ...
, 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, Electrical network, electr ...
such as
geometric optics
Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician ...
, 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 and mathematics, wavelength or spatial period of a wave or periodic function is the distance over which the wave's shape repeats.
In other words, it is the distance between consecutive corresponding points of the same ''phase (waves ...
. Ray theory can describe
interference
Interference is the act of interfering, invading, or poaching. Interference may also refer to:
Communications
* Interference (communication), anything which alters, modifies, or disrupts a message
* Adjacent-channel interference, caused by extra ...
by accumulating the
phase during ray tracing (e.g., complex-valued
Fresnel coefficients and
Jones calculus
In optics, polarized light can be described using the Jones calculus, invented by R. C. Jones in 1941. Polarized light is represented by a Jones vector, and linear optical elements are represented by ''Jones matrices''. When light crosses an opt ...
). It can also be extended to describe edge
diffraction
Diffraction is the deviation of waves from straight-line propagation without any change in their energy due to an obstacle or through an aperture. The diffracting object or aperture effectively becomes a secondary source of the Wave propagation ...
, with modifications such as the
geometric theory of diffraction, which enables tracing ''diffracted rays''.
More complicated phenomena require methods such as
physical optics
In physics, physical optics, or wave optics, is the branch of optics that studies Interference (wave propagation), interference, diffraction, Polarization (waves), polarization, and other phenomena for which the ray approximation of geometric opti ...
or
wave theory.
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 and mathematics, wavelength or spatial period of a wave or periodic function is the distance over which the wave's shape repeats.
In other words, it is the distance between consecutive corresponding points of the same ''phase (waves ...
, or
polarization. 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
point spread function (PSF) of a telescope and instead traces the journey of each photon from entrance in the upper atmosphere to collision with 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 communicating using radio waves. Radio waves are electromagnetic waves of frequency between 3 hertz (Hz) and 300 gigahertz (GHz). They are generated by an electronic device called a transmitter connec ...
signal ray tracing, which traces radio signals, modeled as rays, through the
ionosphere
The ionosphere () is the ionized part of the upper atmosphere of Earth, from about to above sea level, a region that includes the thermosphere and parts of the mesosphere and exosphere. The ionosphere is ionized by solar radiation. It plays ...
where they are refracted and/or reflected back to the Earth. This form of ray tracing involves the
integration of differential equations that describe the propagation of
electromagnetic waves
In physics, electromagnetic radiation (EMR) is a self-propagating wave of the electromagnetic field that carries momentum and radiant energy through space. It encompasses a broad spectrum, classified by frequency or its inverse, wavelength, ran ...
through dispersive and
anisotropic
Anisotropy () is the structural property of non-uniformity in different directions, as opposed to isotropy. An anisotropic object or pattern has properties that differ according to direction of measurement. For example, many materials exhibit ver ...
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 the ratio of the apparent speed of light in the air or vacuum to the speed in the medium. The refractive index determines how much the path of light is bent, or refrac ...
, 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 charge, elementary electric charge. It is a fundamental particle that comprises the ordinary matter that makes up the universe, along with up qua ...
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 is the body of salt water that covers approximately 70.8% of Earth. The ocean is conventionally divided into large bodies of water, which are also referred to as ''oceans'' (the Pacific, Atlantic, Indian Ocean, Indian, Southern Ocean ...
varies with depth due to changes in
density
Density (volumetric mass density or specific mass) is the ratio of a substance's mass to its volume. The symbol most often used for density is ''ρ'' (the lower case Greek letter rho), although the Latin letter ''D'' (or ''d'') can also be u ...
and
temperature
Temperature is a physical quantity that quantitatively expresses the attribute of hotness or coldness. Temperature is measurement, measured with a thermometer. It reflects the average kinetic energy of the vibrating and colliding atoms making ...
, reaching a
local minimum near a depth of 800–1000 meters. This local minimum, called the
SOFAR channel, acts as a
waveguide, 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 transmission medium, 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 commo ...
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, and
acoustic thermometry.
Optical design
Ray tracing may be used in the design of
lenses and
optical systems, such as in
camera
A camera is an instrument used to capture and store images and videos, either digitally via an electronic image sensor, or chemically via a light-sensitive material such as photographic film. As a pivotal technology in the fields of photograp ...
s,
microscope
A microscope () is a laboratory equipment, 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 ...
s,
telescopes
A telescope is a device used to observe distant objects by their emission, Absorption (electromagnetic radiation), absorption, or Reflection (physics), reflection of electromagnetic radiation. Originally, it was an optical instrument using len ...
, and
binoculars, 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 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
*
Polarization
**
Crystal optics
Crystal optics is the branch of optics that describes the behaviour of light in ''anisotropic media'', that is, media (such as crystals) in which light behaves differently depending on which direction the light is propagating. The index of refrac ...
**
Fresnel equations
*
Laser light effects
*
Thin film interference (
optical coating
An optical coating is one or more thin-film optics, thin layers of material deposited on an optical component such as a lens (optics), lens, prism (optics), prism or mirror, which alters the way in which the optic reflection (physics), reflects a ...
,
soap bubble
A soap bubble (commonly referred to as simply a bubble) is an extremely thin soap film, film of soap or detergent and water enclosing air that forms a hollow sphere with an iridescent surface. Soap bubbles usually last for only a few seconds b ...
) 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 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 is a fundamental tool that quantifies the sensitivity to change of a function's output with respect to its input. The derivative of a function of a single variable at a chosen input value, when it exists, is t ...
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 am ...
of the plane wave. The result is the
point spread function, whose
Fourier transform
In mathematics, the Fourier transform (FT) is an integral transform that takes a function as input then outputs another function that describes the extent to which various frequencies are present in the original function. The output of the tr ...
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
Diffraction is the deviation of waves from straight-line propagation without any change in their energy due to an obstacle or through an aperture. The diffracting object or aperture effectively becomes a secondary source of the Wave propagation ...
at an aperture cannot be calculated. However, these limitations can be resolved by an advanced modeling technique called
Field Tracing
Field may refer to:
Expanses of open ground
* Field (agriculture), an area of land used for agricultural purposes
* Airfield, an aerodrome that lacks the infrastructure of an airport
* Battlefield
* Lawn, an area of mowed grass
* Meadow, a gra ...
. 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 and mathematics, wavelength or spatial period of a wave or periodic function is the distance over which the wave's shape repeats.
In other words, it is the distance between consecutive corresponding points of the same ''phase (waves ...
applications such as designing microwave or even radio systems, and for shorter wavelengths, such as
ultraviolet
Ultraviolet radiation, also known as simply UV, is electromagnetic radiation of wavelengths of 10–400 nanometers, shorter than that of visible light, but longer than X-rays. UV radiation is present in sunlight and constitutes about 10% of ...
and
X-ray
An X-ray (also known in many languages as Röntgen radiation) is a form of high-energy electromagnetic radiation with a wavelength shorter than those of ultraviolet rays and longer than those of gamma rays. Roughly, X-rays have a wavelength ran ...
optics.
Before the advent of the
computer
A computer is a machine that can be Computer programming, programmed to automatically Execution (computing), carry out sequences of arithmetic or logical operations (''computation''). Modern digital electronic computers can perform generic set ...
, ray tracing calculations were performed by hand using
trigonometry
Trigonometry () is a branch of mathematics concerned with relationships between angles and side lengths of triangles. In particular, the trigonometric functions relate the angles of a right triangle with ratios of its side lengths. The fiel ...
and
logarithm
In mathematics, the logarithm of a number is the exponent by which another fixed value, the base, must be raised to produce that number. For example, the logarithm of to base is , because is to the rd power: . More generally, if , the ...
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'' originated as an acronym for light amplification by stimulated emission of radi ...
s. The basic principles of the most frequently used algorithm could be found in Spencer and Murty's fundamental paper: "General ray tracing Procedure".
Focal-plane ray tracing
There is a ray tracing technique called focal-plane ray tracing where how an optical ray will be after a lens is determined based on a lens focal plane and how the ray crosses the plane. This method utilizes the fact that rays from a point on the front focal plane of a positive lens will be parallel right after the lens and rays toward a point on the back or rear focal plane of a negative lens will also be parallel after the lens. In each case, the direction of the parallel rays after the lens is determined by a ray appearing to cross the lens
nodal points (or the lens center for a thin lens).
Seismology
In
seismology
Seismology (; from Ancient Greek σεισμός (''seismós'') meaning "earthquake" and -λογία (''-logía'') meaning "study of") is the scientific study of earthquakes (or generally, quakes) and the generation and propagation of elastic ...
, geophysicists use ray tracing to aid in earthquake location and
tomographic reconstruction of the
Earth's interior.
Seismic wave
A seismic wave is a mechanical wave of acoustic energy that travels through the Earth or another planetary body. It can result from an earthquake (or generally, a quake), volcanic eruption, magma movement, a large landslide and a large ma ...
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 as Einstein's theory of gravity, is the differential geometry, geometric theory of gravitation published by Albert Einstein in 1915 and is the current description of grav ...
, where
gravitational lens
A gravitational lens is matter, such as a galaxy cluster, cluster of galaxies or a point particle, that bends light from a distant source as it travels toward an observer. The amount of gravitational lensing is described by Albert Einstein's Ge ...
ing can occur, the
geodesic
In geometry, a geodesic () is a curve representing in some sense the locally shortest path ( arc) between two points in a surface, or more generally in a Riemannian manifold. The term also has meaning in any differentiable manifold with a conn ...
s 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''.
Laser Plasma Interactions
In laser-plasma physics ray-tracing can be used to simplify the calculations of laser propagation inside a plasma. Analytic solutions for ray trajectories in simple plasma density profiles are a well established,
however researchers in laser-plasma physics often rely on
ray-marching techniques due to the complexity of plasma density, temperature, and flow profiles which are often solved for using
computational fluid dynamics
Computational fluid dynamics (CFD) is a branch of fluid mechanics that uses numerical analysis and data structures to analyze and solve problems that involve fluid dynamics, fluid flows. Computers are used to perform the calculations required ...
simulations.
See also
*
Atmospheric optics ray-tracing codes
*
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 light ...
*
Gradient-index optics
*
List of ray tracing software
Ray tracing (graphics), Ray tracing is a technique that can generate near photo-realistic computer images. A wide range of free software and commercial software is available for producing these images. This article lists notable ray-tracing softwar ...
*
Ocean acoustic tomography
*
Ray tracing (graphics)
In 3D computer graphics, ray tracing is a technique for modeling Light transport theory, light transport for use in a wide variety of Rendering (computer graphics), rendering algorithms for generating digital image, digital images.
On a spectr ...
*
Ray transfer matrix analysis
References
{{Reflist
Computational physics
Geometrical optics