US 20090189898 A1
Methods, systems, devices, and computer program code (software) products enable acceleration of ray tracing by using acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
1. In a computer graphics system comprising a computer and a display element, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene, the improvement comprising:
accelerating ray tracing by using acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
2. In a computer graphics system comprising a computer and a display clement, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, die computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene, the improvement comprising:
employing shallow bounding volume hierarchies (BVH) to enable rapid tracing of incoherent rays using streaming SIMD (Single Instruction, Multiple Data) instructions.
3. In the system of
4. In the system of
5. In the system of
6. In the system of
7. In the system of
8. In the system of
9. In the system of
10. In the system of
11. In the system of
12. In the system of
13. In the system of
14. In the system of
15. In the system of
16. In the system of
17. In the system of
18. In die system of
19. In the system of
20. In the system of
21. In the system of
22. In the system of
23. In the system of
24. In the system of
25. In the system of
26. In the system of
27. In the system of
28. In the system of
29. In the system of
30. In the system of
31. In the system of
32. In the system of
33. In the system of
34. In the system of
35. In the system of
36. In the system of
37. In the system of
38. A method, executable in a computer graphics system comprising a computer and a display element, the display clement being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and die simulating of trajectories of rays illuminating objects in the scene, the method comprising:
accelerating ray tracing by using .acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
39. A method, executable in a computer graphics system comprising a computer and a display element, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in die scene and the simulating of trajectories of rays illuminating objects in the scene, the method comprising:
employing shallow bounding volume hierarchies (BVH) to enable rapid tracing of incoherent rays using streaming SIMD (Single Instruction, Multiple Data) instructions.
40. A computer graphics system comprising a computer and a display element, the display clement being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in die scene and die simulating of trajectories of rays illuminating objects in the scene, the computer graphics system further comprising:
means for accelerating ray tracing by using acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
41. A computer graphics system comprising a computer and a display element, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising die calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene, the computer graphics system further comprising:
means for employing shallow bounding volume hierarchies (BVH) to enable rapid tracing of incoherent rays using streaming SIMD (Single Instruction, Multiple Data) instructions.
42. A computer program code product comprising computer-readable program code stored on a computer-readable medium, operable for execution in a computer graphics system comprising a computer and a display element, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene, the computer program code product further comprising:
computer program code means, stored on the physical, computer-readable medium and executable by the computer to enable the computer to accelerate ray tracing by using acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
43. A computer program code product comprising computer-readable program code stored on a computer-readable medium, operable for execution in a computer graphics system comprising a computer and a display element, the display element being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene, the computer program code product further comprising:
computer program code means, stored on the physical, computer-readable medium and executable by the computer to enable the computer to employ shallow bounding volume hierarchies (BVH) to enable rapid tracing of incoherent rays using streaming SIMD (Single Instruction, Multiple Data) instructions.
The present application is a Continuation-in-Part of U.S. patent application Ser. No. 11/474517 (Attorney Docket MENT-101-US), and claims the priority benefit of U.S. Provisional Applications for Patent Ser. Nos. 60/988337 and 61/112529 (MENT-208-PR and MENT-208-B-PR), each of which is incorporated herein by reference.
U.S. patent application Ser. No. 11/474,517, filed Jun. 23, 2006 (Attorney Docket MENT-101-US), claims the benefit of United States Provisional Patent App. Ser. No. 60/693,231 filed Jun. 23, 2005 (Attorney Docket MENT-101-PR), and is also a Continuation-in-Part of U.S. patent application Ser. No. 10/299,574, filed Nov. 19, 2002 (Attorney-Docket MENT-075).
U.S. patent app. Ser. No. 10/299.574 (Attorney Docket MENT-075) is a Continuation-in-Part of U.S. Ser. No. 09/884,861, filed Jun. 19, 2001 (Attorney Docket MENT-061), which claims priority benefit from U.S. Provisional Patent App. Ser. No. 60/265,934, filed Feb. 1, 2001, and 60/212,286 filed Jun. 19, 2000.
Each of the above-listed patent applications, including, but not limited to, Attorney Docket MENT-061, MENT-075, MENT-101-PR, and MENT-101-US, as well as their provisional counterparts, is incorporated by reference herein in its entirety as if set forth in its entirety herein.
The present invention relates to systems, methods, devices, architectures, apparatus and computer software/program code products for computer graphics.
Computer graphics systems and methods for synthesizing photorealistic images, i.e., images that cannot be distinguished from photographs, have a wide field of applications, among them being the animated movie industry and product visualization. Photorealistic image synthesis typically requires the simulation of global illumination, which can typically only be approximated in a consistent manner by using ray tracing.
Contrary to rasterization, ray tracing allows one to follow arbitrary transport paths of light. Algorithms that perform physically correct simulations of light transport tend to shoot rays as wide-spread as possible in order to increase efficiency. As a result, most rays that account for global illumination effects arc incoherent.
Among examples of prior art approaches, the following arc various documents, each of which is incorporated herein as if set forth herein in its entirety:
Ray tracing, such as ray tracing as described in a number of the above-listed documents, has a long history, but became interactive only recently. Rapid algorithms to construct the acceleration data structures cut down the preprocessing time and the actual ray tracing speed has been improved by tracing coherent packets of rays using SIMD (Single Instruction Stream. Multiple Data Stream) instructions of current processors. Most of the rays in global illumination computations are incoherent by intention and major parts of the simulation cannot benefit from tracing packets of rays.
However, in order to benefit from SIMD instructions, such SIMD instructions are typically used in a conventional manner by using multiple objects simultaneously, e.g., 4 triangles at a time, 4 bounding boxes at a time, and several split planes at a time. Compared to tracing packets, this has the major disadvantage that memory bandwidth is not reduced.
It would be desirable and valuable to provide computer graphics methods, systems, and computer program products utilizing SIMD instructions in which memory bandwidth requirements can be reduced, and which afford improved performance.
The invention provides systems, devices, methods and computer program code (software) products for, among other aspects and possible applications, enabling computer graphics systems to accurately and efficiently render images. Systems, devices, methods and computer program code (software) products in accordance with the invention are suitable for implementation or execution in, or in conjunction with, a computer graphics system including a computer for rendering images for storage or for display, such as on a display element, wherein the rendering of an image comprises utilizing the computer and/or other elements of the computer graphics system to generate pixel values corresponding to pixels in an image representation. Systems, devices, methods and computer program code (software) products in accordance with the present invention arc suitable for implementation or execution in, or in conjunction with, a wide range of commercially available computer graphics systems or software environments, such as those available from MENTAL IMAGES GMBH of Berlin, Germany.
One aspect of the present invention relates to a computer graphics system comprising a computer and a display element, the display clement being operable to display a human-perceptible image in response to a display-controlling electrical output from the computer, the computer being operable to generate the display-controlling electrical output based on calculations of pixel values for pixels in the image, respective pixel values being representative of at least one point in a scene as recorded on an image plane of a simulated camera, the computer being operable to generate pixel values for an image using a ray-tracing methodology, the ray-tracing methodology comprising the simulating of at least one ray shot from the pixel into a scene, or from the scene to a pixel, along a selected direction, the ray-tracing methodology further comprising the calculating of the intersections of rays and surfaces of objects in the scene and the simulating of trajectories of rays illuminating objects in the scene.
In conjunction with this aspect, the invention comprises methods, systems, devices and computer program code (software) for accelerating ray tracing by using acceleration data structures with high arity to enable processing of nodes using streaming SIMD (Single Instruction, Multiple Data) instructions with reduced memory requirements.
In another aspect, the invention comprises methods, systems, devices and computer program code (software) employing shallow bounding volume hierarchies (BVH) to enable rapid tracing of incoherent rays using streaming SIMD (Single Instruction. Multiple Data) instructions.
In one practice or embodiment of the invention, the SIMD instructions are used in construction of bounding volume hierarchies, tree traversal and leaf intersection.
In another practice or embodiment, the use of streaming SIMD instructions is enabled by increasing the arity of acceleration structures, which also reduces memory requirements.
In accordance with the invention, caching can be utilized to accelerate processing of shadow rays in a global illumination process without increasing memory requirements.
Also in accordance with the invention, sorted traversal can be utilized.
A further aspect of the invention includes methods, devices, systems or computer software code products (software) applying streaming SIMD instruction processing to leaf intersection, using a cache storing image-related triangles in SIMD-compatible form.
The SIMD-compatible form can include a vertex-index representation of triangles or other compressed representation.
The invention can also comprise sorting an additional index array.
Another embodiment or practice of the invention can comprise tree construction by flattening binary trees, flattening binary trees comprises collapsing a classical binary tree. Collapsing a classical binary tree can comprise keeping each k-th level of a given tree, and discarding intermediate levels.
Another embodiment or practice of the invention can comprise utilizing a selected stack-based tree traversal technique.
Yet a further aspect of the invention includes methods, devices, systems or computer software code products (software) utilizing any of (or a combination of) triangle intersection processing. SIMD caching and a vertex-index data structure or other compressed representation.
Other aspects of the invention can include techniques for accelerating processing of shadow rays for point-light-based global illumination, which can comprise any of (or a combination of): quitting traversal on first intersection found, omitting sorting of nodes pushed on the stack, not computing intersection distances, and starting traversal deeper in the tree instead of from a root node. The techniques for accelerating processing of shadow rays can also include utilizing a backtracking technique that enables a plurality of nodes of the tree to be used as an entry point that yields correct results.
A further aspect of the invention includes methods, devices, systems or computer software code products (software) for executing a numerically robust triangle subdivision technique that subdivides triangles only when required, and wherein a degree of subdivision is automatically selected. The triangle subdivision technique can comprise an edge volume technique that evaluates the tightness of the bounding box of each triangle edge and subdivides the triangle until a selected threshold value is met. The edge volume technique can further include determining, for each edge of a given triangle, its axis-aligned bounding box. The edge volume technique can also include comparing, for a given triangle, the volume of the largest of the three boxes to a volume threshold, and if the volume is larger than the threshold, subdividing the triangle in the middle of the corresponding edge, and repeating the procedure for the two new triangles until the process is complete. In one practice or embodiment of the invention, the edge volume threshold is determined as a fraction of the volume of the scene bounding box, thus controlling the number of triangles generated by subdivision.
In selected practices or embodiments of the invention, the procedures described herein can be applied either as a pre-process before ray tracing, or for on-demand subdivision during ray tracing.
Another aspect of the invention can include reducing overlap of bounding volumes of geometry of a scene. Reducing overlap can comprise caching hierarchies for selected small portions of image components.
In still another aspect, the invention can include methods, devices, systems or computer software code products (software) for generating high arity data structures by collapsing classic data structure hierarchies by merging levels of the hierarchies.
In another aspect of the invention, for volume elements of a defined size, independent of object size, acceleration data structures are cached, and may be employed to construct a top-level acceleration data structure.
The techniques and procedures described herein of employing shallow BVH and using streaming SIMD instructions can be applied to at least one spatial partitioning scheme, which can include any of, or a combination of, kd-trees and BSP-trees.
The invention can also include applying streaming SIMD instructions to at least one object list partitioning scheme. The object list partitioning scheme can include bounding volume hierarchies.
Another aspect of the invention can also include, in addition to one or a number of the techniques described above, executing at least one operation that traces packets of rays.
Still a further aspect of the invention comprises processing a non-axis aligned geometry using a partitioning heuristic. The partitioning heuristic can be applied in any tessellation in order to provide crack free tessellation.
These and other aspects, examples, embodiments and practices of the invention, whether in the form of methods, devices, systems or computer software code products (software), will be discussed in greater detail below in the following Detailed Description of the Invention and in connection with the attached drawing figures.
FIGS. 26,27A and 27B are a series of schematic diagrams illustrating a suitable digital processing environment for use in practice various described aspects of the present invention.
The present description is divided into the following sections:
1. Shallow Bounding Volume Hierarchies for Fast SIMD Tracing of Incoherent Rays
3. Exemplary Code Listings
4. Digital Processing Environment; Efficient Construction of Acceleration Data Structures
5. Overall System and Technique
Photorealistic image synthesis is a computationally demanding task that relies on ray tracing for the evaluation of integrals. Rendering time is dominated by tracing long paths that arc very incoherent by construction. The present invention therefore provides systems and techniques in which SIMD (Single Instruction, Multiple Data) instructions arc used to accelerate incoherent rays.
As described herein, SIMD is used in hierarchy construction, tree traversal and leaf intersection. This is achieved by increasing the arity of acceleration structures, which also reduces memory requirements. As shown below, the resulting hierarchies can be built quickly and are smaller than known acceleration structures, while at the same time outperforming them for incoherent rays. The new acceleration structure speeds up ray tracing by a factor of 1.6 to 2.0 compared to a highly optimized bounding interval hierarchy implementation, and 1.3 to 1.6 compared to an efficient kd-tree. At the same time, the memory requirements are reduced by 10-50%. Additionally, there is shown how a caching mechanism in conjunction with this memory efficient hierarchy can be used to speed up shadow rays in a global illumination algorithm without increasing the memory footprint. This optimization decreased the number of traversal steps up to 50%.
Improving ray tracing performance has received significant attention in the art. One of the most popular acceleration structures for fast ray tracing is the kd-tree. Bounding volume hierarchies (BVH) belong to the simplest and most efficient acceleration schemes for ray tracing. Memory requirements and memory latency have been recognized as bottlenecks and fast tree construction has been investigated. Significant efforts have been expended with respect to the exploitation of SIMD instructions in modem processor environments for coherent packets of rays.
Techniques that perform physically correct simulations of light transport tend to shoot rays that are spread as widely as possible in order to increase efficiency, e.g., by employing quasi-Monte Carlo methods. As a result, most rays that account for global illumination effects are incoherent. Because of that, major parts of the simulation cannot benefit from tracing packets of rays. This has been recognized in professional rendering products as well. These products use SIMD instructions by intersecting multiple objects at a time. Compared to tracing packets, this approach has significant disadvantages, as traversal is not accelerated, and memory bandwidth is not reduced.
An aspect of the invention addresses the bandwidth problem by reducing the memory footprint of the acceleration data structure. A technique according to the present invention increases the arity of the acceleration hierarchy, which saves memory for nodes and pointers. The presently described techniques are applied in the context of efficient SIMD processing, and without the drawbacks of limited precision and median split tree construction. A further aspect of the invention shows how to use the memory layout of the new acceleration structure to contain additional data used to transparently speed up coherent rays. The described technique uses a form of backtracking without additional memory requirements and with entry points at every node. The present invention further teaches how to construct the acceleration structure in this case while still minimizing the cost function. In addition, the presently described data structure supports sorted traversal, which has been found to be crucial for good performance on current CPU architectures, especially for intersection rays.
1.2 n-ary Bounding Volume Hierarchy
Bandwidth problems are an issue for efficient streaming processing. The present invention reduces memory consumption by flattening the hierarchy and favoring larger leaves. This approach also allows for efficient streaming intersection of primitives. Axis-aligned bounding boxes, which arc stored as a minimum and a maximum corner point, arc used for bounding volumes. A detailed description of the memory layout is given below in Section 1.2.1.
As the typical SIMD width in current processors is n=4, the new BVH implementation is referred to herein as QBVH (i.e., Quad-BVH). However, it will be apparent from the present discussion that the techniques described herein may be readily extrapolated to apply to SIMD widths where n>4.
In a conventional binary approach, nodes are created after each split. In other words, in the example shown in
According to the presently described example of the invention, the same split plane proposals as for the binary case arc used but instead of creating nodes after each split, the object sets arc split a second time, resulting in four disjoint object sets.
It will be seen that in the presently described scheme each node contains the four bounding volumes of its children. Thus, the top-level node of the tree already contains four bounding boxes, which can be processed using SIMD.
Additionally, the four child pointers and the three axes of the proposed split planes are stored for each inner node. These split axes are used for an efficient, sorted traversal similar to binary BVHs as described in Section 1.2.3.
In Section 1.2.4, the paradigm of streaming processing and low memory consumption is applied to leaf intersection. This is achieved using a small cache storing the triangles in a SIMD-friendly form. This also allows more memory-efficient, but slower, representations of the triangle data without a major speed impact.
In Section 1.3.3 the vertex-index representation of triangles is compared to the direct 9 floats representation often used in real-time ray tracing. Other existing method for memory reduction can be incorporated as well. Cache-friendly padding of the node structure provides some additional memory, which can be used to improve performance. According to a further aspect of the invention, this is exploited to accelerate shadow rays, as described in Section 1.4.
1.2.1 Memory Layout
In real-time rendering systems, the triangle data is often sorted directly during tree construction for more efficient memory access in the leaf intersection. However, this is not an option in production rendering systems, as other parts of the renderer may depend on the original order. For this reason, an additional index array is sorted instead. In the presently described implementation, the following data layout was chosen for the tree nodes:
The result is a large BVH node with a size of 128 bytes, which perfectly matches the typical cache size of modern computer hardware. The four bounding boxes arc stored in structure-of-arrays (SoA) layout for direct processing in SIMD registers. Of course, the axes could be packed into a single value. However, for cache alignment reasons the size of 128 bytes is favorable. Packing the data into a single value would save only 10% of the total memory consumption. The integer (fill) is used to store additional data for optimizations later on. The tree data is kept in a linear array of memory locations, so the child pointer can be stored as integer indices instead of using platform-dependent pointers.
It is important to note that for a leaf, no additional (SIMD_BVH_Node) is created. The leaf bounding box is already stored in the parent, and die leaf data can be encoded directly into the corresponding (child) integer.
The sign of the child index is used to encode whether a node is a leaf or an inner node.
There exist various encoding possibilities. Which of these is the most efficient depends on the processor architecture and compiler. The most memory-efficient approach is to directly encode the leaf information into the remaining 31 bits. Without loss of generality, 4 bits are chosen for the number of triangles in the leaf, and the remaining 27 bits are chosen for the start index in the triangle array. Since the triangle intersection is performed using SIMD, the number is a multiple of 4. So up to 64 triangles per leaf can be stored and up to 227 triangles can be indexed. Empty leaves are encoded in a special value (INT_MIN). Thus, the 4 bits can be used for the full 64 (i.e., 16×4) triangles. Note that when using bounding volume hierarchies the number of triangles per leaf is easily bounded, because forcing another split guarantees a reduction in the number of triangles.
If the upper bound of 227 is not acceptable for certain applications, a slightly less memory-efficient version is created. The full 31 bits are used to index an additional data structure containing the leaf information. Another memory-efficient encoding strategy is to store only the start value of the triangle reference array and to mark the last triangle with a negative index in this array.
The n=2k-ary BVH tree construction can be seen as collapsing a classical binary tree. This is illustrated in
This view allows the use of the same construction principles used for binary trees to construct 2k-ary trees. In an exemplary implementation, the described techniques were used to construct good quality trees with fast construction times. Min-max binning with 8 bins was used to approximate the surface area heuristic (SAH). This implementation is vectorized by the compiler and efficiently uses SIMD instructions. Only a fraction of the primitives is used for the SAH approximation in higher levels of the tree. Further speedup is achieved by precomputing the bounding boxes of the triangles in a SIMD layout, overwriting the triangle data. This way, the implementation can benefit from SIMD operations during construction without using additional memory. After construction, the triangle data is filled in. (If stored on disk, the triangle data is reloaded from disk.) The construction is additionally sped up by allowing more primitives per leaf resulting in flatter trees. In all measurements, a leaf is created whenever the primitive count drops below 17. Using this implementation, it is possible to get very fast tree construction times that are even comparable to the BIH.
While using four boxes per node would already be sufficient to enable SIMD processing of the above data structure, it is important to store along which planes (perpendicular to the canonical x-,y-, or z-axes) the objects were partitioned. The plane indices of the binary hierarchy are stored as three integers (axis0), (axis1), and (axis2). respectively. This approach allows the spatial order of the boxes to be exploited for a more efficient pruning using the sign of the ray direction during tree traversal.
Given a ray, the stack-based traversal algorithm starts by simultaneously intersecting the ray with the four bounding boxes contained in the root (SIMD_BVH_Node) using SIMD instructions. The pointers of the children with a non-empty bounding box intersection are sorted and then pushed onto the stack. The routine is repeated by popping the next element as long as there is one.
The ray is prepared prior to traversal by replicating the values for the maximum ray distance (tfar), the origin, and reciprocal of the direction across a SIMD register. Additionally the signs of the components of the ray direction are stored as integers to allow easy indexing of the near and far bounding box sides.
For the bounding box intersection a branch-free implementation of the slab test is used. The four boxes are intersected simultaneously with the replicated ray. The return value of this function is an SIMD mask containing all 1's when the respective box has been intersected and 0's otherwise.
In order to enable an early pruning of the traversal, the nodes are pushed onto the stack according to the order determined by the ray direction. Using the split plane indices stored during tree construction, the sign of the respective component of the ray direction vector determines whether or not to swap the two corresponding children, as illustrated in
Two implementations of this sorting turned out to be good choices. The most elegant variant is based on SIMD sorting techniques that work branch-free on SIMD registers by using masking and swizzling.
First, the four child pointers are loaded into a SIMD register. Second, an SIMD mask is constructed for each of the three axes stored in the BVH node based on the sign of the ray direction of that component. Third, this mask is used to select either the original value or a shuffled value resulting in a correctly ordered SIMD register. Finally, the contents of the SIMD child register are pushed onto the stack in a scalar way. This is done by pushing a child pointer and then decrementing the stack top pointer by the corresponding entry of the reordered result mask from the bounding box intersection. For this purpose, this mask has to be ordered in the same way as the child pointers to push the correct children onto the stack. The decrement works because the result mask contains all ones in case of an intersection, which equals −1 as an integer, and all 0's else.
Surprisingly, an implementation using cascaded branches based on the ray direction signs and split axes is equally fast on an Intel Core 2 processor in the general case and even slightly faster when only primary rays are traced. This may be due to the sophisticated branch prediction of this particular processor. The implementation is also much simpler than the SIMD sorting. The first decision based on (axis0) chooses which two of the four children should be intersected first. In
As the bounding boxes are already intersected while processing the parent, a late early-out is performed: if a triangle intersection is found, pruning of bounding boxes which are farther away can only be done one step later, during processing of the next node. Additionally storing the distance of the bounding box intersections with the child pointer on the stack solves this. While on current Intel processors and the Cell processor the traversal is faster without this “optimization”, it may pay off for wider SIMD operations as announced for example for the Larrabee processor.
In addition, it should be noted that die described experiments report fewer bounding box intersections, as compared to sorting the bounding boxes by their actual intersection distances with the ray.
1.2.4 Triangle Intersection. SIMD Caching and Vertex-Index Data Structure
It is possible even to get away with much flatter hierarchies at the cost of leaves that contain more triangles. This approach further improves traversal speed and also enables the efficient use of streaming SIMD instructions to process multiple objects at once. In contrast with other approaches, the present technique uses single rays, and avoids performance losses caused by masking.
If memory were of no concern, the triangle data in the leaves could be precomputed and stored in an SIMD-friendly layout. Since most of the time this is not practical, the original triangle layout is left untouched. For high-performance ray tracing, 36 or 48 bytes per triangle arc used. The more compact vertex-index layout stores all vertices in an array and only three indices per triangle referencing these vertices. This is a widely used layout in 3D modeling applications. Usually this introduces performance penalties due to an indirection in memory access.
The described exemplary implementation supports the 36-bytes layout as well as the vertex-index form. Four primitives are efficiently intersected at once using a branch-free SIMD version of the test described in the art. For this test, the triangle data has to be collected and swizzled to a state-of-die-art SIMD layout. This already works surprisingly fast, but to maximize performance, a small direct-mapped cache is used for each rendering thread to store the precomputed layout. This caching mechanism also allows the use of vertex-index representation for the triangle data without significant performance loss, as shown in
The described BVH has been integrated into two different rendering systems. The first one contains highly optimized implementations of a BIH and a memory-bounded Ad-tree, and uses different unbiased rendering techniques. This allows for a direct comparison of rendering performance on the same hardware and using the same rendering algorithm. The second system is based on instant radiosity and is used for the entry point caching comparison in Section 1.4. All measurements were performed using a single thread on an Intel Core 2 CPU at 2.33 GHz. Note that all measurements were performed in a full rendering system where sampling, shading and texture look-up are a significant part of the rendering time and are not sped up by faster ray tracing.
Section 1.3.1 and 1.3.2 use the first rendering system to compare the QBVH to the other acceleration structures. This system only supports the 36-byte triangle layout. Two versions of the QBVH arc compared. The first one does not employ the SIMD triangle caching from Section 1.2.4 and is called ncQBVH. It uses leaves from 1 to 8 triangles. The second version uses a SIMD cache size of 128 entries with a leaf size of 16 triangles.
In Section 1.3.3 the second renderer is used to evaluate the speed impact of using vertex-index based triangle representation.
To estimate the performance in a usual rendering setup three scenes of different complexity were used; all parameters were left at their default settings. These scenes included (1) a conference room having IM triangles; (2) the Sponza atrium, an interior scene in a complete house having 900 K triangles; and (3) a power plant model having 12M triangles. The conference room and house interior were rendered with a bidirectional path tracer using 8 bidirectional samples per pixel. The power plant was rendered with a path tracer and 32 paths per pixel. These scenes were used to compare the presently described QBVH technique against BIH and a kd-tree.
It will be seen in table 110 that QBVH uses relatively little memory, while even outperforming the tree construction times of the BIH. It should also be noted that the ray tracing kernels were all included in the same rendering system for a precise comparison. This made some optimizations in the tree construction impossible, optimizations which would allow building the QBVH for the plant in around 14 seconds.
Memory consumption is an important part of any rendering system. All three acceleration structures allow a priori bounding of the memory used.
As shown in table 140, the kd-tree has serious problems with tight memory bounds (note that a build of the conference room with 5 MB was impossible to render in acceptable time) while the QBVH reacts especially robustly to limiting the memory.
The second renderer supports switching between the flat 36-byte triangle representation and a more memory-efficient index-based representation. The indexed representation is more time consuming for ray tracing because an additional indirection has to be performed prior to triangle intersection. This overhead is reduced when the leaf-caching-based QBVH implementation is used. The same scenes as in the previous sections were used for this comparison. Each rendering was performed at a resolution of 800×600 pixels with 16 passes.
Visibility rays (or shadow rays) are an essential part in many rendering algorithms with deterministic connections of points, e.g., in bidirectional path tracing or instant radiosity. They are merely used to determine the mutual visibility of two given points. Any intersection of an interval on a ray with an object is sufficient to determine occlusion. Therefore, three optimizations are: (1) quitting die traversal on the first intersection found; (2) omitting the sorting of the nodes pushed on the stack; and (3) not computing intersection distances, which can simplify object intersection routines. Another important general optimization is to start the traversal deeper in the tree instead of from the root node. If a suitable entry point is known, this can save major parts of the process of traversing down to the first leaf.
In contrast with an earlier approach that uses an entry point search for large bundles of rays in/kd-trees, the presently described approach uses a backtracking method that allows every node of die tree to be used as an entry point and will give correct results. For the backtracking, the parent is stored with each node. As the SIMD BVH Node still provides some room to store additional information, it is possible to keep the index of the parent node without additional memory requirements.
This method proved especially suitable for shadow rays. It is possible to take advantage of implicit coherence of shadow rays and start tracing at the last node where an intersection was found.
Scene 160 includes a plurality of point light sources, represented by stars 161. Rays 162 connect vertices of interaction along paths that connect light sources 161 and cameras 163. Some of these rays are obstructed by an occluding object 164, comprising a plurality of tessellated triangle primitives. Occlusions 165 occur at the intersections of rays 162 with a visible surface of object 164.
The entry point cache is able to quickly find occlusions, since the visibility rays to the same point light source (depicted with a star) exhibit some coherence. The big leaves of the QBVH make a hit even in the same leaf more likely. The performance gain is achieved in a way which is completely transparent to the underlying renderer; no additional complexity is introduced to existing systems (as would be the case for ray packets).
Consecutive visibility queries result in occlusion by different but spatially nearby triangles. This fact can be exploited by using the node of the last occlusion as the entry point for the next shadow ray. The tree is then searched for intersecting geometry using a backtracking algorithm: the regular traversal stack is initialized with the children of the entry point node and intersected the usual way. If no occlusion has been found so far, the entry point node is the root node, so there is no special code for this case. Next, if the stack is empty, all children of the parent of the entry point node are pushed to the stack, except the one that has just been processed. For the next iteration, the entry point node is set to its parent. The algorithm terminates when the parent of the root node is about to be processed. So the regular traversal is only extended by one variable and one additional loop. If a leaf node is found as an occluder, its parent node is cached for this point light source.
What remains is finding a suitable entry point for an occlusion query. The described algorithm above is correct for any entry point, but an acceleration can only be expected when the hit is close to a previous occlusion. The rendering system uses occlusion queries given by two points, where the first one is the path's hit point and the second one is the light source position. In our implementation we use a simple unbounded (i.e., hashed) voxel grid and the light position as hash. For each position the last found occlusion entry point is recorded. If no occlusion occurred, the root node is used. In the statistics, a hash table with 4096 entries was used, the scene and divided the scene into (10 cm)3 voxels (assuming the scenes arc modeled in the correct scale).
This optimization can be transparently incorporated into any existing rendering system which spawns shadow rays with two points to be checked for visibility.
All benchmarks were done using a single thread on a Core 2 processor. Extending this to a multi-threaded version is straightforward for the application of photorealistic rendering, where the fast tree construction times vanish compared to the time required for ray tracing. The resolution for the benchmarks are 800×600 pixels and for the point light based approach 16 rendering passes were used with an average of 22 point light sources per pass. Primary rays were created per scanline, additional speedup can be expected when using Hilbert curves. We compare the normal implementation of the QBVH (using only die standard shadow optimizations) with the one using the entry point caching. The statistics contain the total number of bounding box intersections performed for the final image. The speedup is of course larger in scenes with a larger amount of occlusion. This explains why the interior scene only shows a marginal speed up.
FIG. 17 is a table 170 of results. Table 170 sets forth a comparison of the number of box intersections and total time to image between the normal QBVH version (N#BBox, NTTI) and the entry point cache version (C#BBox, CTTI). The images at the beginning of this paper show the test scenes used. For the measurement they were rendered only at a resolution of 800×600 pixels with 16 passes and an average of 22 point light sources per pass. Conference 2 is the same conference scene but with the camera placed partly under the table.
The caching method could also be used for other acceleration structures. But compared to acceleration structures like the kd-tree, the BIH or binary BVHs which use many, very densely packed, small nodes, this method works especially well for the QBVH. The additional memory requirement of one more parent index per node would result in 50% more memory for standard 8 bytes W-tree nodes.
The approach can also be used for non-shadow rays. Then the procedure cannot benefit from the early-out of shadow rays, i.e., processing must always continue up to the root node. Still it can be beneficial, if the rays expose some kind of coherence, for example primary rays from the eye or coherent reflections. This allows the ray tracing core to transparently exploit implicit coherence by caching previous intersection entry points without changing the interface and without performance loss when incoherent rays are used.
Instructions arc applied efficiently for accelerating the tracing of single rays, while keeping the memory footprint of die techniques as low as possible. The described techniques arc relatively straightforward to use in a wide range of applications and still allows for taking advantage of modem computer architectures. We showed that the performance of our algorithm is better than current high performance single ray tracing algorithms and die memory requirements are reduced due to the flat hierarchies and caching we use.
Contrary to tracing ray packets to reduce memory bandwidth, higher arity trees achieve the reduction of memory bandwidth by just using less memory. This in turn increases cache coherence and thus effectively reduces die sum of latencies.
The approach may be generalized to higher arity. A multiple of 4 perfectly supports current processor's streaming SIMD extensions (AltiVec, SSE). In contrast to tracing ray packets, the implementation on novel architectures like the CELL and GPUs with CTM or CUDA is simplified; the 16-way SIMD path of Intel's Larrabee processor is an obvious candidate for our algorithm and the large node size suits modem cache architectures and memory layouts very well.
Experiments showed that forcing the same split plane axis for all three splits does not introduce severe performance penalties and the simplified sorting step in the traversal routine can even pay off for a SIMD width of four in some scenes. With the availability of wider SIMD units, this approach has to be further investigated.
Additionally an implementation of this acceleration structure as special purpose hardware (for example in an FPGA) looks very promising.
The tree construction could also be improved. While using the standard binary tree construction for building n-ary BVHs is a simple and practical approach, faster build times could be achieved if an equally good heuristic could be found for multiple split planes at once. The entry point cache could be extended by a better hashing mechanism to accelerate bidirectional light transport algorithms equally well as point light source based ones.
The use of axis-aligned bounding boxes is a basic technique to accelerate geometric algorithms as for example ray tracing. It is a known problem that efficiency suffers, if the axis-aligned bounding volume contains major parts of empty space, which, in the case of ray tracing, causes more ray-object-intersection tests than required. The impact of this problem can be reduced by subdividing triangles at the cost of a larger memory footprint. We present a subdivision algorithm that is designed to generate only very few additional triangle references. Compared to previous approaches the algorithm is numerically robust, and simpler to implement and use. For formerly problematic scenes a speedup of up to a factor of 10 could be achieved, while the number of triangle references increased only by 16%.
Improving the performance of ray tracing through the use of different acceleration structures has been investigated in detail. Among the most successful acceleration structures is the kd-tree. Recent research has demonstrated that bounding volume hierarchies (BVH) based on axis-aligned bounding volumes are competitive to or even outperform kd-trees. For both kinds of acceleration data structures fast traversal algorithms have been developed.
An advantage of a BVH is the small memory footprint compared to a standard kd-tree, because each object is only referenced once.
Even though a BVH can be as fast as a kd-tree, there are scenes where the resulting performance is far worse. This is a direct consequence of the principle that every object should only be referenced once: Bounding boxes that contain large amounts of empty space increase the number of ray object intersections.
This problem becomes especially apparent for axis-aligned boxes enclosing non-axis-aligned geometry as it results from, e.g., rotation: A triangle with a normal along one of the canonical axes has a zero volume axis-aligned bounding box, while any other orientation increases the volume and causes the triangle to be tested against more rays although the probability of hitting the triangle remains the same.
In the context of ray tracing with bounding volume hierarchies an advanced solution to the above problem has been investigated and was called early split clipping. That approach provided a triangle splitting method based on the surface area of the triangle bounding volume and used an axis-aligned plane to split a triangle into three triangles, resulting from one triangle and one quadrangle. The approach of early split clipping reduces empty space contained in bounding volumes, which in addition reduces overlap and thus improves overall performance.
However, considering surface area also causes triangles to be split that are already tightly packed in a bounding volume (e.g., larger triangles with normals parallel to the canonical axes). In addition the splitting threshold is based on user experimentation per scene and triangles are split even when no speedup can be achieved.
While one might argue that the same benefits can be obtained using a kd-tree, especially when bounding the memory of the kd-tree construction, both approaches have to clip triangles against planes, which is a numerically tricky and costly operation.
The following description addresses some of these disadvantages by introducing a numerically robust triangle subdivision (i.e., in contrast to splitting) technique that only subdivides triangles where required, thus retaining the biggest advantage of bounding volume hierarchies, the small memory footprint. This heuristic is based on the observation that not all large triangles affect the performance of a SAH-based BVH significantly but only the one that cannot fit tightly into a bounding box. In addition, there is described a technique for automatically choosing the level of subdivision. This is especially important when animations are rendered and the scene configuration changes over time.
2.2 Subdivision Technique
In order to improve the performance of bounding volume hierarchies, die idea of subdividing geometry is followed, and there is described an economical edge volume technique that only moderately increases the memory footprint.
This new technique (see Section 2.2.1) measures the tightness of the bounding box of each triangle edge and subdivides the triangle until a certain threshold εv (sec Section 2.2,2) is met.
For each edge of a triangle, a subdivision technique determines its axis-aligned bounding box. The volume of the largest of the three boxes is compared to a volume threshold εv. If the volume is larger than die threshold the triangle is subdivided in the middle of this edge, which is easily implemented in a numerically robust manner. The procedure is repeated for the two new triangles until it terminates.
For the purpose of the present description, it is assumed that the threshold has been exceeded with respect to edge 18 c. In
The heuristic guarantees that without any knowledge of topology, identical operations will be performed on shared edges. Consequently the resulting bounding boxes fit without gaps, which overcomes precision issues of clipping and watertight meshes (i.e., tessellation) will remain watertight after subdivision. This is true for any symmetric subdivision of edges. Note that using a heuristic not based on edges, like e.g., bounding box surface area, cannot guarantee watertight subdivision. Cracks can occur, because shared edges arc not necessarily subdivided in an identical way. In addition, a surface area criterion would divide large triangles regardless of the tightness of the bounding box, which is not memory efficient. In fact the edge volume heuristic is economical as it only subdivides triangles with very inefficient bounding boxes.
is determined as a fraction of the volume V of the scene bounding box and thus controls the number of triangles generated by subdivision.
Over a broad range of scenes it turned out that choosing the threshold parameter t=14 as a default value yields good results with respect to increased triangle references and performance. With this threshold value many scenes that already exhibit high ray tracing performance are not subdivided at all or the increase of triangle references is less than 1%. Thus it is safe to rely on a fixed parameter t. But as with any heuristic, specially constructed scenes may break the assumption of course (for example a single thin diagonal triangle). For this kind of scenes the user may have to choose the parameter t by hand.
In Section 2.3 the impact of varying t is quantified for different bounding volume hierarchy unfriendly scenes.
This simple threshold selection is of course not limited to the edge volume heuristic but can be used (with a different scale) for example for the early split clipping approach.
The procedure can be applied either as a pre-process before ray tracing or for on-demand subdivision at the beginning of the tree construction. The first variant is especially useful as it can be used to upgrade any existing ray tracing module without modifying the internals. The second variant is transparent for the user and just produces a different tree during construction.
For each triangle the algorithm performs the recursive subdivision procedure. As the bounding volume hierarchy construction only uses the bounding boxes during construction, it is memory-efficient to output the bounding boxes with the original triangle reference instead and in place of the subdivided triangles. Usually a BVH contains more than one triangle per leaf. An additional optimization during tree construction is to remove references to the same triangle in each leaf. In our experiments this resulted in a speedup of about 10%.
The scan over the triangles is so efficient, that it even pays off, to have a pass that only counts die number of generated triangles, to allocate memory accordingly, and to scan the data again to generate the bounding boxes.
The remaining problematic cases are overlapping bounding boxes that cannot be separated. This problem is ameliorated by the fact that efficient bounding volume hierarchies usually reference more than one triangle per leaf thus grouping some of the overlapping geometry in one box, which reduces the overall overlap.
A related problem is now addressed. The idea of ray tracing geometry animated by rigid body transformations is to compute an acceleration data structure for the rigid components in advance, to apply the rigid body transformations, and then to combine the resulting transformed objects in a bounding volume hierarchy.
As most of the hierarchies are cached, building the top-level hierarchy is reasonably inexpensive. However, this approach fails when large parts of the geometry overlap, because all overlapping parts have to be checked, which results in a notable slowdown. This happens, for example, for rotating tires on cars, or the joints of a door, where a convex part of geometry is enclosed by a non-convex one.
In accordance with the present invention, one solution is as follows. Instead of caching the hierarchies for the rigid components, the hierarchies are cached for small parts of the components. Building the top-level bounding volume hierarchy is then slower, however, this is amortized, because the overlap is dramatically reduced resulting in a higher performance of the hierarchy.
The subdivision heuristic was applied to a set of diverse scenes in order to verify its versatility. The benchmarks were performed using an implementation of the QBVH using single thread primary rays on a Intel Core2 Duo 2.4 GHz processor.
First, four static scenes were considered:
A higher threshold parameter t improves performance, but also increases the memory footprint. Both numbers are related in
A clearly consistent improvement over the test scenes can be observed and it is especially interesting that major performance improvements are obtained at already a moderate increase of the number of triangles.
The second test consists of rotating the well known Sponza atrium scene to illustrate the adaptivity of the edge volume heuristic. First, the scene is first rotated by 90°, 20°, and 30°around the x-axis, y-axis, and z-axis in 32 steps. Second, the scene is rotated another 32 steps to its final position 31 180°, 0°, and 90° where all large triangles arc again axis-aligned.
Again the heuristic proves to be reliable: In simple cases, no triangles are added. When bounding boxes become inefficient a moderate increase in the number of triangle references avoids the dramatic performance drop.
Subdividing an edge in the middle results in two new bounding boxes that each have one-eighth of the original volume, because the split edges remain diagonals of their bounding boxes. Since the described tree construction technique is based on the SAH, it is interesting to look at the reduction of the triangle's bounding box surface area upon subdivision.
Section 2 introduces an economical heuristic to subdivide triangles such that the amount of empty space in bounding boxes is efficiently reduced. The technique is numerically robust, and can be used as a topology unaware preprocess to any renderer. Significant performance improvements already result from very moderate additional memory requirements.
While die technique has applications in collision detection and occlusion culling, too, there are two more points of future interest: There are situations, where a global volume threshold may be not sufficient and a local threshold may perform better. Furthermore, it would be desirable to find criteria to identify situations where neither the presently described heuristic nor the surface area heuristic can reduce overlap.
There is now provided a description of a digital processing environment in which aspects of the invention can be implemented. There is further provided a description of methods, structures, and systems in accordance with ray tracing techniques, in particular with respect to the efficient construction of acceleration data structures useful for fast ray tracing.
The following is a discussion, to be read in connection with FIGS. 26 and 27A-27B, of typical, relatively conventional digital processing structures and environments in which the above-described invention may be implemented and practiced.
It will be understood by those skilled in the art that the present invention, as described above, provides methods, systems, devices and computer program products that enable the creation of the appearance of rounded corners and edges and other activities in computer graphics systems, whose output is typically a human-perceptible (or digitally stored and/or transmitted) image or series of images that can comprise, for example, an animated motion picture, computer aided design representation, or other typical computer graphics output. The present invention can thus be implemented as part of the computer software or computer hardware of a computer that forms part of a computer graphics system, along with a display, user interface elements such as a keyboard, tablet and/or mouse, memory, storage, and other conventional computer graphics system components. While conventional components of such kind are well known to those skilled in the art, and thus need not be described in great detail herein, the following overview indicates how the present invention can be implemented in conjunction with such components in a computer graphics system.
More particularly, those skilled in the art will understand that the present invention can be utilized in die generation and synthesis of images, such as for display in a motion picture or other dynamic display. The techniques described herein can be practiced as part of a computer graphics system, in which a pixel value is generated for pixels in an image. The pixel value is representative of a point in a scene as recorded on an image plane of a simulated camera. The underlying computer graphics system can be configured to generate the pixel value for an image using a selected methodology, such as that of the present invention.
The previous detailed description illustrates examples of methods, structures, systems, and computer software products in accordance with these techniques. It will be understood by those skilled in the art that the described methods and systems can be implemented in software, hardware, or a combination of software and hardware, using conventional computer apparatus such as a personal computer (PC) or equivalent device operating in accordance with (or emulating) a conventional operating system such as Microsoft Windows, Linux, or Unix, either in a standalone configuration or across a network. The various processing aspects and means described herein may therefore be implemented in the software and/or hardware elements of a properly configured digital processing device or network of devices. Processing may be performed sequentially or in parallel, and may be implemented using special purpose or re-configurable hardware.
As an example,
The terms “memory”, “storage” and “disk storage devices” can encompass any computer readable medium, such as a computer hard disk, computer floppy disk, computer-readable flash drive, computer-readable RAM or ROM element or any other known means of encoding digital information. The term “applications programs”, “applications”, “programs”, “computer program product” or “computer software product” can encompass any computer program product consisting of computer-readable programs instructions encoded and/or stored on a computer readable medium, whether that medium is fixed or removable, permanent or erasable, or otherwise. As noted, for example, in block 322 of the schematic block diagram of
Although the computer system 300 is shown as comprising particular components, such as the keyboard 302 a and mouse 302 b for receiving input information from an operator, and a video display device 303 for displaying output information to the operator, it will be appreciated that the computer system 300 may include a variety of components in addition to or instead of those specifically set forth herein.
In addition, the processor module 301 can include one or more network ports, generally identified by reference numeral 305, which are connected to communication links which connect the computer system 300 in a computer network. The network ports enable the computer system 300 to transmit information to, and receive information from, other computer systems and other devices in the network In atypical network organized according to, for example, the client-server paradigm, certain computer systems in die network are designated as servers, which store data and programs (generally, “information”) for processing by die other, client computer systems, thereby to enable the client computer systems to conveniently share the information. A client computer system which needs access to information maintained by a particular server will enable the server to download the information to it over the network. After processing the data, the client computer system may also return the processed data to the server for storage. In addition to computer systems (including the above-described servers and clients), a network may also include, for example, printers and facsimile devices, digital audio or video storage and distribution devices, and the like, which may be shared among the various computer systems connected in the network. The communication links interconnecting die computer systems in the network may, as is conventional, comprise any convenient information-carrying medium, including wires, optical fibers or other media for carrying signals among the computer systems. Computer systems transfer information over the network by means of messages transferred over the communication links, with each message including information and an identifier identifying the device to receive the message.
In addition to the computer system 300 shown in the drawings, methods, devices or software products in accordance with the present invention can operate on any of a wide range of conventional computing devices and systems, such as those depicted by way of example in
In line with conventional computer software and hardware practice, a software application configured in accordance with the invention can operate within, e.g., a PC 302 like that shown in
Those skilled in the art will understand that the method aspects of the invention described herein can be executed in hardware elements, such as a Field-Programmable Gate Array (FPGA) or an Application-Specific Integrated Circuit (ASIC) constructed specifically to carry out the processes described herein, using ASIC construction techniques known to ASIC manufacturers. Various forms of ASICs are available from many manufacturers, although currently available ASICs do not provide the functions described in this patent application. Such manufacturers include Intel Corporation and NVIDIA Corporation, both of Santa Clara, Calif. The actual semiconductor elements of a conventional ASIC or equivalent integrated circuit are not part of the present invention, and will not be discussed in detail herein.
Those skilled in the art will also understand that ASICs or other conventional integrated circuit or semiconductor elements can be implemented in such a manner, using the teachings of the present invention as described in greater detail herein, to carry out the methods of the present invention, as discussed herein.
Those skilled in the art will also understand that method aspects of the present invention can be carried out within commercially available digital processing systems, such as workstations and personal computer's (PCs), operating under the collective command of the workstation or PC's operating system and a computer program product configured in accordance with the present invention. The term “computer program product” can encompass any set of computer-readable programs instructions encoded on a computer readable medium. A computer readable medium can encompass any form of computer readable element, including, but not limited to, a computer hard disk, computer floppy disk, computer-readable flash drive, computer-readable RAM or ROM element, or any other known means of encoding, storing or providing digital information, whether local to or remote from the workstation, PC or other digital processing device or system. Various forms of computer readable elements and media arc well known in the computing arts, and their selection is left to the implemented In each case, the invention is operable to enable a computer system to calculate a pixel value, and the pixel value can be used by hardware elements in the computer system, which can be conventional elements such as graphics cards or display controllers, to generate a display-controlling electronic output. Conventional graphics cards and display controllers are well known in the computing arts are not necessarily part of the present invention, and their selection can be left to the implemented
The use of bounding volume hierarchies as an acceleration structure is advantageous for a number of reasons. The memory requirements for bounding volume hierarchies can be linearly bounded in die number of objects to be ray traced. Also, as described below, bounding volume hierarchies can be constructed much more efficiently than 3D-trees, which makes them very suitable for an amortized analysis, as required for fully animated scenes.
The following discussion describes in greater detail certain issues in ray tracing technology, and particular aspects of the invention that address those issues.
However, due to floating point arithmetic computations on computers, it is sometimes possible for the calculated ray/surface intersection point 512 to be different from the actual intersection point 510. Further, as illustrated in
One known solution to the self-intersection problem is to start each ray 508 at a safe distance from the surface 502. This safe distance is typically expressed as a global floating point ε. However, the determination of die global floating point ε depends heavily on the scene, and the
particular location within the scene itself, for which an image is being synthesized.
An aspect of the invention provides a more precise alternative. After arriving at a calculated ray/surface intersection point 512, the calculated point 512 and the direction of the ray 508 are then used to re-compute an intersection point that is closer to the actual intersection point 510. This re-computation of the intersection point is incorporated into the ray tracing technique as an iteration that increases precision. If the iteratively computed intersection point turns out to be on the “wrong” side of die surface 502, it is moved to the “correct” side of the surface 502. The iteratively computed intersection point can be moved along the surface normal, or along the axis determined by the longest component of the normal. Instead of using a global floating point ε, the point is moved by an integer ε to the last bits of the floating point mantissas.
The described procedure avoids computations in double precision and has the advantage that it implicitly adapts to the scale of the floating point number, which is determined by its exponent. Thus, in this implementation, all secondary rays directly start from these modified points making an ε-offset unnecessary. During intersection computation, it can therefore be assumed that the ray interval of validity to begin at 0 rather than some offset (excluding 0 from the interval, as explained hereinbelow).
Modifying the integer representation of the mantissa also avoids numerical problems when intersecting a triangle and a plane in order to decide which points arc on what side.
Exploiting the convex hull property of convex combinations, intersections of rays and freeform surfaces can be found by refining an axis-aligned bounding box, which contains the point of intersection nearest to the ray origin. This refinement can be continued until the resolution of floating point numbers is reached, i.e., until the bounding box coordinates differ only in one unit of resolution from the floating point representation. The self-intersection problem then is avoided by selecting the bounding box corner that is closest to the surface normal in the center of the bounding box. This corner point then is used to start the secondary ray. This “ray object intersection test” is very efficient and benefits from the avoidance of the self-intersection problem.
After constructing the acceleration data structure, the triangles arc transformed in-place. The new representation encodes degenerate triangles so that the intersection test can handle them without extra effort. It of course is also possible to just prevent degenerate triangles to enter the graphics pipeline.
The test first determines the intersection of the ray and die plane of die triangle and then excludes intersections outside the valid interval [0, result.tfar] on the ray. This is achieved by only one integer test. Note that the +0 is excluded from the valid interval. This is important if denormalized floating point numbers are not supported. If this first determination is successful, die test proceeds by computing the Bars centric coordinates of the intersection. Note diat again only an integer test, i.e., more specifically only testing two bits, is required to perform the complete inclusion test. Thus the number of branches is minimal. In order to enable this efficient test, the edges and the normal of the triangle are scaled appropriately in the transformation step.
The precision of the test is sufficient to avoid wrong or missed ray intersections. However, during traversal situations may occur in which it is appropriate to extend the triangles for a robust intersection test. This can be done before transforming the triangles. Since the triangles arc projected along the axis identified by the longest component of their normal, this projection case has to be stored. This is achieved by counters in the leaf nodes of the acceleration data structure: The triangle references arc sorted by the projection case and a leaf contains a byte for the number of triangles in each class.
A further aspect of the present invention provides an improved approach for constructing acceleration data structures for ray tracing. Compared with prior software implementations that follow a number of different optimizations, the approach described herein yields significantly flatter trees with superior ray tracing performance.
Candidates for splitting planes are given by the coordinates of the triangle vertices inside the axis-aligned bounding box to be partitioned. Note that this includes vertices that actually lie outside the bounding box, but have at least one coordinate that lies in one of the three intervals defined by the bounding box. Out of these candidates, there is selected the plane closest to middle of the longest side of the current axis-aligned bounding box. A further optimization selects only coordinates of triangles whose longest component of the surface normal matches the normal of the potential splitting plane. This procedure yields much flatter trees, since placing splitting planes through the triangle vertices implicitly reduces the number of triangles split by splitting planes. In addition, the surface is approximated tightly and empty space is maximized. If the number of triangles is higher than a specified threshold and there arc no more candidates for splitting planes, the box is split in the middle along its longest side. This avoids inefficiencies of other approaches, including the use, for example, of long diagonal objects.
The recursive procedure of deciding which triangles belong to the left and right child of a node in the hierarchy has typically required extensive bookkeeping and memory allocation. There is a much simpler approach that only fails in exceptional cases. Only two arrays of references to the objects to be ray traced arc allocated. The first array is initialized with the object references. During recursive space partition, a stack of the elements on the left is grown from the beginning of the array, while the elements, which are classified right, are kept on a stack growing from the end of the array towards the middle. In order to be able to quickly restore the elements that arc intersecting a split plane, i.e., arc both left and right, the second array keeps a stack of them. Thus backtracking is efficient and simple.
Instead of pruning branches of the tree by using the surface area heuristic, tree depth is pruned by approximately left-balancing the binary space partition starting from a fixed depth. As observed by exhaustive experimentation, a global fixed depth parameter can be specified across a vast variety of scenes. This can be understood by observing that after a certain amount of binary space partitions usually there remain connected components that are relatively flat in space.
Using bounding volume hierarchies, each object to be ray traced is referenced exactly once. As a consequence, and in contrast with 3D-trees, no mailbox mechanisms are required to prevent the multiple intersection of an object with a ray during the traversal of the hierarchy. This is a significant advantage from the viewpoint of system performance and makes implementations on a shared memory system much simpler. A second important consequence is that there cannot be more inner nodes in the tree of a bounding volume hierarchy than the total number of objects to be ray-traced. Thus the memory footprint of die acceleration data structure can be linearly bounded in the number of objects before construction. Such an a priori bound is not available for the construction of a 3D-tree, where the memory complexity is expected to increase quadratically . with the number of objects to be ray-traced.
Thus, there is now described a new concept of bounding volume hierarchies that are significantly faster than current 3D-tree ray tracing techniques, and in which the memory requirements grow linearly, rather than expected quadratically, with the number of objects to be ray-traced. The core concept that allows bounding volume hierarchies to outperform 3D-trees is to focus on how space can be partitioned, rather than focusing on the bounding volumes themselves.
In a 3D-tree, a bounding box is partitioned by a single plane. According to the present aspect of the invention, two parallel planes arc used to define two axis-aligned bounding boxes.
Instead of one split parameter, used in earlier implementations, two split parameters are stored within a node. Since the number of nodes is linearly bounded by the number of objects to be ray traced, an array of all nodes can be allocated once. Thus, the costly memory management of 3D-trees during construction becomes unnecessary.
The construction technique is much simpler than the analog for 3D-tree construction and is easily implemented in a recursive way, or by using an iterative version and a stack. Given a list of objects and an axis-aligned bounding box, the L- and R-planes are determined, and the set of objects is determined accordingly. The left and right objects are then processed recursively until some termination criterion is met. Since the number of inner nodes is bounded, it is safe to rely on termination when there is only one object left.
It should be noted that the partition only relies on sorting objects along planes that are perpendicular to the x-, y-, and z-axes, which is very efficient and numerically absolutely stable. In contrast with 3D-trees, no exact intersections of objects with splitting planes need to be computed, which is more costly and hard to achieve in a numerically robust way. Numerical problems of 3D-trees, such as missed triangles at vertices and along edges, can be avoided by extending the triangles before the construction of the bounding volume hierarchy. Also, in a 3D-tree, overlapping objects have to be sorted both into the left and right axis-aligned bounding boxes, thereby causing an expected quadratic growth of the tree.
Various techniques may be used to determine die L- and R-planes, and thus the actual tree layout. Returning to
In the case of the 3D-tree, the spatial subdivision is continued so as to cut off the empty portions of the space around the object. In the case of the described bounding volume hierarchy, partitioning such objects into smaller ones results in a similar behavior. In order to maintain the predictability of the memory requirements, a maximum bounding box size is defined. All objects with an extent that exceeds the maximum bounding box size arc split into smaller portions to meet the requirement. The maximum allowed size can be found by scanning the data set for the minimal extent among all objects.
The data structure described herein allows the transfer of the principles of fast 3D-tree traversal to bounding volume hierarchies. The cases of traversal are similar: (1) only the left child; (2) only the right child; (3) the left child and then the right child; (4) the right child and then the left child: or (5) die ray is between split planes (i.e., empty space). Since one node in the described technique is split by two parallel planes, the order of how to traverse the boxes is determined by the ray direction.
Previous bounding volume hierarchy techniques could not efficiently determine the order of how to traverse the child nodes or required additional effort, such as updating a heap data structure. In addition a whole bounding volume had to be loaded and tested against the ray, while the present approach only requires the two plane distances. Checking the ray against the two planes in software seems to be more expensive, however. The traversal is the bottle neck in 3D-trees, and doing some more computation here better hides the latencies of memory access. In addition, the bounding volume hierarchy trees tend to be much smaller than corresponding 3D-trees of same performance.
Although there is herein described a new bounding volume hierarchy, there is a strong link to traversing 3D-trees: Setting L=R, the classical binary space partition is obtained, and the traversal algorithm collapses to die traversal algorithm for 3D-trees.
The described bounding volume hierarchy also can be applied to efficiently find ray freeform surface intersections by subdividing die freeform surface. Doing so allows the intersection of a freeform surface with a convex hull property and a subdivision algorithm efficiently to be computed up to floating point precision, depending on the actual floating point arithmetic. A subdivision step is performed, for example, for polynomial surfaces, rational surfaces, and approximating subdivision surfaces. For each axis in space the possibly overlapping bounding boxes are determined as discussed above. In case of a binary subdivision, die intersection of the L-boxes and the intersection of the R-boxes for new bounding boxes of the new meshes. Now the above-described traversal can be efficiently performed, since the spatial order of the boxes is known. Instead of pre-computing the hierarchy of bounding volumes, it can be computed on the fly. This procedure is efficient for freeform surfaces and allows one to save the memory for the acceleration data structure, which is replaced by a small stack of the bounding volumes that have to be traversed by backtracking. The subdivision is continued until the ray surface intersection lies in a bounding volume that collapsed to a point in floating point precision or an interval of a small size.
Using regular grids as an acceleration data structure in ray tracing is simple, but efficiency suffers from a lack of spatial adaptivity and the subsequent traversal of many empty grid cells. Hierarchical regular grids can improve on the situation, but still arc inferior as compared to bounding volume hierarchies and 3D-trees. However, regular grids can be used to improve on the construction speed of acceleration data structures. The technique for constructing the acceleration data structures arc similar to quick sorting and are expected to run in O(n log n). An improvement can be obtained by applying bucket sorting, which runs in linear time. Therefore the axis-aligned bounding box of the objects is partitioned into nx×ny×nz axis-aligned boxes. Each object then is sorted into exactly one of these boxes by one selected point, e.g., the center of gravity or the first vertex of each triangle could be used. Then the actual axis-aligned bounding box of the objects in each grid cell is determined. These axis-aligned bounding boxes are used instead of the objects they contain as long as the box does not intersect one of the division planes. In that case die box is unpacked and instead the objects in the box will be used directly. This procedure saves a lot of comparisons and memory accesses, noticeably improves the constant of die order of die construction techniques, and also can be applied recursively. The above technique is especially appealing to hardware implementations, since it can be realized by processing a stream of Objects.
The acceleration data structures can be built on demand, i.e., at the time when a ray is traversing a specific axis-aligned bounding box with its objects. Then on the one hand the acceleration data structure never becomes refined in regions of space, which are invisible to the rays, and caches are not polluted by data that is never touched. On the other hand after refinement the objects possibly intersected by a ray arc already in the caches.
From die above discussion, it will be seen that the present invention addresses long known issues in ray tracing and provides techniques for ray tracing having improved precision, overall speed and memory footprint of the acceleration data structures. The improvements in numerical precision transfer to other number systems as well as, for example, to the logarithmic number system used in die hardware of the ART ray tracing chips. It is noted that the specific implementation of the IEEE floating point standard on a processor or a dedicated hardware can severely influence performance. For example, on a Pentium 4 chip denormalized numbers can degrade performance by a factor of 100 and more. As discussed above, an implementation of the invention avoids these exceptions. The view of bounding volume hierarchies described herein makes diem suited for realtime ray tracing. In an amortized analysis, the described techniques outperform the previous state of the art, thus allowing more precise techniques to be used, for example, for computing motion blur in fully animated scene, as in a production setting or the like. It will be apparent from the above discussion that the described bounding volume hierarchies have significant advantages when compared with 3D-trees and other techniques, particularly in hardware implementations and for huge scenes. In an amortized analysis, the described bounding volume hierarchies outperform current 3D-trees by at least a factor of two. In addition, the memory footprint can be determined beforehand and is linear in the number of objects.
Module 1001: Module to subdivide (e.g., tessellate) geometry or bounding boxes in a numerically robust way.
Module 1002: Module to build “classic” acceleration data structure for ray tracing from previous module 1001.
Module 1003: Module to optionally/potentially use precompiled parts of a hierarchy to speed up the process for animated geometry.
Module 1004: Module to increase arity of data structure by merging subsequent levels of the hierarchy.
Module 1005: Module to traverse nodes using SIMD instructions for either rays or packets of rays.
Box 1101: Subdivide (e.g., tessellate) geometry or bounding boxes in a numerically robust way.
Box 1102: Build “classic” acceleration data structure for ray tracing from previous box 1101.
Box 1103: Optionally/potentially use precomputed parts of a hierarchy to speed up the process for animated geometry.
Box 1104: Increase arity of data structure by merging subsequent levels of the hierarchy.
Box 1105: Traverse nodes using SIMD instructions for cither rays or packets of rays.
It should be noted that
While the foregoing description includes details which will enable those skilled in the art to practice the invention, it should be recognized that the description is illustrative in nature and that many modifications and variations thereof will be apparent to those skilled in the art having the benefit of these teachings. It is accordingly intended that the invention herein be defined solely by the claims appended hereto and that the claims be interpreted as broadly as permitted by the prior art.