Two Methods for Fast Ray-Cast Ambient Occlusion

Two Methods for Fast Ray-Cast Ambient Occlusion

Eurographics Symposium on Rendering 2010 Volume 29 (2010), Number 4 Jason Lawrence and Marc Stamminger (Guest Editors) Two Methods for Fast Ray-Cast Ambient Occlusion Samuli Laine Tero Karras NVIDIA Research Abstract Ambient occlusion has proven to be a useful tool for producing realistic images, both in offline rendering and interactive applications. In production rendering, ambient occlusion is typically computed by casting a large number of short shadow rays from each visible point, yielding unparalleled quality but long rendering times. Interactive applications typically use screen-space approximations which are fast but suffer from systematic errors due to missing information behind the nearest depth layer. In this paper, we present two efficient methods for calculating ambient occlusion so that the results match those produced by a ray tracer. The first method is targeted for rasterization-based engines, and it leverages the GPU graphics pipeline for finding occlusion relations between scene triangles and the visible points. The second method is a drop-in replacement for ambient occlusion computation in offline renderers, allowing the querying of ambient occlusion for any point in the scene. Both methods are based on the principle of simultaneously computing the result of all shadow rays for a single receiver point. 1. Introduction Zhukov et al., we define the amount of ambient occlusion as 1 Z Ambient occlusion has become one of the standard tools W (p;n) = (D(p;!))(! ⋅ n) d!: (1) used in high-quality production rendering. It was introduced Ω by Zhukov et al. [ZIK98] and soon picked up by the ren- Here, W is the amount of occlusion, and p and n are the dering community [Lan02]. Today it is easy to find numer- surface point receiving the occlusion and its normal, respec- ous tutorials and examples on how to improve the realism of tively. The integral is taken over the hemisphere oriented to- rendered images by rendering an ambient occlusion pass and wards n. D(p;!) measures the distance to nearest occluder using it in the final composition phase. from p towards direction !, and is the falloff function that The amount of ambient occlusion for a point is most often converts this distance to an occlusion factor between 0 and defined as the cosine-weighted fraction of the hemisphere 1. The choice of depends on rendering needs, so a generic where incoming ambient light cannot reach the surface. This ambient occlusion algorithm should be able to support any simple definition is, however, unsatisfactory. For example, such function. We may, however, assume that there is some the rendering situation determines how far we want to look distance r after which is zero. This allows us to consider for occlusion. For indoor scenes, light from the sky never a bounded region in space instead of the entire scene when reaches the surfaces, so a shorter distance is appropriate, computing ambient occlusion for a single point. whereas outdoor scenes may use a longer distance. Also, the Usually the integral is approximated by sampling the do- simple definition does not tell how the occlusion tapers off main in a number of points. By distributing the points ac- with distance. cording to cosine weighting, we may dispose of the normal- A practical and flexible definition is obtained by utilizing ization factor and the dot product in the end. This yields a falloff function that defines how the distance to occlud- N 1 X ing surfaces affects the amount of incoming light. Following W (p;n) ≈ (D(p;! )): (2) N i i=1 The traditional method to evaluate this formula is to cast N ⃝c 2010 The Author(s) Journal compilation ⃝c 2010 The Eurographics Association and Blackwell Publishing Ltd. Published by Blackwell Publishing, 9600 Garsington Road, Oxford OX4 2DQ, UK and 350 Main Street, Malden, MA 02148, USA. Laine and Karras / Fast Ray-Cast Ambient Occlusion rays from point p, mapping the first-hit distances through scene triangles, as such a hierarchy can be assumed to be and taking the average. The expensive part is the casting of present in a ray tracing system. Unlike the rasterization- the rays, but limiting their length to r makes them faster than based method, this method can provide ambient occlusion generic rays. In production rendering, N may be set as high information for any point in the scene. This makes it suit- as 1024 for obtaining noise-free results. able for handling the shading of secondary rays as well. The traversal-based method is described in Section5. For our purposes, we need that the rays that are cast are shadow rays, i.e., ones that only report if the ray was oc- cluded or not, and therefore we cannot evaluate the distance 2. Previous work function D. However, we can reformulate the above equa- In this section, we will focus on methods that are directly tion in terms of shadow rays by incorporating the falloff related to our work or are equivalent to ray tracing-based function into the sampling points by stochastically distribut- ambient occlusion calculation. For a recent and compre- ing the shadow ray lengths li according to . This gives our hensive survey of exact and approximative ambient occlu- final formula sion techniques, we refer the reader to Méndez-Feliu and N Sbert [MFS09]. In addition, quality comparisons between a 1 X W (p;n) ≈ O(p;! ;l ); (3) few approximative methods can be found in [McG10]. N i i i=1 Both of our methods are based on storing the status of where O(p;!i;li) is a binary occlusion function that returns individual shadow rays in bit masks. The same approach has one if the ray between points p and p + li!i is blocked, and been previously used for area light sources and environment zero otherwise. We define the ambient occlusion radius r as light sources (e.g. [KLA04, LA05, SS07]). the length of the longest ray. The hemispherical rasterization technique of Kautz et For interactive applications, high-quality sampling would al. [KLA04] uses precomputed bit mask look-up tables for be prohibitively slow, and a screen-space approximation is rapidly identifying which shadow rays are occluded by a tri- commonly used instead. The principle is to use the depth angle. However, they compute shadowing from distant envi- buffer information to infer enough of the 3D structure of the ronment maps and hence only need to support infinitely long scene to be able to render convincing ambient occlusion. The rays. Handling limited-length rays for ambient occlusion re- problem with this approach is that there are cases which ap- quires a more versatile look-up table. pear similar in the depth buffer but should produce different Our rasterization-based method rasterizes volumes that results, leading to systematic errors. We will briefly touch bound the influence of individual triangles. Compared to am- screen-space ambient occlusion methods at the end of Sec- bient occlusion volumes presented by McGuire [McG10], tion2, but they are otherwise outside the scope of this paper. our bounding volumes are more compact. We also avoid the construction and rendering of a bounding volume when am- 1.1. Contributions bient occlusion radius is large compared to triangle size, and In this paper, we present two methods for efficient compu- instead render a polygonal approximation of the influence tation of ambient occlusion according to Equation3. Both hemisphere, which produces tighter bounds. methods are based on storing the status of individual shadow Our hierarchy traversal-based method bears resemblance rays in bit masks and updating the masks using precom- to the BVH packet tracing algorithm of Wald et al. [WBS07]. puted bit patterns stored in look-up tables. This process is They traverse the hierarchy once for a packet of rays and explained in Section3. keep track of closest hit for each ray. We optimize this by us- The first of our methods is targeted for rasterization-based ing bit operations to handle multiple rays at once, and by or- engines. It exploits fixed-function hardware rasterization and dering the traversal according to estimated occlusion power. depth test to find pixels where a given triangle may con- As we are focusing on the evaluation of Equation3, tech- tribute to ambient occlusion. This is similar to a previous niques that require further approximations are outside the method by McGuire [McG10], but instead of flattening the scope of this paper. For a recent screen-space ambient oc- ambient occlusion into a scalar value, we maintain accurate clusion method, see e.g. the horizon-based method of Bavoil per-ray occlusion information. To improve performance, we and Sainz [BS08] that has been extended to utilize mul- support one-sided triangles, i.e., ones that occlude shadow tiple depth layers [BS09] to battle artifacts caused by the rays from one direction only. This optimization is possible single-depth approximation. The results are still far from ray with most real-time content, as it has usually been designed casting, albeit obtained orders of magnitude faster. Besides to support backface culling. The rasterization-based method screen-space ambient occlusion, it is possible to propagate is detailed in Section4. occlusion in a hierarchy of surface elements [Bun05, HJ07]. The second method is designed to be a drop-in replace- This approach is more computationally intensive and works ment for ambient occlusion computation in ray tracers. It only for models for which a satisfactory surface element ap- is based on traversing a bounding volume hierarchy of the proximation can be constructed. ⃝c 2010 The Author(s) Journal compilation ⃝c 2010 The Eurographics Association and Blackwell Publishing Ltd. Laine and Karras / Fast Ray-Cast Ambient Occlusion the process of finding the shadow rays blocked by a trian- gle after it has been transformed to the coordinate system of the receiver point.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us