i
i
i
i
i
i
i
i
9.2. Ambient Occlusion 381
disks leads to overly dark results due to double-shadowing (if one disk
is behind another, both will be counted as occluding the surface, even
though only the closer of the two should be counted). Bunnell uses a
clever two-pass method to avoid double-shadowing. The first pass com-
putes ambient occlusion including double-shadowing. In the second pass,
the contribution of each disk is reduced by its occlusion from the first pass.
This is an approximation, but in practice, yields results that are quite
good.
Computing occlusion between each pair of elements is an order O(n
2
)
operation, which is too expensive for all but the simplest scenes. The cost
is reduced by using simplified representations for distant surfaces. A hi-
erarchical tree of elements is constructed, where each node is a disk that
represents the aggregation of the disks below it in the tree. When perform-
ing inter-disk occlusion computations, higher-level nodes are used for more
distant surfaces. This reduces the computation to order O(n log n), which
is much more reasonable.
Each disk’s location, normal, and radius are stored in textures, and
the occlusion computations are performed in fragment shaders. This is
because at the time the technique was developed (2005), GPUs’ fragment
shading units possessed significantly higher computation throughput than
their vertex shading units. On modern GPUs with unified shader units,
vertex shaders may be a better choice for this algorithm, since the lowest-
level elements are placed at the vertices.
Bunnell’s technique is quite efficient and produces high-quality results—
it was even used by ILM when performing renders for the Pirates of the
Caribbean films [1071].
Hoberock [553] proposes several modifications to Bunnell’s algorithm
that improve quality at higher computational expense. A distance attenu-
ation factor is also proposed, which yields results similar to the obscurance
factor proposed by Zhukov et al. [1409].
Ren et al. [1062] approximate the occluding geometry as a collection
of spheres. The visibility function of a surface point occluded by a single
sphere is represented using spherical harmonics. Such visibility functions
are simple to project onto the spherical harmonic basis. The aggregate
visibility function for occlusion by a group of spheres is the result of multi-
plying the individual sphere visibility functions. Unfortunately, multiplying
spherical harmonic functions is an expensive operation. The key idea is to
sum the logarithms of the individual spherical harmonic visibility func-
tions, and exponentiate the result. This produces the same end result as
multiplying the visibility functions, but summation of spherical harmonic
functions is significantly cheaper than multiplication. The paper shows
that with the right approximations, logarithms and exponentiations can be
performed quickly, yielding an overall speedup.