A Comparative Study of Screen-Space Ambient Occlusion Methods

In this report we present a comparison between six screen-space ambient occlusion (SSAO) methods. The aim is to compare their strengths and weaknesses and ultimately to ﬁnd a superior method. The methods are chosen to differ algorithmically to get the broadest overview as possible. We ﬁnd that a method known as Alchemy AO is the superior approach. The report also includes discussions of topics related to the ﬁeld of ambient occlusion in general.

Introduction

As the abstract above describes, we implemented six different approaches to screen-space ambient occlusion and compared the results in terms of quality and performance. Please refer to the report for a detailed coverage of the topic. In the following sections I will give a short overview of the study. The intention is to give a taste of the report. Unlike the report, I will assume that the reader is familiar with ambient occlusion theory. A good understanding of real-time computer graphics is also recommended.

The Candidate Models

Six models were selected for the comparison. The models have been chosen to be as algorithmically different as possible. A consequence hereof is that the models also span a broad timeline. I will go directly into detail with each candidate method in the next subsections.

CryEngine 2 AO

As the heading indicates, it was introduced in CryEngine 2 by Crytek [Mittring 2007]. It works by sampling randomly distributed points in a sphere at each pixel location, p. The sampling is done directly in screen-space. Each sample point, s, is then projected onto the scene surface using the depth buffer. The depth value of the projected sample point, sd, is then compared against the original depth value, sz, to determine if the sample is occluded or visible. The ratio of visible to occluded sample points is used to approximate AO. Consult Figure 2.1 for reference.

CryEngine 2 AO. The green and red samples are visible and occluded, respectively. One sample is also shown projected onto the scene surface.

The CryEngine 2 AO method is computationally cheap. In our implementation we use 24 samples per pixel in our performant configuration. However, the CryEngine only uses 8 samples per pixel. Furthermore, those 8 samples are generated by randomly rotating a cube and then use the cube’s 8 corners as sample points. I suspect that the time saved using this fast sampling method is instead spent to blur the result in order to smoothen out noise artifacts.

StarCraft II AO

Another implementation that came to be during the development of a video game, namely StarCraft II [Filion and McNaughton 2008]. This approach uses a similar technique to that found in CryEngine 2 AO but with some key differences. First of all, the samples are generated in a hemisphere which is true to the theoretical formulation of AO. Furthermore, samples are generated in world-space and then transformed into screen-space. See Figure 2.2 for reference.

Starcraft 2 AO. The green and red samples are visible and occluded, respectively.

Note that in the CryEngine 2 AO approach, at least half of the samples end up occluded since the sampling is done in a sphere around p. Effectively, half of the samples are wasted. StarCraft II AO does not have this problem since it samples in a hemisphere.

Horizon-based AO with Ray Marching

This method works by ray-marching in screen-space through the depth buffer to find the angle of the free horizon, h [Bavoil et al. 2008]. See Figure 2.3 for a side view. First, a ray direction is chosen perpendicular to the view direction (the gray dashed line). Then, several samples are taken along said ray in progression. At each step, the depth value is read. If the depth value is lower than at the previous step, then the horizon angle is updated. Several rays are cast and the average free horizon angle, h, is then used to approximate the AO factor.

Horizon-based AO using ray marching. The green samples show when the horizon angle is updated. The red samples show when it is not. The result is a very accurate measure of the free horizon, h.

This method produces high quality results. Unfortunately, it tends to be slow since a lot of samples have to be taken in each ray direction.

Volumetric Obscurance

An AO approach that is based on a volume integral [Loos and Sloan 2010]. The AO term will be approximated the ratio of visible to occluded volume. The integral is over a sphere positioned the pixel position, p. Said integral is then evaluated using line samples as shown in Figure 2.4. Samples are generated at random on a disc that is perpendicular to the view direction. Each sample position represents a volumetric column slice of the sphere. In turn, each volumetric slice is represented by a simple line segment (see Figure 2.4). The sample position is then projected onto the surface using the depth buffer. Now the visible part of the line segment can be calculated using simple trigonometry.

Volumetric Occlusion. Samples are shown as grey squares. The green and red line segments denote visible and occluded volumes, respectively. Note that p itself contributes as a sample position.

The continuous nature of the line samples used in Volumetric Obscurance makes this method temporally coherent. That is, a slight variation in viewing direction or surface position will only cause a gradual change in the AO term. The point sample-based methods can suffer from pop-in artifacts when a low number of samples are used.

Alchemy AO

This method projects sample points, s, generated on a disk onto the scene surface. Each s is then used to construct the vector v as s−p. See Figure 2.5 for a reference. The average dot product between each v and n can then be used to compute the AO factor [McGuire et al. 2011].

Theoretically, the method works by defining a clever falloff function which simplifies the integral in the AO term. The method gains its efficiency from the fact that it is cheap to compute the vectors v.

Alchemy AO. The green vectors, v, are the used to compute the AO term. The red sample points have been rejected because they lie outside (or on the edge of) the hemisphere.

The study concludes that Alchemy AO has the best quality-performance ratio. A key advantage of this method is that all accepted samples (the green rectangles in Figure 2.5) are visible. I.e., each accepted sample is indirectly a (rough) measure of the angle of the free horizon, h, as seen in [Bavoil et al. 2008]. Thus the sampling strategy makes effective use of every accepted sample. Consequently, only a few samples are needed overall. Contrast this to the point or volume sampling methods where many samples are needed to compute a reasonable visible-occluded ratio.

Unreal Engine 4 AO

This approach also attempts to measure the angle of the free horizon, h, as seen in [Bavoil et al. 2008]. The difference is that samples are grouped in pairs, s1 and s2, as seen in Figure 2.6. Like in [McGuire et al. 2011], the samples are first generated on a disk and then projected onto the scene surface. Then h is approximated as the angle between the vectors s1−p and s2−p [Mittring 2012].

Unreal Engine 4 AO. The grey rectangles form a single sample pair. The angle of the free horizon, h, is approximated as the angle between the vectors pointing towards each sample from p.

For the same reason as with Alchemy AO, this method only needs a few samples to produce quality results. Additionally, the pairing scheme can be used to mitigate depth buffer discontinuities as explained in the report.