O'Reilly logo

GPU PRO 3 by Wolfgang Engel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2
II
An Approximation to the Chapman
Grazing-Incidence Function for
Atmospheric Scattering
Christian Sch
¨
uler
2.1 Introduction
Atmospheric scattering for computer graphics is the treatment of the atmosphere
as a participating medium, essentially “calculating the color of the sky. This is
interesting for any application where the time of day, the season, or the proper-
ties of the atmosphere are not known in advance, or the viewpoint may not be
restricted to a point on the earth’s surface. It is a historically difficult effect to
render, especially at planetary scale.
Early attempts at atmospheric scattering can be found in [Klassen 87] and
[Nishita et al. 93]. Recent implementations with an emphasis on real time are
[Hoffmann and Preetham 02], [O’Neil 05], and [Bruneton and Neyret 08]. A
common theme of all these approaches is finding ways to efficiently evaluate or
precompute the Chapman function, Ch(x, χ). This is the density integral for a
ray in a spherically symmetric, exponentially decreasing atmosphere.
The Chapman function has been subject to extensive treatment in the physics
literature. Approximations and tabulations have been published, most of it with
a focus on precision. This article explores a different direction for its evaluation:
an approximation so cheap that Ch(x, χ) can be considered a commodity, while
still being accurate enough for our graphics needs.
2.2 Atmospheric Scattering
This section is a brief review of atmospheric scattering and a definition of terms.
When light travels through air, it will be partly absorbed and partly scattered
into other directions. This gives rise to the phenomenon of aerial perspective. The
105
106 II Rendering
N
L
0
L
T(t)
S(t)
a t m o s p h e r e
s u r f a c e
T
s u n
(t)
E
s u n
Figure 2.1. Atmospheric scattering 101. See the text for an explanation of the symbols.
fraction of light that is unimpeded along a path is the transmittance T , and the
amount that is added into the path due to scattering is the in-scatter S (see
Figure 2.1). Thus, the aerial perspective of a distant source of radiance L
0
is
seen by an observer as the radiance L:
L = L
0
T + S.
To arrive at the total in-scatter S, in general one would have to integrate it
along the path. Then, the in-scatter at a particular point S(t) would have to be
calculated from the local irradiance field E over the entire sphere of directions
with an atmosphere-dependent phase function f(θ):
S =
Z
S(t) T (t) dt,
S(t)=
Z
E(t) f (θ) d.
The irradiance is usually discretized as a sum of individual contributions.
Especially during the day, the single most important contributor is the sun, which
can be simplified to a directional point source E
sun
, for the irradiance arriving
at the outer atmosphere boundary; E
sun
is attenuated by the transmittance T
sun
for the path from the atmosphere boundary towards point S(t):
S(t)=E
sun
T
sun
(t) f (θ).
The transmittance itself is an exponentially decreasing function of the airmass
m times an extinction coefficient β. The latter is a property of the scattering
medium, possibly wavelength dependent. The airmass is an integral of the air
2. An Approximation to the Chapman Grazing-Incidence Function for Atmospheric Scattering 107
density ρ(t) along the path:
T = exp (βm) ,
m =
Z
ρ(t)dt.
To complete the calculation, we need a physical model for β and f. There
exists Rayleigh theory and Mie theory, which have been discussed in depth in
previous publications, e.g., [Nishita et al. 93] and [Hoffmann and Preetham 02].
It is beyond the scope of this article to provide more detail here.
2.3 The Chapman Function
In order to reduce the algorithmic complexity, it would be nice to have an efficient
way to calculate transmittances along rays. It turns out that this reduces to an
evaluation of the Chapman function.
Without loss of generality, let’s start a ray at an observer inside the atmo-
sphere and extend it to infinity (see Figure 2.2). The ray can be traced back to
a point of lowest altitude r
0
. We take the liberty to call this point the periapsis
even though the path is not an orbit. Here we define t = 0, and the altitude for
any point along the ray as follows:
r(t) =
q
r
2
0
+ t
2
.
Let’s further assume a spherically symmetric atmosphere with an exponen-
tially decreasing density, characterized by a scale height H. We normalize the
Figure 2.2. The Chapman function. Relative airmass in an exponentially decreasing
atmosphere with scale height H, normalized observer altitude x and incidence angle χ.
The lowest altitude is at r
0
.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required