Horizon split ambient occlusion

The method includes receiving a plurality of graphics primitives for rendering at a GPU of a computer system and rendering graphics primitives into pixel parameters of the pixels of a display, wherein the parameters include pixel depth values and pixel normal values. For each pixel of the display, an ambient occlusion process is performed. The algorithm takes as input a ND-buffer containing pixel depth values and pixel normals. Based on the pixel 3-D position and the pixel normal vector, horizon heights are computed by sampling the ND-buffer and an occlusion term is computed for each pixel based on the horizon heights. Based on the pixel 3-D position, the pixel normal vector, a normal occlusion term is computed by sampling the ND-buffer above the horizon in multiple directions. An ambient occlusion illumination value is computed by combining the horizon occlusion term and the normal occlusion term.

FIELD OF THE INVENTION

The present invention is generally related to hardware accelerated graphics computer systems.

BACKGROUND OF THE INVENTION

Ambient occlusion is a technique that computes the amount of light reaching a point on a diffuse surface based on its directly visible occluders. It gives perceptual clues of depth, curvature, and spatial proximity and thus is important for realistic rendering. The concept of ambient occlusion was pioneered by accessibility maps and obscurances.

Ambient occlusion terms can be computed using image-based algorithms. For instance, one prior art implements ambient occlusion on graphics hardware by averaging hard shadows from light sources distributed around the scene, using shadow mapping. This approach typically requires hundreds of point light sources to converge to a smooth solution. In another prior art solution, obscurances with color bleeding are computed based on casting bundles of rays in random directions, which can be implemented on graphics hardware using depth peeling from multiple viewpoints. Hardware-accelerated occlusion queries can also be used to compute ambient occlusion per face or per vertex. Each of these solutions is typically implemented using an “off-line” renderer, where the computations are performed in a non-real-time basis.

In real-time graphics, for static scenes, ambient occlusion terms can be precomputed at the vertices or in light maps. For example, one prior art solution computes bent normals by averaging the direction of the unoccluded rays in the hemisphere. In another prior art solution, ambient occlusion fields render inter-object ambient occlusion, without self-occlusion. In yet another prior art solution, a volumetric approach is taken whereby ambient occlusion values are stored in a 3D grid and linear interpolation is used. All of these techniques mentioned above require scene-dependent precomputation, which is not compatible with maintaining reasonable frame rates for real-time graphics applications with complex scenes.

In a more recent prior art solution, a method for rendering ambient occlusion in screen space is implemented by using a postprocessing pass based on a depth buffer from the eye's point of view. The technique recovers eye-space positions from the depth values in the depth buffer and samples a sphere around the point. Then it compares the depth of the samples with the depth of the point and computes an approximate ambient occlusion term based on the result of these comparisons.

In another prior art solution, solid angles occluded by neighboring pixels in screen space are accumulated based on the pixel eye-space positions and normals stored in an ND-buffer (e.g., normal buffer and depth buffer). The efficiency of this image-space method relies on the fact that neighbor pixels in screen space are likely to come from objects that are close to each other in world space. To capture the occlusion from distant occluders, the occlusion from precomputed spheres is added to the image-space occlusion. To reduce under-occlusion artifacts, the solution requires two ND-buffers: one for the front faces and one for the back faces. This image-based method has over-occlusion issues because all the samples are assumed to be visible from the surface point. Additionally, the requirement for the two ND-buffers increases the cost of a computer system capable of rendering real-time ambient occlusion graphics applications.

Thus, what is required is a solution capable of implementing real-time ambient occlusion graphics rendering while minimizing the visual artifacts and avoiding precomputation of geometric elements. What is further required is a solution that can compute per pixel approximated ambient occlusion as a fixed cost postprocessing pass, which can be combined with an image with minimal intrusion.

SUMMARY OF THE INVENTION

Embodiments of the present invention provide a solution capable of implementing real-time ambient occlusion graphics rendering while minimizing the visual artifacts and avoiding precomputation of geometric elements. Embodiments of the present invention further provide a solution that can compute per pixel approximated ambient occlusion as a fixed cost postprocessing pass, which can be combined with an image with minimal intrusion.

In one embodiment, the present invention is implemented as a method for computing ambient occlusion illumination. The method includes receiving a plurality of graphics primitives for rendering at a GPU of a computer system and rendering graphics primitives into pixel parameters of the pixels of a display, wherein the parameters include pixel depth values and pixel normal values. For each pixel of the display, an ambient occlusion estimation process is performed. Based on the pixel depth values, the 3-D eye space position corresponding to the pixel is computed. Based on the eye space position and the pixel normal values, horizon heights around the pixel are computed. A horizon ambient contribution can then be computed in relation to these heights. Based on a 3-D position of the point on the surface and the horizon height, a normal occlusion term for the point is computed and a final ambient occlusion illumination value is computed by combining the horizon occlusion term and the normal occlusion term.

In this manner, the ambient occlusion algorithm can operate on the depth buffer of a scene being rendered and the associated per-pixel normal buffer. The ambient occlusion algorithm can be implemented on the GPU graphics hardware in a pixel shader, independently of the scene geometry, thereby intelligently taking advantage of the hardware acceleration provided by the resources of the GPU. This allows the ambient occlusion algorithm to render high-quality ambient occlusion at interactive frame rates on current GPUs.

DETAILED DESCRIPTION OF THE INVENTION

Notation and Nomenclature:

Computer System Platform:

FIG. 1shows a computer system100in accordance with one embodiment of the present invention. Computer system100depicts the components of a basic computer system in accordance with embodiments of the present invention providing the execution platform for certain hardware-based and software-based functionality. In general, computer system100comprises at least one CPU101, a system memory115, and at least one graphics processor unit (GPU)110. The CPU101can be coupled to the system memory115via a bridge component/memory controller (not shown) or can be directly coupled to the system memory115via a memory controller (not shown) internal to the CPU101. The GPU110is coupled to a display112. One or more additional GPUs can optionally be coupled to system100to further increase its computational power. The GPU(s)110is coupled to the CPU101and the system memory115. System100can be implemented as, for example, a desktop computer system or server computer system, having a powerful general-purpose CPU101coupled to a dedicated graphics rendering GPU110. In such an embodiment, components can be included that add peripheral buses, specialized graphics memory, IO devices, and the like. Similarly, system100can be implemented as a handheld device (e.g., cellphone, etc.) or a set-top video game console device such as, for example, the Xbox®, available from Microsoft Corporation of Redmond, Wash., or the PlayStation3®, available from Sony Computer Entertainment Corporation of Tokyo, Japan.

It should be appreciated that the GPU110can be implemented as a discrete component, a discrete graphics card designed to couple to the computer system100via a connector (e.g., AGP slot, PCI-Express slot, etc.), a discrete integrated circuit die (e.g., mounted directly on a motherboard), or as an integrated GPU included within the integrated circuit die of a computer system chipset component (not shown). Additionally, a local graphics memory114can be included for the GPU110for high bandwidth graphics data storage.

EMBODIMENTS OF THE INVENTION

FIG. 2shows a flow diagram of an exemplary ambient occlusion algorithm200in accordance with one embodiment of the present invention. As illustrated inFIG. 2, the algorithm200begins with the rendering of a 3-D scene in step201and concludes with a final per pixel color being rendered into the frame buffer in step240.

The ambient occlusion algorithm shown inFIG. 2operates on the depth buffer (e.g., within local graphics memory114) of a scene being rendered and the associated per-pixel normal buffer (e.g., within the local graphics memory114). The ambient occlusion algorithm can be implemented on the GPU110graphics hardware in a pixel shader, independently of the scene geometry, thereby intelligently taking advantage of the hardware acceleration provided by the resources of the GPU110. In one embodiment, the ambient occlusion algorithm200further includes heuristics to reduce artifacts due to the incompleteness of the input data and includes parameters to make the algorithm readily customizable for quality or performance purposes. In this manner, the ambient occlusion algorithm200can render high-quality ambient occlusion at interactive frame rates on current GPUs. This enables the GPU to support real-time interactive 3-D graphics applications that perform high fidelity ambient occlusion illumination at a reasonable frame rates.

The algorithm200begins in step201with the rendering of a 3-D scene by the GPU (e.g., a GPU110). As described above, the ambient occlusion algorithm200operates on the depth buffer and the normal buffer of the scene as it is being rendered. The GPU110renders received graphics primitives into pixel parameters of the pixels of a display. These pixel parameters include pixel depth values, pixel normal values, and the like. As each primitive is rasterized and rendered by the GPU, each primitive's per pixel depth contribution is accumulated in the depth buffer, as shown by step202. For each pixel of the display, a depth value (e.g., z value) is stored. Similarly, as shown by step203, for each pixel of the display, as each primitive is rasterized in rendered by the GPU, the primitive's per pixel normal vector is accumulated and stored as a resulting per pixel normal vector, or simply “normal”. The result of the rendering in step201also results in a per pixel color value as shown by step204.

The horizon split ambient occlusion process220is a portion of the overall algorithm200that operates using the per pixel depth values from the depth buffer (e.g., step202) and the per pixel normals from the normal buffer (e.g., step203) as inputs. For example, in one embodiment, the horizon split ambient occlusion process220accesses an ND-buffer (e.g., normal buffer and depth buffer stored within the local graphics memory114) storing linear depths and normals for the pixels on the screen.

At step221, for each pixel, process220computes an eye-space position of its corresponding surface point “P”. This results in a three-dimensional position per sample on the rendered surface. As shown inFIG. 2, the 3-D position is passed as an input to a horizon occlusion process at step222. At step222, the first integral from the following ambient occlusion illumination equation is evaluated:

A=1-1π⁢(∫θ=02⁢⁢x⁢T⁡(θ)⁢⁢ⅆθ+∫θ=02⁢x⁢∫z=H⁡(θ)1⁢Vω→⁡(n_-ω→)⁢⁢ⅆω)
Where “A” is the ambient occlusion illumination, θ is the direction, T(θ) is the horizon occlusion in direction θ, H(θ) is the horizon height in direction θ, ω is the direction of rays in from the point P, n is the surface normal, and z is the depth. Accordingly, at step222, the horizon height H(θ) and its occlusion T(θ)=H(θ)2are computed, and at step223, the second integral from the ambient occlusion illumination equation is evaluated by means of tracing additional normal rays in the part of the hemisphere above H(θ) to complete the sampling of the hemisphere. And then, at step224, normal occlusion and the horizon occlusion are summed to produce the ambient occlusion term “A”. The ambient occlusion illumination is then transmitted to a combination process230with the per pixel color from step204. This results in the final per pixel color at step240which is, for example, written back out into the frame buffer. The final per pixel color includes the effects from the ambient occlusion illumination, and is used to render a realistic 3-D scene that incorporates realistic high fidelity ambient illumination effects. It should be noted that the ambient occlusion illumination and the per-pixel color can be combined in a number of different ways.

As described above, the combination of the ambient occlusion illumination with the pixel colors in step230can be obtained by means of a weighted summation with the final color C=(A*Ambient+Color), where Ambient is the color of the ambient light, and Color is the pixel color of the image obtained with any shading model.

Alternatively, the final color C can also be obtained by modulating the pixel colors with the ambient occlusion illumination with the final color C=A*Color, where Color is the pixel color of the image obtained with any shading model.

As described above, the horizon split ambient occlusion process220uses a set of random directions θ distributed around the normal n at point P on the surface S. For each angle θ, the height of the horizon H(θ) is computed by marching in the depth buffer along a line projected onto the tangent plane in direction θ. A side view of the process is shown byFIG. 3.

FIG. 4shows a flow chart of an exemplary of height computation process400in accordance with one embodiment of the present invention. Process400shows a flowchart of exemplary pseudo code steps401through415for computing height of the horizon H(θ).

Thus, for a given angle θ, the problem is to find the height of the horizon H(θ) seen from P within a certain radius of influence R around P. Starting with a ray hΘ=(P, t) where t is a surface tangent at P in the direction θ, the process incrementally extends the length of this ray Ns times. At each step, the end point Q of the ray hΘ is projected in screen space and its depth is compared with the depth of the corresponding point in the depth buffer. This is shown by steps401-409.

If the later is closer (Q is below the surface seen from the eye) as determined in step410, and additional conditions are satisfied, then ray hΘ is deflected towards the intersection point I and its length is normalized and rescaled to R/Ns*i (where i is the iteration value in step406). The horizon rays hΘ are deflected only if Q is within the distance R from P and if the candidate horizon ray has a proper direction (e.g., not inverted tangential component). This procedure is applied Nd times per pixel for randomly distributed angles θ distributed around the normal and the resulting heights define a piece-wise constant approximation of the horizon line H(θ) on the hemisphere Ω, until all rays have been cast, as shown by steps412and414.

With respect to the horizon occlusion term T(θ), the horizon occlusion term from the ambient occlusion illumination equation above is:

In one embodiment, to perform the integration, process220uses cylindrical coordinates (r, θ, z), where dω=dzdθ with r=1. Process222partitions Ω below H with adjacent vertical hemispherical lunes of height H(θi) subtending an angle α=θi+1−θi=2π/Nd around the normal. Process222then approximates the occlusion OT by:

Horizon occlusion typically produces good results for continuous surfaces with a single layer of depth complexity. A complementary algorithm to account for more complex occlusions such as inter-object occlusion is described below.

In respect to the normal occlusion, process223partitions Ω above H with adjacent vertical stripes of quadrilateral patches delimited by the heights zkas shown inFIG. 5. The normal occlusion for a given direction tiis:

The above equation is a valid approximation for any type of patch distribution. By picking a specific distribution, the above equation can be simplified so that each patch contributes the same amount of occlusion, which is more efficient. From a Monte-Carlo point of view, such a distribution is doing importance sampling using a cosine distribution in the upper part of the hemisphere.

The total normal occlusion is:

ON=∑i=1Nd⁢∑k=1Nn⁢V⁡(ω→)Nn⁢Nd
For each patch Pk, process223determines V(ω) in the direction rkby doing a linear search in the depth buffer in direction ˜w with a fixed number of steps. After determining V(ω), process223accumulates its occlusion contribution to the total occlusion O. Thus, as described above, the final light intensity from ambient occlusion at P is:
A=1−(OT+ON)

With respect to linear attenuation, it should be noted that at a distance R around objects, sharp occlusion boundaries may be visible because these occluders may strongly influence the ambient occlusion once they begin to be sampled. To soften these sharp edges, the processes in220can weight the contribution of each ray by a linear attenuation function based on the normalized distance between P and the occluder.

Parameter analysis of the process220is now described. It should be appreciated that a number of different parameters control the performance and overall quality of the ambient occlusion estimation. Radius of influence R defines the maximum distance of influence of any given occluder. Increasing this radius has two side effects: occluder undersampling in the hemisphere (requiring more sampling rays to maintain image quality) and stronger ambient occlusion values due to the existence of more occluders (e.g. we can maximize the occlusion for the walls inside a closed room if the radius is large enough to include the opposing walls). The number of tangent directions Nd is the number of rays around the normal used to estimate the horizon split line H(q). The total number of traced rays is proportional to this parameter. The number of normal rays Nn is the number of rays that will be used during ray marching for each tangential direction. These rays are distributed on the subset of the hemisphere above the horizon line H(θ) determined during the horizon tracing pass for each direction Nd. The number of steps Ns is the number of steps that both the horizon tracing and the ray marching passes will evaluate on a per ray basis. This parameter affects performance directly and also the quality of the results for scenes with high geometric detail.

TheFIG. 6embodiment shows exemplary components within the GPU110that implement the functionality of embodiments of the present invention. The setup unit601functions by receiving groups, streams, and the like, of primitives from a graphics application executing on the host CPU (e.g., CPU101). The communications link640shows communications pathways to and from the system memory of the computer system (e.g., via the system memory bus). The communications link650shows the communication pathways to and from the frame buffer and local graphics memory114. The setup unit601prepares this information for rasterization by the raster unit602and to these descriptions based upon vertices into edge descriptions.

The rasterizer unit602subsequently converts these edge descriptions into filled areas comprising actual pixel descriptions (e.g., pixel areas, pixel sub-samples, etc.). The descriptions include depth values and normal vectors for each pixel. The pixel descriptions are subsequently passed along to the shader unit603within the GPU110for further processing and rendering.

The shader unit603performs pixel shader processing for each of the pixels. The shader unit603typically operates on the pixels in accordance with the parameters iterated across each of the pixels.