US 7567248 B1 Abstract A system and method provide for determining in a computer system the intersections between a plurality of rays residing in three dimensional (3D) space and one or more surface elements residing in the 3D space. The rays or lines corresponding to the rays share a common intersection point. The method includes for each of the rays, storing the intersection point of the ray with a projection surface in the 3D space in a data structure in the computer system. For each of the surface elements, determining using projection a two-dimensional (2D) region representing the projection of the surface element onto the projection surface; and determining using intersection testing which points stored in the data structure are inside the 2D region. The points determined to be inside the 2D region represent intersection points between the surface element and the rays corresponding to the points.
Claims(58) 1. A method for determining in a computer system intersections between a plurality of light rays residing in three dimensional (3D) space and one or more surface elements residing in said 3D space, where said light rays or lines corresponding to said light rays share a common intersection point determined in connection with a light viewpoint, the method comprising:
determining 3D points visible from an eye viewpoint to provide a set of points on which subsequent shadow processing is performed;
processing intersection points irregularly arranged on a light projection surface with a center of projection at said light viewpoint comprising:
(i) for each 3D point visible from said eye viewpoint:
computing a two-dimensional location (2D) location of an intersection point of a light ray with said light projection surface by projecting said 3D point onto said light projection surface;
explicitly storing said two-dimensional (2D) location in a spatial data structure, in which 2D locations and not surface elements are stored, that supports efficient range queries for large numbers of points such that a distinct two-dimensional (2D) location is separately stored for each of said light rays, wherein an association is maintained between said two-dimensional (2D) location and said points visible from said eye viewpoint; and
(ii) processing each of said surface elements subsequent to said explicit storage of said 2D locations, including performing range query processing including determining, using intersection testing, which of the intersection points irregularly arranged on the light projection surface and stored in said data structure are inside a two-dimensional (2D) region, determined using projection, that represents projection of said surface element onto said light projection surface, wherein intersection points determined to be inside said 2D region represent intersections between said surface element and the light rays corresponding to said irregularly arranged intersection points;
wherein stored 2D locations of irregularly arranged intersection points are used in the intersection testing, and
wherein determination of whether or not a point is in shadow is performed as a function of the association maintained.
2. The method of
3. The method of
4. The method of
5. The method of
6. The method of
7. The method of
8. The method of
9. The method of
10. The method of
11. The method of
12. The method of
rasterizing an expanded triangle to determine a set of grid cells within said 2D spatial data structure that said 2D region partially or fully overlaps;
accessing data associated with each said grid cell to determine a set of points that potentially lie within said 2D region;
testing each of said points against the edges of said 2D region to determine which points are inside said 2D region to thereby determine which points stored in said 2D spatial data structure are inside said 2D region.
13. The method of
14. The method of
15. The method of
determining a depth value for each of said rays, said depth value representing the depth of the closest of said surface elements to said center of projection that have already been processed and that intersect said ray, and
determining a front most point using said depth values.
16. The method of
determining a flag bit for each of said rays, said flag bit indicating whether any of said surface elements intersects the ray along a specified segment of the ray.
17. The method of
18. The method of
19. The method of
20. The method of
21. The method of
22. The method of
23. The method of
selecting said rays based on predetermined sampling density criteria; and
computing an adaptively sampled image.
24. The method of
performing said storage of said point into said data structure using an atomic read/modify/write; and
parallel processing the remainder of the computation that does not perform atomic read/modify/write.
25. A system for determining intersections between a plurality of light rays residing in 3D space and one or more surface elements residing in said 3D space, where said light rays or their corresponding lines share a common intersection point determined in connection with a light viewpoint, the system comprising:
a memory system for storing a data structure; and
a processor system, configured to process intersection points irregularly arranged on a projection surface, the processor system configured for:
determining 3D points visible from an eye viewpoint to provide a set of points on which subsequent shadow processing is performed;
processing intersection points irregularly arranged on a light projection surface with a center of projection at said light viewpoint comprising:
(i) for each 3D point visible from said eve viewpoint:
computing a two-dimensional location (2D) location of an intersection point of a light ray with said light projection surface by projecting said 3D point onto said light projection surface;
explicitly storing said two-dimensional (2D) location in a spatial data structure, in which 2D locations and not surface elements are stored, that supports efficient range queries for large numbers of points such that a distinct two-dimensional (2D) location is separately stored for each of said light rays, wherein an association is maintained between said two-dimensional (2D) location and said points visible from said eye viewpoint; and
(ii) processing each of said surface elements subsequent to said explicit storage of said 2D locations, including performing range query processing including determining, using intersection testing, which of the intersection points irregularly arranged on the light projection surface and stored in said data structure are inside a two-dimensional (2D) region, determined using projection, that represents projection of said surface element onto said light projection surface, wherein intersection points determined to be inside said 2D region represent intersections between said surface element and the light rays corresponding to said irregularly arranged intersection points;
wherein stored 2D locations of irregularly arranged intersection points are used in the intersection testing, and
wherein determination of whether or not a point is in shadow is performed as a function of the association maintained.
26. The system of
27. The system of
28. The system of
29. The system of
30. The system of
31. The system of
32. The system of
33. The system of
34. The system of
35. The system of
36. The system of
37. The system of
38. The system of
39. The system of
40. The system of
41. The system of
42. The system of
43. The system of
44. The system of
45. The system of
46. The system of
47. The system of
48. The system of
49. The system of
50. The system of
51. The system of
52. The system of
53. The system of
54. The system of
55. A method for determining in a computer system intersections between irregularly arranged points explicitly stored in a data structure and one or more surface elements residing in a three dimensional (3D) space, said irregularly arranged points representing two-dimensional locations of intersection points of a plurality of rays residing in space with a projection surface in said 3D space, said rays or lines corresponding to said rays share a common intersection point, comprising:
determining 3D points visible from an eye viewpoint to provide a set of points on which subsequent shadow processing is performed;
processing intersection points irregularly arranged on a light projection surface with a center of projection at said light viewpoint comprising:
(i) for each 3D point visible from said eve viewpoint:
computing a two-dimensional location (2D) location of an intersection point of a light ray with said light projection surface by projecting said 3D point onto said light projection surface;
explicitly storing said two-dimensional (2D) location in a spatial data structure, in which 2D locations and not surface elements are stored, that supports efficient range queries for large numbers of points such that a distinct two-dimensional (2D) location is separately stored for each of said light rays, wherein an association is maintained between said two-dimensional (2D) location and said points visible from said eye viewpoint; and
(ii) processing each of said surface elements subsequent to said explicit storage of said 2D locations, including performing range query processing including determining, using intersection testing associated with said irregularly arranged points, which of the intersection points irregularly arranged on the light projection surface and stored in said data structure are inside a two-dimensional (2D) region, determined using projection, that represents projection of said surface element onto said light projection surface wherein intersection points determined to be inside said 2D region represent intersections between said surface element and the light rays corresponding to said irregularly arranged intersection points;
wherein stored 2D locations of irregularly arranged intersection points are used in the intersection testing, and
wherein determination of whether or not a point is in shadow is performed as a function of the association maintained.
56. A system for determining intersections between an explicitly stored plurality of points representing two-dimensional locations of irregularly arranged intersection points of a plurality of rays residing in space with a projection surface in a three dimensional (3D) space and one or more surface elements residing in said 3D space, where said rays or their corresponding lines share a common intersection point, comprising:
a memory system for storing a data structure including said plurality of points representing two-dimensional locations of irregularly arranged intersection points of said plurality of rays; and
a processor system for determining for each of said surface elements using projection a two-dimensional (2D) region representing the projection of said surface element onto said projection surface, the processor system configured for:
processing intersection points irregularly arranged on a light projection surface with a center of projection at said light viewpoint comprising:
(i) for each 3D point visible from said eye viewpoint:
(ii) processing each of said surface elements subsequent to said explicit storage of said 2D locations, including performing range query processing including determining, using intersection testing, which of the intersection points irregularly arranged on the light projection surface and stored in said data structure are inside a two-dimensional (2D) region, determined using projection, that represents projection of said surface element onto said light projection surface wherein intersection points determined to be inside said 2D region represent intersections between said surface element and the light rays corresponding to said irregularly arranged intersection points;
57. The system of
58. The system of
Description This application claims priority from, and the benefit of, U.S. Provisional Patent Application Ser. No. 60/565,969, entitled “System and method for efficiently computing intersections between rays and surfaces”, filed on Apr. 28, 2004, the contents of which are expressly incorporated herein by reference in their entirety. The present invention relates to computer graphics, and more particularly to efficient computation of intersections between ray and surfaces in interactive three-dimensional (3D) rendering systems. These intersection tests may be used, for example, for visible surface determination and for shadow computations. During graphics processing, a computer is commonly used to display three-dimensional representations of an object on a two-dimensional display screen. In a typical graphics computer, an object to be rendered is divided into a plurality of graphics primitives. The graphics primitives are basic components of a graphics picture and may be defined by geometry such as a point, line, vector, or polygon, such as a triangle. To produce an image for the two-dimensional display screen, the following two steps are typically performed, as well as others not described in detail here. -
- Eye-view visibility: For each pixel on the two-dimensional display screen, the computer determines which primitive is visible (i.e. front-most) at that pixel. The computer also determines the exact point on that primitive that is visible at the pixel.
- Light visibility (shadow computation): For each surface point that was determined to be visible by the first step, the computer determines whether the surface point is visible from the light source, indicating whether or not the surface point is in shadow. If there is more than one light source, this step is repeated for each light source.
These two tasks and others can be considered to be specific cases of the problem of determining which surfaces are visible (i.e. intersected first) along a specific a set of rays. The prior art consists of a wide variety of approaches for performing visibility tests, including: -
- Ray tracing: Turner Whitted, An Improved Illumination Model for Shaded Display, Communications of the ACM, vol. 23, no. 6, June 1980, pp. 343-349.
- Classical Z-buffer: Ed Catmull, A Subdivision Algorithm for Computer Display of Curved Surfaces, Ph.D. Dissertation, University of Utah, 1974.
- Shadow mapping (classical Z-buffer used for light viewpoint): Lance Williams, Casting Curved Shadows on Curved Surfaces, Computer Graphics (SIGGRAPH 1978), vol. 12, no. 3, August 1978, pp. 270-274.
- Shadow volumes: Franklin Crow, Shadow Algorithms for Computer Graphics, Computer Graphics (SIGGRAPH 1977), vol. 11, no. 2, July 1977.
- -And-
- Morgan McGuire and John F. Hughes and Kevin Egan and Mark Kilgard and Cass Everitt. Fast, Practical, and Robust Shadows. Brown University Technical Report CS03-19, October 2003.
All publications, patent applications, patents, and other references mentioned herein are incorporated by reference in their entirety. The ray tracing approach is highly general, but it is computationally expensive. The ray tracing approach has the additional disadvantage that the rendering system maintains a large spatially sorted data structure containing the graphics primitives. For these reasons, the ray tracing approach has not been widely used by interactive rendering systems. The conventional Z-buffer approach is the approach most commonly used in real-time rendering systems. However, it can only evaluate a restricted set of visibility queries: those in which all rays share a common origin and whose directions are regularly spaced. This restriction is equivalent to stating that an image generated using this technique must have its sample points located in a regular pattern such as a grid, as shown in The shadow volume technique was developed to avoid the objectionable errors of shadow mapping. Although the shadow volume technique has been used occasionally in commercial systems, it is widely considered to require excessive computational resources and to be particularly difficult to integrate into a complete and flexible image generation system. Therefore, a need exists for a method and apparatus for computing visibility that is more efficient than ray tracing and shadow volumes; that produces fewer visual errors than shadow mapping; that is simpler to integrate into a complete system than shadow volumes; and that supports a more flexible set of visibility queries than the conventional Z-buffer. More specifically, a need exists for a method and apparatus for computing visibility that runs at real-time frame rates and whose programming interface is similar to that of the conventional Z-buffer, but that allows visibility to be computed for an irregularly arranged set of points on the image plane as shown in The present invention provides a system and method for determining in a computer system the intersections between a plurality of rays residing in three dimensional (3D) space and one or more surface elements residing in the 3D space. The rays or lines corresponding to the rays share a common intersection point. The method includes for each of the rays, storing the intersection point of the ray with a projection surface in the 3D space in a data structure in the computer system. For each of the surface elements, determining using projection a two-dimensional (2D) region representing the projection of the surface element onto the projection surface; and determining using intersection testing which points stored in the data structure are inside the 2D region. The points determined to be inside the 2D region represent intersection points between the surface element and the rays corresponding to the points. The present invention may provide a new method and system for computing intersections between rays and surfaces. In one embodiment, computations of intersections between rays and surfaces are used for computing shadows in an interactive rendering system. The following description consists of four major parts: -
- a) Computer System: A high level description of a computer system that determines the intersection of rays and surfaces.
- b) Shadow Computation: A high-level description of how the present invention can be used to produce images containing shadows.
- c) Ray/Surface Intersection: A high-level description of a method for computing intersections between rays and surfaces, and of the data structures used for this purpose in one embodiment.
- d) Graphics Processor: A detailed description of an embodiment that uses a specific graphics processor architecture that allows the entire system to run at real-time frame rates.
Computer System and Graphics Processing Unit
Shadow Computation The present invention computes shadows using an improvement on the conventional shadow-mapping approach. In one embodiment, the shadow-map samples are taken at the desired points on the shadow-map image plane rather than at points on a pre-defined regular grid as the prior-art shadow mapping technique does. By taking samples at the desired points, this embodiment eliminates the aliasing artifacts produced by prior-art shadow mapping techniques. For eye-view visibility, all of the rays share a single origin, the eye viewpoint In the case where all visibility-test rays share a common origin, this origin is typically used to define the center of projection of an image plane. With this definition, the ray directions may be interpreted as sample points on the image plane. The overall shadow computation procedure works as follows: First, an image is generated from the Eye Viewpoint Second, the points Third, the ray/surface intersection technique described in the next subsection is used to produce a shadow-map image with depth samples at exactly the desired locations in the shadow-map image plane. At the end of this step, the system holds a depth value for each sample point Finally, a regular Z-buffer image is rendered from the eye view, and shading is performed by using the previously-computed light-view depth values (stored in Ray/Surface Intersection The present invention uses a new method and system of computing intersections between rays and surfaces. Although this problem is conceptually simple, solving this problem is computationally expensive when the number of Rays Therefore it is common to place specific constraints on the permissible rays to facilitate efficient solutions to the problem. The constraints are most easily expressed in terms of restrictions on the lines that are formed by extending each ray to infinity in both directions. In To further facilitate an efficient solution to the problem, it is common to express the ray directions as 2D points In the conventional Z-buffer, the ray directions are restricted such that the 2D points Given this set of restrictions of the conventional Z-buffer, the computer system of The method just described finds all intersections between Rays A major difference between the system of The operation of the system of -
- A preprocessing step in which the system creates the 2D spatial data structure
**708**containing the locations of the points**508**. - The actual intersection testing step.
- A preprocessing step in which the system creates the 2D spatial data structure
In the intersection testing step, the Surface Elements In one embodiment, the 2D range query is implemented by first determining which Physical Grid Cells Figures Showing how Ray/Surface Intersection Testing Works at a High Level Figures Showing how Ray/Surface Intersection Testing Works in Detail Graphics Processor The overall operation of the present invention is described in conjunction with -
- Construction Phase
**1502**: Compute all light-view sample locations and insert them into the sample-point data structure. - Irregular Rasterization Phase
**1504**: Generate a depth-only light-view shadow-map image using irregular rasterization. Sample locations are specified by the sample-point data structure.
- Construction Phase
During Irregular Rasterization Phase Refer again to The following subsections describe the components of Graphics Processing Unit Primitive Processor Each Primitive Processor Fragment Processor Overview As compared to prior-art fragment processors, Fragment Processor Each fragment processor Fragment Processor Operation during Construction Phase Once the Eye-View Image Pixel -
- Define Lgrid_i as the x coordinate of the Logical Grid Cell.
- Define Lgrid_j as the y coordinate of the Logical Grid Cell.
- Define Pgrid_i as the x coordinate of the Physical Grid Cell (to be computed).
- Define Pgrid_j as the y coordinate of the Physical Grid Cell (to be computed).
- Pgrid_width is the number of cells in the X dimension of the Physical Grid.
- Pgrid_height is the number of cells in the Y dimension of the Physical Grid.
- Tile height is the height of a locality-preserving tile, measured in units of Logical Grid cells.
- Tile width is the width of a locality-preserving tile, measured in units of Logical Grid cells.
- Pgrid_i=(abs(Lgrid_i)+floor(Lgrid_j/Pgrid_width)*tile_width) mod Pgrid_width
- Pgrid_j=(abs(Lgrid_j)+floor(Lgrid_i/Pgrid_height)*tile_height) mod Pgrid_height
The values of Pgrid_width, Pgrid_height, tile_height, and tile_width are not critical for correctness and thus may be tuned to optimize performance for particular hardware and scene configurations. In one embodiment, Pgrid_width is 512, Pgrid_height is 512, Tile_width is 8 and Tile_height is 4. Next, in Step Returning to the behavior in Fragment Processor Raster Operation Unit Overview The ROP unit in the present invention is more flexible than the ROP in prior art graphics processors. In particular, the ROP may generate writes to memory addresses other than the fragment's original frame buffer address. The ROP may use a pixel-cache organization (see “ Next details of the ROP architecture are described. The Atomicity Enforcer For each fragment, the Merge Buffer The Compute Unit The Left Pixel Cache Raster Operation Unit Operation during Construction Phase Raster and Stencil Test Unit Operation during Irregular Rasterization Phase Refer again to Fragment Processor Operation during Irregular Rasterization Phase Once the fragment has been assigned to a Fragment Processor It is useful to explain several steps in The purpose of Step Otherwise the depth of the triangle fragment is computed (step Raster Operation Unit Operation During Irregular Rasterization Phase In the Irregular Rasterization Phase Fragment Network To improve the spatial and temporal reuse of cached data as well as to avoid cache coherence issues, pixel addresses are statically mapped to ROPs. Fragment Network Memory Layout of Data Structures To improve cache performance, the data structures shown in Interface to Application Program The graphics processing unit Thus, in one embodiment, the potentially non-deterministic capabilities of the graphics processing unit are not exposed directly. These potentially non-deterministic capabilities are the low-level ROP configuration and the ability of the fragment processor to specify the frame buffer address of output fragments. Instead, the construction phase and irregular rasterization phase are exposed as high-level capabilities via extensions to the software API (specifically OpenGL and DirectX). These high level capabilities block the application program from directly accessing the grid of linked lists data structure. Instead, this data structure is accessed via an opaque handle. The API allows this data structure to be created from an eye-view image via one API call, and allows this data structure to be used for irregular rasterization via a second API call. The embodiment described explicitly stores sample locations in a two-dimensional spatial data structure rather than implicitly representing them with a regular pattern. In this embodiment, the data structure is a grid of linked lists. However, the data structure may be any spatial data structure that supports efficient range queries, such as a k-d tree, BSP tree, quad tree or a simple grid. In another embodiment, the data structure may be a data structure that places some restrictions on the configuration of sample locations that can be stored. In one specific alternative embodiment, the data structure is a grid of fixed-length lists or a grid of fixed-length arrays. During the construction phase, samples are discarded if they cannot be inserted into the data structure. In a second specific alternative embodiment, the grid data structure stores only one point per grid cell. This restricted approach still allows the location within the grid cell of this single sample point to be specified. Other alternative embodiments along these same lines will be obvious to one skilled in the art. Store Data Structures in on-Chip Memory An advantage of the present invention is that it produces artifact-free results with a strict bound on the amount of memory used for the data structures. This advantage permits an alternative embodiment in which some or all of the data structures described in Line Segments Rather than Rays Instead of intersecting rays with surface elements, line segments may be used to intersect with surface elements. Intersections beyond a certain distance along the ray may be ignored, or each ray may have an associated maximum distance stored with it in the data structure, with intersections beyond this distance ignored. As used herein, the term “ray” should be understood to include this case of line segments as well as similar modifications that would be obvious to one skilled in the art. More specifically, an alternative embodiment for shadow computation is described. In Points on Projection Surface Specified Directly In one embodiment described above, the points on the projection surface are computed by computing the intersection between the rays and the projection surface. In an alternative embodiment, the points on the projection surface are directly specified by the application program or software device driver. The application program or device driver may also specify the projection surface and the center of projection. In this embodiment, the points on the projection surface implicitly represent the rays. This alternative embodiment may be desirable when points are a more natural representation than rays for the application program or software device driver. Orthographic Projection The center of projection Surface Elements Representing Boundaries of Volume Elements The present invention may be used to compute intersections between rays and volume elements. In this alternative embodiment, the Surface Elements Maintaining Fragment Order Real-time rendering API's define precise ordering semantics for non-commutative operations such as blending and Z-buffered color writes. In some cases these semantics are directly useful to application programmers, but they may also guard against non-determinism from frame to frame or from one hardware generation to another. Fortunately, order does not matter when using the irregular Z-buffer to generate shadow or other Z-only maps. In the construction phase of irregular shadow mapping the ordering of nodes in each linked list is unimportant and opaque to the user if the data structure is hidden behind a high-level API as explained previously. In the rasterization phase, fragment order is not visible to the user because the Z comparison and update operation is commutative so long as it does not carry auxiliary information with it, such as color. However, the irregular Z-buffer can be used for different applications in which color is carried with Z (e.g. reflection map generation from reflective objects near a surface). For these applications, the preservation of fragment order during rasterization may matter. Because the system routes fragments from the Raster and Stencil Test Unit to Fragment Processing Units based on the fragment's logical grid cell, the system ensures that the fragments generated by a fragment program will belong to a particular logical grid cell. Thus, in this alternative embodiment global fragment order is be maintained automatically by maintaining fragment order within each fragment processor. In more detail, this is accomplished by ensuring that fragments are retired from the fragment processor in the same order that they enter the fragment processor. Other Graphics Processing Unit Architectures One feature of the Graphics Processing Unit is that it may utilize a highly-parallel internal architecture to achieve high performance. Other parallel architectures may be used as a Graphics Processing Unit. One such alternative embodiment is described in The University of Texas at Austin, Department of Computer Sciences Technical Report TR-04-09, Apr. 15, 2004, incorporated herein by reference. Another such alternative embodiment uses a chip-multi-processor architecture, such as the Sun Microsystem's Niagara architecture. SIMD Fragment Processor Architecture One feature of the Graphics Processing Unit is that it may utilize a Multiple Instruction Multiple Data architecture. With adjustments to the operations illustrated in Construction Phase Performed on CPU In another alternative embodiment, the construction phase of the technique is executed by a processor on a different semiconductor chip than the Graphics Processor. More specifically, the construction phase is performed by the CPU. Removal of any-to-any Fragment-Network Routing in Irregular Rasterization Phase In an alternative embodiment, the fragment network performing any-to-any routing during the irregular rasterization phase is eliminated. This is done by dynamically allocating storage for linked list nodes at new addresses, instead of storing linked list nodes at their eye-space index. The memory allocated to each node is chosen such that the node is stored in memory “owned” by the ROP just below the fragment processor which “owns” the node's logical grid cell. Thus, during the irregular rasterization phase, fragments always pass directly from a fragment processor to the ROP below that fragment processor. Memory allocation is performed separately for the region of memory “owned” by each ROP. Memory allocation may be performed by incrementing one or more counters associated with each ROP. Because one embodiment is described for shadow computations, some of the steps in the this embodiment combine operations specific to shadow computation with operations that would be used for any type of visibility computation that benefits from an irregular image-plane sample pattern such as that shown in Step Other uses for the system and method of intersection testing include generation of reflection maps, adaptive sampling (e.g. for anti-aliasing), and limited forms of ray tracing as described in “ In the foregoing description, various methods and apparatus, and specific embodiments are described. However, it should be obvious to one conversant in the art, various alternatives, modifications, and changes may be possible without departing from the spirit and the scope of the invention which is defined by the metes and bounds of the appended claims. Patent Citations
Non-Patent Citations
Referenced by
Classifications
Rotate |