This relates generally to rendering primitives during graphics processing.
An image to be processed may be analyzed in terms of primitives, such as triangles or polygons, which collectively represent the overall graphics image. In many cases, the triangles or polygons are analyzed during rasterization.
Commonly graphics primitives are searched. One common task in graphics processing is to determine which polygons or triangles are located in a given tile or frustrum. This may involve a geometrical proximity search among suitable primitives. Another example of the need for searching primitives is in ray tracing. There a closest polygon that is intersected by a ray or group of rays is identified through a search algorithm.
Rendering algorithms use acceleration structures to reduce the complexity of solving search problems. These acceleration structures may also be known as spatial or geometrical indices. Typically, they involve a hierarchical tree-like data structure storing primitives at terminal nodes. Examples of such hierarchical acceleration structures include the k dimensional tree or kd-tree, bounding volume hierarchy (BVH), bounding interval hierarchy (BIH), or binary space partition (BSP).
In accordance with one embodiment, a k dimensional tree acceleration structure, or k-d tree, may be utilized. However, any other hierarchical acceleration structure may be used as well.
In k-d trees, a 3D space is divided into two non-overlapping regions according to a cost function. After a first split, each resulting region is then divided into two regions in a second split, forming two internal nodes of the k-d tree, and each of resulting four regions is then divided into two regions in a third split, forming more nodes of the k-d tree. The process continues recursively until an application specific termination criteria is met. A node that is not split anymore is called a leaf node. A leaf node stores the primitives intersecting its region. In some embodiments, a leaf stores references to primitives rather than primitives themselves. The primitive references in a leaf node are stored in a form of an array of primitive indices.
Tree based data structures have large numbers of internal nodes and references to other nodes. As a result, their memory footprint may be large and unpredictable. The computational cost of constructing such tree based data structure is high. To achieve the performance necessary for interactive graphics applications, one needs to use high speed parallel computing to create tree based structures. A compact memory layout may be achieved, in some embodiments, which reduces the amount of memory consumed. A compact representation advantageously does not slow down the traversal steps wherein the various primitives are traversed during a search operation. In addition, an acceleration structure may be stored on a disk and loaded into different address spaces. An acceleration structure may be transferred to another computing device having different address space. The representation of the acceleration structure and its data format advantageously supports the structure creation by multiple parallel threads thus enabling usage of high speed parallel computing.
In some embodiments, an acceleration structure for a model containing a large number of primitives extends into 64 bit address space of graphics processing architectures. Generally 64-bit address space requires 64-bit size references, but some embodiments may use offsets instead of pointers to reference child nodes. In that case the majority of offsets, even in large acceleration structures extending into 64-bit address space, may be encoded by 32 bits, and only a small fraction of offsets may need full 64-bit encoding. An acceleration structure may encode a special type of node that needs 64-bit offsets, the nodes of such special type are called further 64-bit extensions. Due to using 32-bit offsets by default and encoding 64-bit offsets as a special extension, an acceleration structure for a small model fitting into 32 bit address space, advantageously, has the same binary representation on 64 bit computer architectures, thus enabling the 32-bit structures to be used unchanged on 64-bit computers.
Referring to
Referring to
Each node and the leaf indices array may be aligned by at least a four byte boundary in one embodiment. As a result, the offset between any two nodes may have at least two least significant bits equal to zero. Those two bits (group of bits 30,
Referring to
Initially, a node is accessed, as indicated in block 10. Then, in diamond 12, a check determines whether the node is internal. If so, the internal node is processed, as indicated in block 14.
If the node is not internal, then it is either a leaf node or a 64 bit extension. A 64 bit extension is a special type of node that needs a 64 bit offset to reference one of its children or both children. Of course, the present invention may be applied to extensions of any size. It is processed as a leaf, as indicated in block 16, in any case. Since a traversal algorithm visits internal nodes more frequently than leaf nodes, processing extensions in leaves rather than in internal nodes substantially reduces the number of operations that check for an extension. A check at diamond 18 determines whether the node has a 64 bit extension. If not, conventional leaf processing may be implemented. If so, a 64 bit extension is processed, as indicated in block 20, and then the flow can continue as either a leaf processing operation at block 16 or an internal node processing at block 14.
During each traversal of the flow shown in
To handle an unpredictability of resulting tree size, a construction algorithm may allocate memory by continuous regions. As shown in
The large connected regions (regions k, k+1, and j) of the constructed tree are located in each region, as indicated in
The number of links between these sub-trees may be relatively small, in one embodiment, less than one percent of the total number of links. Thus, the number of nodes pointing to children located in another memory region is small.
As an example, a typical memory region size is less than four gigabytes. So when the tree is partitioned into sub-trees, and each sub-tree is located in a continuous region, the nodes can use 32 bit offsets to reference child nodes within the same region (e.g. region k and/or k+1). The 64 bit offsets are only used, in one embodiment, for nodes that have children located in another memory region (e.g. children in region k when parent is in region j). Since the number of such nodes is small, they may be encoded as extensions of 32 bit nodes.
As a result, the tree may be stored as a 32 bit tree with a small fraction of nodes being extended with 64 bit offsets. If a node has a 64 bit offset, an indicator is stored in axis 30 together with the node data.
To avoid testing that 64 bit extension indicator at each traversal step, the extended nodes are stored with zero in the axis 30 in
The traversal algorithm in
A second four byte word of a true leaf node stores a number of primitives at that leaf, so the value may be greater than or equal to zero. Negative values in the primitive counter indicate that the leaf is special and it is a 64 bit extended node.
In one embodiment, the tree is constructed in a top down manner from parent nodes to child nodes. When the tree is constructed in multiple threads, each thread builds a sub-tree. Thus, different threads may create a parent node and child nodes. So when a parent node is created, the offset to the child node may be unknown. That fact may prevent allocating 64 bit offset data next to a node.
The 64 bit extended node data may be stored in a special table, for example, in an ext field 64, as shown in
Referring to
In
Each construction thread in a multiple thread environment may create its own 64 bit node table 48, 52 or 54, as examples. So, in some embodiments, there is no contention between threads for updating tables. If the table becomes full, the corresponding thread just increases its size by reallocation and data copy. Since the table can be small, it does not affect construction performance.
Storage or transmission of a tree located in multiple memory regions may involve a compaction and reallocation of cross-region offsets in one embodiment. Since 64 bit node tables may store information on the dependent nodes and these dependent nodes are exactly nodes with cross-region references, the compaction operation may just involve a table scan and update of nodes present in the table, rather than a scan and update of all the tree nodes.
Thus, in some embodiments, only two bits are used to encode both the leaf and the internal node indicator and split plane orientation. Two least significant bits may be used for the leaf/node indicator, allowing support of negative offsets, which is helpful with implementing multi-threaded construction. A single instruction leaf/node test is possible due to special encoding of the information in those two least significant bits, in some embodiments. In some embodiments, memory may be allocated for tree nodes for multiple regions, rather than from a single continuous array. Thus, in some embodiments, 64 bit offsets are only used when needed and all other offsets are stored in 32 bit format. Special tables are used to store the nodes with 64 bit offsets. Finally, the 64 bit node may be treated as a special type of leaf.
A computer system 130, shown in
In the case of a software implementation, the pertinent code may be stored in any suitable semiconductor, magnetic, or optical memory, including the main memory 132. Thus, in one embodiment, the code 139 may be stored in a machine readable medium, such as the main memory 132, for execution by a processor, such as the processor 100 or graphics processor 112.
In a software embodiment, the sequences shown in
The graphics processing techniques described herein may be implemented in various hardware architectures. For example, graphics functionality may be integrated within a chipset. Alternatively, a discrete graphics processor may be used. As still another embodiment, the graphics functions may be implemented by a general purpose processor, including a multicore processor.
References throughout this specification to “one embodiment” or “an embodiment” mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one implementation encompassed within the present invention. Thus, appearances of the phrase “one embodiment” or “in an embodiment” are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be instituted in other suitable forms other than the particular embodiment illustrated and all such forms may be encompassed within the claims of the present application.
While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/RU2009/000594 | 10/30/2009 | WO | 00 | 7/17/2012 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2011/053181 | 5/5/2011 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
6349380 | Shahidzadeh | Feb 2002 | B1 |
6499095 | Sexton | Dec 2002 | B1 |
6560694 | McGrath | May 2003 | B1 |
6687806 | McGrath | Feb 2004 | B1 |
6725366 | Swanberg | Apr 2004 | B1 |
7209587 | Hsu | Apr 2007 | B1 |
7231507 | Seal | Jun 2007 | B2 |
8400447 | Carr | Mar 2013 | B1 |
20030196077 | Henry | Oct 2003 | A1 |
20080192050 | Schardt | Aug 2008 | A1 |
20080244210 | Vingralek | Oct 2008 | A1 |
20090157997 | Leonenko | Jun 2009 | A1 |
20090167763 | Waechter | Jul 2009 | A1 |
20100060634 | Wald | Mar 2010 | A1 |
20100228781 | Fowler | Sep 2010 | A1 |
20100239185 | Fowler | Sep 2010 | A1 |
20110080403 | Ernst | Apr 2011 | A1 |
20120075319 | Dally | Mar 2012 | A1 |
Number | Date | Country |
---|---|---|
1928871 | Mar 2007 | CN |
7296145 | Nov 1995 | JP |
2002131793 | May 2004 | RU |
2263947 | Nov 2005 | RU |
Entry |
---|
Realtime Ray Tracing and Interactive Global Illumination, Wald, 2004, pp. 1-297. |
Stackless KD-Tree Traversal for High Performance GPU Ray Tracing, Popov et al., 2007, pp. 415-424. |
Foley et al., “KD-Tree Acceleration Structures for a GPU Raytracer”, 2005, Graphics Hardware 2005, Jul. 30-31, 2005, pp. 15- 22. |
Woop et al., “B-KD Trees for Hardware Accelerated Ray Tracing of Dynamic Scenes”, 2006, Graphics Hardware (2006), pp. 1-10. |
Horn et al., “Interactive k-D Tree GPU Raytracing”, 2007, I3D 2007, Seattle, Washington, Apr. 30-May 2, 2007, pp. 167-174. |
Ize, “Efficient Acceleration Structures for Ray Tracing Static and Dynamic Scenes”, 2009, PhD Thesis—The University of Utah, pp. 1-123. |
CN office action in corresponding CN application No. 200980163256.1 dated Apr. 1, 2014 (11 pages). |
CN office action in corresponding CN application No. 200980163256.1 dated Nov. 27, 2014 (24 pages). |
CN office action in corresponding CN application No. 200980163256.1 dated May 12, 2015 (6 pages). |
CN office action in corresponding CN application No. 200980163256.1 dated Nov. 10, 2015 (6 pages). |
CN office action in corresponding CN application No. 200980163256.1 dated Apr. 7, 2016 (7 pages). |
EP office action in corresponding EP application No. 09850927.6 dated Jul. 13, 2016 (8 pages). |
KR office action in corresponding KR application No. 10-2012-7013974 dated Sep. 25, 2013 (20 pages). |
International Search Report and Written Opinion in corresponding International application No. PCT/RU2009/000594 dated Jul. 29, 2010 (8 pages). |
Maxim Shevtsov et al., “Efficient acceleration structures layout for rendering on 32- and 64-bit many-core architectures,” Proc. of GraphiCon 2009, pp. 301 and 302, Oct. 5-9, 2009. |
Maxim Shevtsov et al., “Highly Parallel Fast KD-tree Construction for Interactive Ray Tracing of Dynamic Scenes,” Computer Graphics Forum, vol. 26, No. 3, pp. 395-404, Oct. 12, 2007. |
Cyril Crassin et al., “GigaVoxels: Ray-Guided Streaming for Efficient and Detailed Voxel Rendering,” Interactive 3D Graphics and Games; Feb. 2009, pp. 15-22. |
EP Office Action in corresponding EP application No. 09 850 927.6 dated Jul. 7, 2017 (5 pages). |
Shevtsov, M. et al., Efficient acceleration structures layout for rendering on 32-and 64-bit many-core architectures (2 pages). |
Number | Date | Country | |
---|---|---|---|
20120268483 A1 | Oct 2012 | US |