Method and system for improving shadowing in a graphics rendering system
First Claim
1. In a graphics rendering system for rendering graphical models to a view space to generate successive frames of animation, a method for computing shadows for the frames of animation comprising:
- for a first frame, transforming characteristic points on a shadowing object to shadow map space, and saving the transformed characteristic points;
for the first frame, rendering geometric primitives in a view volume from the perspective of a light source to compute a shadow depth map, rendering the geometric primitives from the perspective of a viewpoint to compute an image illuminated by the light source, and applying the shadow depth map to the image to compute a shadowed image; and
for a subsequent frame, transforming the characteristic points on the shadowing object to the shadow map space, computing a difference between the transformed characteristic points for the first frame and the subsequent frame, re-rendering the shadow depth map when the difference exceeds a predefined amount, and re-using the shadow depth map to compute a shadowed image for the subsequent frame when the difference is less than the predefined amount.
1 Assignment
0 Petitions
Accused Products
Abstract
A system for improved shadowing of images using a multiple pass, depth buffer approach includes rendering a scene from the perspective of a light source to construct a shadow depth map in a rasterization buffer. The system computes depth values for the two nearest geometric primitives to the light source for pixels, and stores these depth values in the rasterization buffer. Once the shadow map is constructed, it is stored in shared memory, where it can be retrieved for subsequent rendering passes. The two depth values for each element in the shadow map can be used in combination with a global bias to eliminate self-shadowing artifacts and avoid artifacts in the terminator region. The system supports linear or higher order filtering of data from the shadow depth map to produce smoother transitions from shadowed and un-shadowed portions of an image. In addition, the system supports the re-use of the shadow map and shadowed images for more than one frame.
393 Citations
11 Claims
-
1. In a graphics rendering system for rendering graphical models to a view space to generate successive frames of animation, a method for computing shadows for the frames of animation comprising:
-
for a first frame, transforming characteristic points on a shadowing object to shadow map space, and saving the transformed characteristic points;
for the first frame, rendering geometric primitives in a view volume from the perspective of a light source to compute a shadow depth map, rendering the geometric primitives from the perspective of a viewpoint to compute an image illuminated by the light source, and applying the shadow depth map to the image to compute a shadowed image; and
for a subsequent frame, transforming the characteristic points on the shadowing object to the shadow map space, computing a difference between the transformed characteristic points for the first frame and the subsequent frame, re-rendering the shadow depth map when the difference exceeds a predefined amount, and re-using the shadow depth map to compute a shadowed image for the subsequent frame when the difference is less than the predefined amount. - View Dependent Claims (2, 3, 4)
a) transforming pixel coordinates and a depth value from the perspective of the viewpoint into transformed pixel coordinates and a transformed depth value in light space coordinates;
b) placing a filter footprint in the shadow depth map such that the transformed pixel coordinates are approximately at the center of the filter footprint;
c) comparing the transformed depth value with samples in the filter footprint to compute a shadow mask with entries corresponding to the samples in the filter footprint, and d) applying a linear or higher order filter to at least some of the entries in the shadow mask to compute a shadow attenuation coefficient.
-
-
3. The method of claim 2 wherein the linear or higher order filter is applied so that shadow mask entries at outer edges of the filter footprint contribute less to the shadow attenuation coefficient than other shadow mask entries within the filter footprint.
-
4. A computer-readable medium comprising computer-readable instructions for performing the method of claim 1.
-
5. In a graphics rendering system for rendering graphical models to a view space to generate successive frames of animation, a method for computing shadows for the frames of animation comprising:
-
for a first frame, transforming characteristic points on a shadowing object and a shadowed object to shadow map space, and saving the transformed characteristic points;
for the first frame, rendering geometric primitives in a view volume from the perspective of a light source to compute a shadow depth map, rendering the geometric primitives from the perspective of a viewpoint to compute an image illuminated by the light source, computing a shadow image comprising an array of shadow attenuation coefficients indicating an extent to which the shadowed object is shadowed by the shadowing object, and applying the shadow image to the image to compute a shadowed image; and
for a subsequent frame, transforming the characteristic points on the shadowing object and the shadowed object to the shadow map space, computing a difference between the transformed characteristic points for the first frame and the subsequent frame, re-rendering the shadow image when the difference exceeds a predefined amount, and re-using the shadow image to compute shadowed image for the subsequent frame when the difference is less than the predefined amount.
-
-
6. A method for shadowing a scene comprised of geometric primitives in a view volume, the method comprising:
-
rendering the geometric primitives from a perspective of a light source to create a shadow depth map;
performing a shadow filtering pass on the geometric primitives including;
a) transforming pixel coordinates and a depth value from the perspective of the viewpoint into transformed pixel coordinates and a transformed depth value in light space coordinates;
b) placing a filter footprint in the shadow depth map such that the transformed pixel coordinates are approximately at the center of the filter footprint;
c) comparing the transformed depth value with samples in the filter footprint to compute a shadow mask with entries corresponding to the samples in the filter footprint, d) applying a linear or higher order filter to at least some of the entries in the shadow mask to compute a shadow attenuation coefficient, and repeating steps a) through d) for subsequent pixel locations;
rendering the geometric primitives from the viewpoint to compute an image illuminated by the light source; and
modulating the image illuminated by the light source by the shadow attenuation coefficients. - View Dependent Claims (7, 8, 9, 10)
dynamically computing filter coefficients for the triangle filter during the shadow filtering pass.
-
-
8. The method of claim 6 wherein the step of computing the filter coefficients includes:
-
repetitively applying a two dimensional filter to different locations around a point mapped into the shadow depth map, including summing shadow mask entries corresponding to samples within the two dimensional filter, and dividing by the number of samples in the two dimensional filter to compute a preliminary shadow coefficient; and
performing interpolation among the preliminary coefficients to compute a final filter coefficient.
-
-
9. The method of claim 6 wherein the step of computing the filter coefficients includes:
interpolating shadow mask entries that fall within the filter footprint to determine the filter coefficient corresponding to the filter footprint.
-
10. The method of claim 6 wherein the linear or higher order filter is a trapezoidal filter including a linear section at edges of the filter footprint and a box filter section.
-
11. In a system for rendering geometric primitives in a view volume to compute an image for a view space, a rendering system for shadowing the image comprising:
-
texture memory;
a rasterization buffer with entries for storing first and second depth values for at least a chunk of the image, where the chunk is an n by m region of the image and n and m are integer numbers;
a rasterizer for converting the geometric primitives into shadow depth values at locations in a shadow depth map during a shadow map rendering pass, for converting each of the geometric primitives into color values and a depth value at pixel locations in the image while rendering the geometric primitives from a perspective of a viewpoint in a second rendering pass, and for transforming pixel coordinates in the image and depth values of the geometric primitives from the perspective of the viewpoint to light space coordinates during the second or a subsequent rendering pass;
a pixel engine in communication with the rasterizer for receiving the shadow depth values from the rasterizer and in communication with the rasterization buffer for writing first and second closest shadow depth values to a light source into the rasterization buffer at corresponding locations in the shadow map;
the pixel engine in communication with the rasterizer for receiving the color values and the depth value for each of the geometric primitives during the second rendering pass, for performing a depth compare operation to determine which of the color values and depth values to store in the rasterization buffer during the second rendering pass;
an anti-aliasing engine in communication with the rasterization buffer for reading the first and second closest depth values during the shadow map rendering pass and computing sample values for locations in the shadow depth map from the first and second closest depth values at each location in the shadow depth map;
the anti-aliasing engine in communication with the texture memory for transferring the shadow depth map to the texture memory;
a texture cache;
a texture block fetch in communication with the texture memory and the texture cache for transferring the shadow map from the texture memory to the texture cache; and
a shadow filter engine in communication with the texture cache for filtering shadow mask entries derived from shadow depth map samples in the texture cache and computing attenuation coefficients for pixel locations in the image;
wherein the pixel engine is in communication with the shadow filter engine for receiving the attenuation coefficients, and is in communication with the rasterization buffer for applying the attenuation coefficients to the color values stored in the rasterization buffer from the second rendering pass.
-
Specification