Page updated: May 19, 2021
Author: Curtis Mobley
View PDF


This page is the first of several on Monte Carlo techniques for solving the Radiative Transfer Equation. As an RTE solution technique, these pages could be considered as Level 2 material under the Radiative Transfer Theory chapter. However, because of the importance of Monte Carlo techniques in a wide range of scientific areas, they warrant a chapter unto themselves.

As used to solve the RTE, Monte Carlo techniques refer to algorithms that use probability theory and random numbers to simulate the fates of numerous photons propagating through a medium. Various averages over ensembles of large numbers of simulated photon trajectories give statistical estimates of radiances, irradiances, and other quantities of interest.

Monte Carlo techniques were developed in the 1940s for studies of neutron transport as needed for the design of nuclear weapons (Metropolis, 1949), (Eckhardt, 1987). The name Monte Carlo was at first a code name for this classified research. The name was well chosen because probability and statistics lie at the heart of both the simulation techniques and the gambling games played at the legendary Monte Carlo Casino in Monaco. Monte Carlo techniques are now highly developed and are used to solve many types of problems in physical and biological sciences; finance, economics, and business; engineering; computer graphics for movie production, and pure mathematics.

An essential feature of Monte Carlo simulation is that the known probability of occurrence of each separate event in a sequence of events is used to estimate the probability of the occurrence of the entire sequence. In the ray-tracing setting, the known probabilities that a light ray will travel a certain distance, be scattered through a certain angle, reflect off on a surface in a certain direction, etc., are used to estimate the probability that a ray emitted from a source at one location will travel through the medium and eventually be recorded by a detector at a different location.

The strengths of Monte Carlo techniques are that

  • They are conceptually simple. The methods are based on a straightforward mimicry of nature, which in itself endows them with a certain elegance.
  • They are very general. Monte Carlo simulations can be used to solve problems for any geometry (e.g., 3D volumes with imbedded objects), incident lighting, scattering phase functions, etc. It is relatively easy to include polarization and time dependence.
  • They are instructive. The solution algorithms highlight the fundamental processes of absorption and scattering, and they make clear the connections between the ray-level and the energy-level formulations of radiative transfer theory.
  • They are simple to program. The resulting computer code can be very simple, and the tracing of rays is well suited to parallel processing.

The weaknesses of Monte Carlo techniques are that

  • They provide no insight into the underlying mathematical structure of radiative transfer theory. The simulations simply accumulate the results of tracing large numbers of rays, each of which is independent of the others.
  • They can be computationally very inefficient. Monte Carlo simulation is a “brute force” technique. If care is not taken, much of the computational time can be expended tracing rays that never contribute to the solution, e.g., because they never intercept a simulated detector.
  • They are not well suited for some types of problems. For example, computations of radiance at large optical depths can require unacceptably large amounts of computer time because the number of solar rays penetrating the ocean decreases exponentially with the optical depth. Likewise, the simulation of a point source and a point (or very small) detector is difficult. Monte Carlo techniques are based on tracking individual rays in the geometric optics limit of physical optics and thus cannot address wave phenomena such as diffraction.

This page discusses probability distributions and how they are sampled in Monte Carlo simulations. The next page discusses how light rays are tracked in Monte Carlo simulations. Subsequent pages discuss computational tricks for speeding up calculations and improving the accuracy of the statistical estimates, and the design of Monte Carlo simulations for particular problems. Those pages are placed in Level 2 because of their mathematical nature.

Probability Functions

As a ray travels through a medium, the distance it goes between interactions with the medium, whether it will be absorbed or scattered in a given interaction, the new direction it will travel after a scattering event, etc. are all random variables. In mathematics it is customary to let a capital letter, e.g. X, denote a random variable (such as the distance a ray travels) and to let a lower case letter, x in this case, denote a value of X, e.g. x = 2.2m if X is distance. Let X be any such random variable that is defined over a range of values x1 to x2. If X is distance traveled, x1 = 0 and x2 = ; if X is a polar scattering angle, x1 = 0 and x2 = π or 180 deg, and so on.

The probability density function (pdf) for X, denoted pX(x), is a non-negative function such that pX(x)dx is the probability (a number between 0 and 1) that X has a value between x and x + dx. A pdf must satisfy the normalization

x1x2 pX(x)dx = 1. (1)

That is, the probability is 1 that X will have some value in its allowed domain. The cumulative distribution function (cdf) is a function PX(x) giving the probability that the random variable X will have a numerical value less than or equal to x. The cdf is obtained from the corresponding pdf via

PX(x) =x1xp X(x)dx.

Note that a pdf has units of 1/{units of x} and can have a magnitude greater than 1 for some values of x, whereas a cdf is nondimensional and grows monotonically from 0 at x = x1 to 1 at x = x2.

The mean or average value of X is given by

μX =x1x2 xpX(x)dx,

and the variance of X is given by

σX2 =x1x2 (x μX)2p X(x)dx =x1x2 x2p X(x)dx μX2.

The pdf for a random variable that can have values only between 0 and 1 is fundamental to Monte Carlo simulation. Let be a random variable drawn from the unit interval between 0 and 1 such that is equally likely to have any value 0 𝔯 1 on the interval from 0 to 1. The pdf for is

p(𝔯) = 1if0 𝔯 1 0if 𝔯 < 0or 𝔯 > 1. (2)

is said to have a uniform 0 to 1 distribution, denoted by U[0, 1].

We wish to use a randomly drawn value of , which is a known number 𝔯, to determine a value for a random variable X. This is done by regarding going from to X as a change of variables. Then the probablity that lies between 𝔯 and 𝔯 + d𝔯 is the same as the probability that X lies between x and x + dx. Thus

0𝔯p (𝔯)d𝔯 =x1xp X(x)dx

Because p(𝔯) is known from Eq. (2), the left-hand integral can be evaluated to obtain

𝔯 =x1xp X(x)dx = P X(x)

The fundamental principle of Monte Carlo simulation states that the equation 𝔯 = PX(x) uniquely determines x in such a manner that x lies in the interval x to x + dx with probability pX(x)dx. That is, drawing a value 𝔯 from a U[0, 1] distribution and then solving 𝔯 = PX(x) for x gives a randomly determined value of x that obeys the pdf for X.

The next sections illustrate how this principle is applied for specific examples of determining ray path lengths and scattering angles.

Determining Ray Path Lengths

Recall from the derivation of the RTE that radiance in a particular direction (𝜃,ϕ) decays due to absorption and scattering out of the beam according to

dL(r,𝜃,ϕ) dr = c(r)L(r,𝜃,ϕ),

which integrates to give

L(r,𝜃,ϕ) = L(0,𝜃,ϕ)e0rc(r)dr ,

where c(r) is the beam attenuation coefficient and r is the distance from some starting point. In terms of the optical path length τ =0rc(r)dr this is

L(τ,𝜃,ϕ) = L(0,𝜃,ϕ)eτ.

This experimentally established exponential decay of radiance can be explained in terms of the fate of individual rays if the probability of any particular ray being absorbed or scattered out of the incident direction between τ and τ + dτ is

pT (τ)dτ = eτdτ

Note that this pT (τ) satisfies the normalization condition (1) with x1 = 0 and x2 = . The corresponding cdf is PT (τ) = 1 eτ. Drawing a random number 𝔯 from a U[0, 1] distribution and solving

𝔯 = PT (τ) = 1 eτ

for τ gives

τ = ln(1 𝔯).

Because 1 is also uniformly distributed on [0, 1], we can just as well use

τ = ln(𝔯)

to determine τ. Optical distances randomly chosen in this manner, when applied to many rays, are consistent with the exponential decay of radiance with distance traveled. If the water is homogeneous, so that c(r) does not depend on r, then τ = cr and the geometric distance a photon travels is given by

r = 1 c ln(𝔯).

Note that the average distance a ray travels is given by

μT =0τeτdτ = 1

or, for homogeneous water,

μR = 1 c.

The average distance a ray travels between an absorption or scattering interaction with the water is called the mean free path between interactions. Likewise, the standard deviation σT , which is the square root of the variance σT 2, of the optical distance traveled is also 1, or σR = 1c. Thus rays travel on average one optical path length, or 1c meters, but with a large spread of values about that distance.

Determining Scattering Angles

Scattering is an inherently three-dimensional process and must be specified by both polar (ψ) and azimuthal (χ) scattering angles. The scattering phase function β̃(ψ,χ ψ,χ) can be interpreted as a pdf for scattering from an incident direction (ψ,χ) to a final direction (ψ,χ), per unit of solid angle. If we pick a spherical coordinate system centered on the incident direction (ψ,χ) and recall the expression for an element of solid angle in spherical coordinates, then we can write

β̃(ψ,χ ψ,χ)dΩ(ψ,χ) = β̃(ψ,χ) sin ψdψdχ.

Ocean water is usually well described as isotropic medium, which means that there are no optically preferred directions. (This is not the case, for example, in a cirrus cloud with non-randomly oriented ice crystals.) In that case, the polar and azimuthal scattering angles are independent, and we can write

β̃(ψ,χ) sin ψdψdχ = pΨ(ψ)dψpX(χ)dχ

For an unpolarized beam, the azimuthal angle is equally likely to have any value from 0 to 360 deg, or 0 to 2π radians. Thus the pdf for azimuthal scattering is pX(χ) = 1(2π), the cdf is PX(χ) = χ(2π), and χ is determined by χ = 2π𝔯.

Using this pX(χ) in the previous equation allows us to identify the pdf for the polar angle as

pΨ(ψ) = 2πβ̃(ψ) sin ψ

Recall from the discussion of the Volume Scattering Function that phase functions satisfy the normalization

2π0πβ̃(ψ) sin ψdψ = 1,

so this function pΨ(ψ) is indeed a pdf. Therefore, to determine the polar scattering angle, we draw a U[0, 1] random number 𝔯 as always and solve

𝔯 = 2π0ψβ̃(ψ) sin ψdψ (3)

for ψ.

In general, Eq. (3) must be solved numerically because of the complicated shape of most phase functions, or when the phase function is defined by tabulated data at a finite number of scattering angles and is fit with a spline (or other) function to generate a continuous function of scattering angle. However, a few commonly used phase functions allow this equation to be solved analytically. The simplest case, isotropic scattering, is instructive.

Isotropic Scattering. The phase function for isotropic scattering is β̃(ψ) = 1 4π. Substituting this into Eq. (3) leads to

ψ = cos 1(1 2𝔯)

for the determination of the scattering angle. This result may look peculiar until it is remembered that isotropic scattering means that scattering is equally likely into any element of solid angle, not equally likely at every scattering angle ψ. Figure 1 illustrates this important point. Scattering from a collimated beam is simulated two different ways. The scattering events occur at the center of a sphere, and the points plotted on the surface of the sphere show the scattering direction. The arrow at the “north pole” represents the direction of the unscattered beam and a scattering angle of 0. The blue lines are lines of constant scattering angle ψ, with the thick line at the “equator” being ψ = 90 deg. In the left panel, the polar scattering angle ψ was drawn from a U[0, 180] distribution, i.e., any value of ψ between 0 and 180 deg was equally likely. The right panel drew ψ from the cos 1(1 2𝔯) distribution. In both simulations the azimuthal scattering angle χ was drawn from a U[0, 360] distribution. It is visually clear from the left panel that the uniform distribution of ψ values gives too many points near the north pole of the figure, i.e., too many points with scattering angles near 0. The right panel shows an even distribution of points per unit area of the surface of the sphere, i.e., per unit solid angle in any direction.


Figure 1: Scattering directions for a collimated beam. The left panel is for a uniform distribution of polar scattering angles ψ. The right panel is for an isotropic distributions of scattering directions.

Table 1 displays various phase functions and the formulas obtained from solving 𝔯 = PΨ(ψ) used to determine the corresponding scattering angles.


Phase Function β̃(ψ)

ψ formula


1 4π

ψ = cos 1(1 2𝔯)


1 4π 1g2 (1+g22g cos ψ)32

ψ = cos 1 1+g2 2g 1 2g 1g2 1+g2g𝔯 2
for 1 g 1, but g0


3 16π(1 + cos 2ψ)

ψ = cos 1 A + B13 + A B13
where A = 2(1 2𝔯) and B = 1 + A2

cosine or

1 π cos ψ if 0 ψ π 2
0 if π 2 < ψ π

ψ = sin 1(𝔯)


any β̃(ψ) that
2π0πβ̃(ψ) sin ψ = 1

must solve
𝔯 = 2π0ψβ̃(ψ) sin ψdψ
numerically for ψ

Table 1: Formulas for randomly choosing scattering angles ψ for commonly used phase functions β̃(ψ). The pdf associated with β̃(ψ) is always 2πβ̃(ψ) sin ψ. 𝔯 is a U[0, 1] random number.

The widely used Fournier-Forand phase function is

β̃FF(ψ) = 1 4π(1 δ)2δν ν(1 δ) (1 δν) + δ(1 δν) ν(1 δ) sin 2 ψ 2 + 1 δ180ν 16π(δ180 1)δ180ν(3 cos 2ψ 1),


ν = 3 μ 2 andδ = 4 3(n 1)2 sin 2 ψ 2 ,

Here n is the real index of refraction of the particles, μ is the slope parameter of the hyperbolic distribution, and δ180 is δ evaluated at ψ = 180deg. This phase function has an analytic cdf (Fournier and Jonasz, 1999)

PΨFF(ψ) = 1 (1 δ)δν (1 δν+1) (1 δν) sin 2(ψ2) + 1 8 1 δ180ν (δ180 1)δ180ν cos ψ sin 2ψ. (4) However, solving 𝔯 = PΨFF(ψ) for ψ (even if possible) would give a formula so complicated that it is numerically more efficient to use Eq. (3) for PΨFF(ψ) to build up a table of ψ vs. PΨFF(ψ) values for closely spaced values of ψ and the given n and μ parameters, and then to interpolate within this table to obtain values of ψ as 𝔯 values are drawn in the course of a simulation. This is illustrated in Fig. 2, which shows a Fourier-Forand cdf for values of n and μ that give a best fit to the Petzold average particle phase function phase function. The blue arrows show how drawing a value of 𝔯 = 0.7 leads to a scattering angle of about 10 deg. When working with tabulated data for highly peaked phase functions, it is usually adequate to use linear interpolation between the tabulated values.


Figure 2: A Fournier-Forand phase function as tabulated using Eq. (3) and closely spaced values of ψ.

Comments for Introduction:

Loading Conversation