The Alchemy Screen-Space Ambient Obscurance Algorithm
The Alchemy Screen-Space Ambient Obscurance Algorithm
The Alchemy Screen-Space Ambient Obscurance Algorithm
Figure 1: left: Environment lighting. right) Modulated by Alchemy ambient obscurance, computed from 12 samples per pixel at 1280×720
in 3 ms on GeForce 580. The algorithm is easy to tune, robust, and captures darkening at many scales and orientations.
Indirect illumination is a significant factor in realistic lighting. Ev- 1. Robust: Conform obscurance to affected surfaces (e.g., no
ery game approximates indirect light sparsely over large distances, shadows “floating in air” near silhouettes), limit viewer de-
either via precomputation (e.g., [Larsson 2010]; environment maps pendence of intensity, and maximize temporal coherence.
and constant ambient are the classic examples) or dynamic gener- 2. Multiscale: Capture phenomena at multiple scales: shadowed
ation (e.g., [Kaplanyan and Dachsbacher 2010; Martin and Einars- deep pits, corner darkening, contact shadows, wrinkles.
son 2010]). Those sparse methods miss occlusion on the small, sub- 3. Artist-control: Provide intuitive parameters with large sweet-
∗ e-mail: morgan@cs.williams.edu,{bosman,mbukowski,phennessy}@vvisions.com spots and predictable quality.
4. Scalable: Compute in 3-5 ms, from Xbox 360 to Windows
Direct3D 11 hardware by varying quality.
Like all screen-space methods, its limitations are sample variance
(addressed by edge-aware filtering) and under-obscurance due to
unseen occluders behind the depth buffer surface and outside the
field of view. Rendering a guard band about the viewport can re-
duce the latter. We attribute the visual fidelity and robustness of
Alchemy AO compared to phenomenological methods to its radio- 1. Render an early−Z pass
metric derivation, however it is not physically correct. The value of 2. Render the camera−space normal and position buffers
the algorithm is that it makes practical concessions to artistic and 3. Render the ambient obscurance buffer
performance goals. 4. [Render other effects]
5. Cross−bilateral filter obscurance
1.1 Related Work 6. Composite obscurance, texture, and lighting in a forward pass
Ambient Occlusion Fields [Kontkanen and Laine 2005] are pre- The ambient occlusion (see [Landis 2002]) of surface point C with
computed voxel occlusion values relative to a static mesh, which normal n̂ is
can be composed between moving rigid objects to estimate AO. AOr∗ (C, n̂) = 1 − A∗r (C, n̂), (2)
McGuire [2010] and Laine and Karras [2010] extended this idea to where 0 ≤ A∗r (C, n̂) ≤ 1 is the fractional visibility of the far field
dynamic meshes. at C [Cook and Torrance 1982]. Function A is visibility weighted
by projected area over the positive hemisphere,
2 Algorithm Z
1
A∗r (C, n̂) = V (C, C + rω̂) ω̂ · n̂ dω̂. (3)
π Ω
We begin by summarizing the key terms and equations governing
indirect illumination. Previous screen space methods approximate Note that (ω̂ · n̂) in eqn 3 accounts for the solid angle of occluders
these equations (or their resultant phenomena) in ways that are ex- projected onto the tangent plane at C. For example, this decreases
tremely efficient but can introduce significant error. We instead re- the impact of occluders only block incident light at shallow angles,
tain the full model and observe that the falloff function customarily which is radiometrically correct. Specifically, this is not the pro-
chosen for aesthetics can also be selected to eliminate expensive jected area factor that will later be applied to indirect illumination,
operations. With this, we are able to retain the full radiometric so this does not “double count” that factor.
model until the screen-space sampling step. That process leads to
a relatively robust solution. We augment the screen-space solution Shadows account for the visibility factor in direct illumination. ob-
with parameters for managing buffer precision and artistic goals in scurance is an approximation of shadowing for indirect illumination
production use. that modulates environment light. To transition smoothly between
1.00
the near- and far-field illumination models, ambient occlusion is 0.90
often extended to ambient obscurance (AO) [Zhukov et al. 1998] 0.80
Alchemy, u = 0.10 r
using a falloff function that reduces the influence of occlusion with 0.70
Alchemy, u = 0.05 r
distance. The analogous obscured function is 0.60
StarCraft II
0.50
Z 0.40
Ar (C, n̂) = 1− [1−V (C + ω̂ min(t(C, ω̂) + , r))]·g(t)·(n̂·ω̂) dω̂ 0.30
Ω 0.20
(4) 0.10
where t is the distance from C to the first scene point encountered 0.00
by a ray cast in direction ω̂ and 0 ≤ g(x) ≤ 1 is the aesthetically- 0
0.2
0.4
0.6
0.8
1
selected falloff function, which commonly obeys g(x) = 0|x≥r and Occluder distance t / r
g(0) = 1. For the remainder of this paper we omit the parameters
of the A function, which are always r, C, and n̂. Figure 2: Plot of falloff g(t)vs. t for Alchemy and StarCraft II AO.
Figure 13: Frames of the dynamic 2 m tall Frog Knight character and moving camera in the Knight scene on Xbox 360, with all lighting
terms and no materials. The rightmost frame shows the obscurance buffer. r = 0.76 m
Table 1: Sample counts to hold worst-case performance constant by varying quality for low, mid, and high-end systems.
a GeForce 460 SE GPU, Volumetric Obscurance computes obscu- by view dependence. Note the intense dark shadows under HBAO.
rance in 0.7 ms and Alchemy runs in 0.6 ms. Volumetric Obscu- The more conservative Alchemy result arises from adopting Loos’s
rance runs at two resolutions, taking six samples per pixel at each and Sloan’s [2010] assumption that unseen space is empty. The
resolution. Alchemy uses four samples per pixel in this test; it re- Alchemy result exhibits higher temporal coherence under camera
ceives fewer samples because it reads normals and positions instead motion because it operates at screen resolution (see video); HBAO
of just depth values. Volumetric Obscurance can run at half perfor- upsamples substantially and takes 22 ms if run at full resolution to
mance with normals to better capture fine detail, but that is redun- avoid aliasing.
dant with multiple resolutions.
Figure 12 shows a natural scene with dense clumps of thin grass
The Alchemy AO on the right of figure 10, exhibits desirable prop-
blades and large, smooth rocks. The appearance of foliage strongly
erties. The top row shows that it conforms to surfaces (b) instead
depends on ambient occlusion. Alchemy’s high sampling resolu-
of shadows “floating in air” near silhouettes (a). This is important
tion compared to other screen space methods makes it well suited
for properly planted pillars and feet. The second row demonstrates
to capturing the interaction of many thin objects.
that it is fast and robust enough to operate over a large radius, so oc-
clusion appears from a continuous range of geometric frequencies.
The third row combines these challenging cases over a continuous Figure 13 shows frames from the sequence captured on Xbox 360 in
distance range. our result video. The animated character deforms under animation
and establishes and breaks contact with the ground during the se-
Figure 11 compares Bavoil’s and Sainz’s [2009a] implementation quence. Unlike methods that process AO at very low resolution and
of Horizon-based AO (HBAO) to Alchemy AO for the Dragon upsample significantly, Alchemy samples multiple times at each
scene on GeForce 580. HBAO gives smoother results (a). Alchemy pixel and distributes samples over space and angle, so it provides
captures more fine details (b) and more consistent intensity (c) as high spatial resolution and a good estimate that are robust to object
the view changes, although both screen-space effects are limited and camera motion.
Volumetric Obscurance Alchemy AO
[Loos and Sloan 2010] [this paper]
3.0
Figure 10: Quality comparison to the most recent previous work
2.5
at comparable performance. One aspect we especially sought to
Time (ms)
2.0
improve is that where the pillars in the top row intersect the floor a)
1.5
Volumetric Obscurance produces occlusion “floating in air” about
1.0
the silhouette; b) Alchemy AO conforms to the ground orientation.
0.5
0.0
Horizon-based AO Alchemy AO
[Bavoil and Sainz 2009a] [this paper]
0.0
0.5
1.0
1.5
2.0
r in meters
Figure 9: Increasing radius increases the number of texture cache
misses and thus the render time.