Method, electronic device and storage medium for compressing bounding volume hierarchies
By selecting an appropriate compressed node format based on the difference in primitive numbers within the bounding volume hierarchy, the problem of inefficient compression in existing technologies is solved, achieving efficient node compression and improved memory read efficiency.
Patent Information
- Application Number
- CN202210149988.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-02-18
AI Technical Summary
There is a lack of efficient enclosing volume hierarchy compression schemes in the existing technology.
By obtaining the nodes and their child nodes in the bounding volume hierarchy, the maximum number difference between primitives is determined, and different compressed node formats are selected for compression based on the range of the number difference, including a first compressed node format and a second compressed node format. The first format is shorter than the second format and is suitable for different ranges of number difference.
It achieves efficient compression of the bounding volume hierarchy, improves memory read efficiency, and adapts to the compression needs of different nodes.
Smart Images

Figure CN114546967B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this disclosure generally relate to the field of information processing, and more specifically to methods, electronic devices, and computer storage media for recommending data items. Background Technology
[0002] Bounding volume hierarchies (BVH) are tree-like spatial indexing structures based on primitive partitioning. Primitives are the basic elements that make up a scene, including triangles, spheres, etc. Primitives are stored in the leaf nodes of the bounding volume hierarchy. Each node in the bounding volume hierarchy stores the bounding volume that surrounds the primitives within all its child nodes.
[0003] There is currently no efficient compression scheme for enclosing volume hierarchical structures. Summary of the Invention
[0004] A method, electronic device, and computer storage medium for compressing bounding volume hierarchies are provided, which can efficiently compress bounding volume hierarchies.
[0005] According to a first aspect of this disclosure, a method for compressing a bounding volume hierarchy is provided. The method includes: acquiring nodes in the bounding volume hierarchy and a plurality of child nodes of the nodes; determining a maximum number difference among a plurality of primitives included in the plurality of child nodes; if the maximum number difference is determined to be less than or equal to the representation range of a primitive number difference field in a first compressed node format, then compressing the nodes and the plurality of child nodes based on the first compressed node format; and if the maximum number difference is determined to be greater than the representation range of a primitive number difference field in the first compressed node format, then compressing the nodes and the plurality of child nodes based on a second compressed node format, the length of the second compressed node format being greater than the length of the first compressed node format.
[0006] According to a second aspect of this disclosure, an electronic device is provided. The electronic device includes: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0007] In a third aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method according to a first aspect of this disclosure.
[0008] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0009] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0010] Figure 1 This is a schematic diagram of an information processing environment 100 according to an embodiment of the present disclosure;
[0011] Figure 2 This is a schematic diagram of a method 200 for compressing a bounding volume hierarchy according to an embodiment of the present disclosure;
[0012] Figure 3 This is a block diagram of an electronic device for implementing the method for compressing a bounding volume hierarchy according to embodiments of the present disclosure. Detailed Implementation
[0013] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0014] The term "comprising" and its variations as used herein signify open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0015] As mentioned above, there is currently no efficient compression solution for enclosing volume hierarchical structures in the industry.
[0016] To at least partially address one or more of the aforementioned problems and other potential issues, exemplary embodiments of this disclosure propose a scheme for compressing bounding volume hierarchies. In this scheme, nodes and multiple child nodes within the bounding volume hierarchy are obtained; the maximum number difference between multiple primitives included in the multiple child nodes is determined; if the maximum number difference is determined to be less than or equal to the representation range of the primitive number difference field in a first compressed node format, then the node and multiple child nodes are compressed based on the first compressed node format; and if the maximum number difference is determined to be greater than the representation range of the primitive number difference field in the first compressed node format, then the node and multiple child nodes are compressed based on a second compressed node format, the length of which is greater than the length of the first compressed node format. In this manner, bounding volume hierarchies can be compressed efficiently.
[0017] In the following sections, specific examples of this solution will be described in more detail with reference to the accompanying drawings.
[0018] Figure 1 A schematic diagram of an example of an information processing environment 100 according to an embodiment of the present disclosure is shown. The information processing environment 100 may include a computing device 110, a bounding volume hierarchy 120, and a compression result 130.
[0019] The computing device 110 includes, but is not limited to, server computers, multiprocessor systems, mainframe computers, and distributed computing environments that include any of the aforementioned systems or devices. In some embodiments, the computing device 110 may have one or more processing units, including dedicated processing units such as graphics processing units (GPUs), field-programmable gate arrays (FPGAs), and application-specific integrated circuits (ASICs), as well as general-purpose processing units such as central processing units (CPUs).
[0020] The enclosing volume hierarchy 120 may include node 121 and its multiple child nodes 122-1, 122-2, 122-3, 122-4, 122-5, 122-6, 122-7, and 122-8 (hereinafter collectively referred to as 122). It should be understood that, although... Figure 1 The example shown has 8 child nodes, but this is just an illustration; the number of child nodes can be other than that. It should also be understood that although... Figure 1 The diagram shows a two-level tree structure, but this is only an example. The enclosing body hierarchy 120 may also have a tree structure with more than two levels, and the scope of this disclosure is not limited herein.
[0021] The compression result 130 can be obtained by using either the first compression node mode or the second compression node mode. This will be explained in detail below.
[0022] The computing device 110 is used to acquire a node 121 and a plurality of child nodes 122 in the bounding volume hierarchy 120; determine the maximum number difference between the plurality of primitives included in the plurality of child nodes 122; if the maximum number difference is determined to be less than or equal to the representation range of the primitive number difference field in the first compressed node format, then compress the node 121 and the plurality of child nodes 122 based on the first compressed node format; and if the maximum number difference is determined to be greater than the representation range of the primitive number difference field in the first compressed node format, then compress the node 121 and the plurality of child nodes 122 based on a second compressed node format, wherein the length of the second compressed node format is greater than the length of the first compressed node format.
[0023] This allows for efficient compression of the enclosing volume hierarchy.
[0024] Figure 2 A flowchart of a method 200 for compressing a bounding volume hierarchy according to an embodiment of the present disclosure is shown. For example, method 200 may be performed by, for example... Figure 1 The method is executed by the computing device 110 shown. It should be understood that method 200 may also include additional boxes not shown and / or the boxes shown may be omitted, and the scope of this disclosure is not limited in this respect.
[0025] At frame 202, computing device 110 acquires node 121 and multiple child nodes 122 of the bounding volume hierarchy 120.
[0026] The nodes here can be the root node or internal nodes in the enclosing volume hierarchy. This article uses 8 child nodes as an example, but this is just an example, and the number of child nodes can also be other values.
[0027] At box 204, computing device 110 determines the maximum numbering difference between multiple primitives included in multiple child nodes.
[0028] For example, among the 8 child nodes 122, there are 3 leaf nodes A, B and C. Leaf node A includes 4 primitives, numbered 100, 101, 102 and 103 respectively. Leaf node B includes 2 primitives, numbered 105 and 106 respectively. Leaf node C includes 3 primitives, numbered 110 and 111 respectively. Then the maximum difference in numbering is 111-100=11.
[0029] At box 206, computing device 110 determines whether the maximum number difference is less than or equal to the representation range of the element number difference field in the first compressed node format.
[0030] If the primitive number difference field in the first compressed node format is 5 bits, then its representation range is 32.
[0031] If the calculation device 110 determines at box 206 that the maximum number difference is less than or equal to the representation range of the element number difference field in the first compressed node format, then at box 208, node 121 and multiple child nodes 122 are compressed based on the first compressed node format.
[0032] For example, in the example above, the maximum number difference 11 between the multiple elements included in the multiple child nodes 122 is less than the representation range 32 of the element number difference field in the first compressed node format. Therefore, node 121 and multiple child nodes 122 are compressed based on the first compressed node format.
[0033] An example of the first compressed node format can be shown in Table 1 below:
[0034] Table 1
[0035]
[0036] Node type can be represented by 1 bit. For example, 0 can represent the first compressed node format and 1 can represent the second compressed node format.
[0037] The compression process based on the first compression node format is described in detail below with reference to Table 1.
[0038] The computing device 110 can obtain the coordinates of the lower-left corner and the upper-right corner of the bounding volume included in node 121. The lower-left corner coordinate can be represented, for example, as (x1, y1, z1), and the upper-right corner coordinate can be represented, for example, as (x2, y2, z2). It should be understood that the lower-left corner coordinate can also be called the minimum xyz, and the upper-right corner coordinate can also be called the maximum xyz. The bounding volume is a cuboid whose sides are parallel to the corresponding coordinate axes, and therefore it can be uniquely determined by the lower-left corner coordinate and the upper-right corner coordinate.
[0039] The computing device 110 can determine multiple lengths of the bounding volume along multiple coordinate axes based on the lower left and upper right corner coordinates. For example, the length of the bounding volume on the X-axis is x2-x1, the length of the bounding volume on the Y-axis is y2-y1, and the length of the bounding volume on the Z-axis is z2-z1.
[0040] Subsequently, the computing device 110 can set the compression format in the first compression node format based on the size relationship between multiple lengths of the bounding volume in multiple coordinate axis directions.
[0041] Compression formats can include four types, as shown in Table 2 below:
[0042] Table 2
[0043] exps xyz X-axis dominant 8-5-5 32-26-26 Y-axis dominant 5-8-5 26-32-32 Z-axis dominant 5-5-8 26-26-32 Shaftless dominance 6-6-6 28-28-28
[0044] For example, X-axis dominance can be represented as 0, Y-axis dominance as 1, Z-axis dominance as 2, and no axis dominance as 3. The above four types can be represented by two bits in the compression format field of the first compression node format.
[0045] The following describes a specific example of setting the compression format in the first compression node format.
[0046] Specifically, if the computing device 110 determines that the length corresponding to the X-axis among multiple lengths satisfies a predetermined relationship with the two lengths corresponding to the other two coordinate axes, then it sets the compression format in the first compression node format to the first compression format. In the first compression format, the number of bits in the boundary length related parameter field corresponding to the X-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the X-axis coordinate subfield in the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis.
[0047] An example of a predetermined relationship is a length difference greater than or equal to a predetermined difference. For instance, the difference between the length corresponding to the X-axis and the length corresponding to the Y-axis is greater than or equal to a predetermined difference, and the difference between the length corresponding to the X-axis and the length corresponding to the Z-axis is greater than or equal to a predetermined difference. The predetermined difference can include values greater than 0 and can be set as needed.
[0048] Another example of a predetermined relationship is a length ratio that is greater than or equal to a predetermined ratio. For example, the ratio of the length corresponding to the X-axis to the length corresponding to the Y-axis is greater than or equal to a predetermined ratio, and the ratio of the length corresponding to the X-axis to the length corresponding to the Z-axis is greater than or equal to a predetermined ratio. The predetermined ratio can include values greater than or equal to 2, such as 2, 5, 10, etc.
[0049] The pre-arranged relationship can also be in other circumstances, and the scope of this disclosure is not limited herein.
[0050] An example of the first compression format could be the X-axis dominant type in Table 2, where the boundary length related parameter field corresponding to the X-axis includes 8 bits, the boundary length related parameter field corresponding to the Y-axis includes 5 bits, and the boundary length related parameter field corresponding to the Z-axis includes 5 bits. The X-axis coordinate subfield in the lower left corner coordinate field includes 32 bits, the Y-axis coordinate subfield in the lower left corner coordinate field includes 26 bits, and the Z-axis coordinate subfield in the lower left corner coordinate field includes 26 bits. However, it should be understood that the X-axis dominant type is merely illustrative, and the first compression format can also take other forms, such as having other numbers of bits and other bit distributions; the scope of this disclosure is not limited herein.
[0051] If the computing device 110 determines that the length corresponding to the Y-axis among multiple lengths satisfies a predetermined relationship with the two lengths corresponding to the other two coordinate axes, then it sets the compression format in the first compression node format to a second compression format. In the second compression format, the number of bits in the boundary length related parameter field corresponding to the Y-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the Y-axis coordinate subfield in the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis.
[0052] Examples of pre-arranged relationships can be found above, and will not be repeated here.
[0053] An example of the second compression format could be the Y-axis dominant type in Table 2, where the boundary length related parameter field corresponding to the Y-axis includes 8 bits, the boundary length related parameter field corresponding to the X-axis includes 5 bits, and the boundary length related parameter field corresponding to the Z-axis includes 5 bits. The Y-axis coordinate subfield in the lower left corner coordinate field includes 32 bits, the X-axis coordinate subfield in the lower left corner coordinate field includes 26 bits, and the Z-axis coordinate subfield in the lower left corner coordinate field includes 26 bits. However, it should be understood that the Y-axis dominant type is merely illustrative, and the second compression format can also take other forms, such as having other numbers of bits and other bit distributions; the scope of this disclosure is not limited herein.
[0054] If the computing device 110 determines that the length corresponding to the Z-axis among multiple lengths satisfies a predetermined relationship with the two lengths corresponding to the other two coordinate axes, then it sets the compression format in the first compression node format to the third compression format. In the third compression format, the number of bits in the boundary length related parameter field corresponding to the Z-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the Z-axis coordinate subfield in the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis.
[0055] Examples of pre-arranged relationships can be found above, and will not be repeated here.
[0056] An example of the third compression format could be the Z-axis dominant type in Table 2, where the boundary length related parameter field corresponding to the Z-axis includes 8 bits, the boundary length related parameter field corresponding to the X-axis includes 5 bits, and the boundary length related parameter field corresponding to the Y-axis includes 5 bits. The Z-axis coordinate subfield in the lower left corner coordinate field includes 32 bits, the X-axis coordinate subfield in the lower left corner coordinate field includes 26 bits, and the Y-axis coordinate subfield in the lower left corner coordinate field includes 26 bits. However, it should be understood that the Z-axis dominant type is merely illustrative, and the third compression format can also take other forms, such as having other numbers of bits and other bit distributions; the scope of this disclosure is not limited herein.
[0057] If the computing device 110 determines that the length corresponding to each coordinate axis among multiple lengths does not satisfy a predetermined relationship with the two lengths corresponding to the other two coordinate axes, then it sets the compression format in the first compression node format to the fourth compression format. In the fourth compression format, multiple boundary length related parameter fields have the same number of bits, and each coordinate axis coordinate subfield in the lower left corner coordinate field has the same number of bits.
[0058] Examples of pre-arranged relationships can be found above, and will not be repeated here.
[0059] An example of the fourth compression format could be the axisless dominant type in Table 2, where the boundary length related parameter field corresponding to the X-axis includes 6 bits, the boundary length related parameter field corresponding to the Y-axis includes 6 bits, and the boundary length related parameter field corresponding to the Z-axis includes 6 bits. The X-axis coordinate subfield in the lower left corner coordinate field includes 28 bits, the Y-axis coordinate subfield in the lower left corner coordinate field includes 28 bits, and the Z-axis coordinate subfield in the lower left corner coordinate field includes 28 bits. However, it should be understood that the axisless dominant type is merely illustrative, and the fourth compression format can also take other forms, such as having other numbers of bits; the scope of this disclosure is not limited herein.
[0060] Therefore, when the length of the bounding volume on one coordinate axis is dominant relative to other coordinate axes, the number of bits used for other coordinate axes can be compressed.
[0061] After setting the compression format, the computing device 110 can set multiple boundary length-related parameter fields in the first compression node format based on the compression format and multiple lengths.
[0062] For example, if the determined compression format is X-axis dominant, then multiple boundary length related parameter fields adopt an 8-5-5 format, where 8 bits represent the boundary length related parameters of the bounding volume on the X-axis, 5 bits represent the boundary length related parameters of the bounding volume on the Y-axis, and 5 bits represent the boundary length related parameters of the bounding volume on the Z-axis. Other compression formats are similar and will not be elaborated further.
[0063] For example, if the length of the bounding volume on the X-axis is m, then the 8-bit value exp can be set using the following formula:
[0064] tmp = log2(m / (2^8-1))
[0065] exp = ceil(tmp)
[0066] For cases where exp is less than 0 or m is 0, exp can be set to 0. Therefore, exp = 0 means m is less than or equal to 2^8 - 1, exp = 1 means m is greater than 2^8 - 1 and less than or equal to 2*(2^8 - 1), exp = 2 means m is greater than 2*(2^8 - 1) and less than or equal to 3*(2^8 - 1), and so on. It should be understood that for an n-bit value of exp (e.g., 5 bits or 6 bits), the 8 in the above formula can be replaced with n (e.g., 5 or 6), where n is a positive integer; further explanation is unnecessary.
[0067] The computing device 110 can also set the lower left corner coordinate field in the first compression node format based on the compression format and the lower left corner coordinate.
[0068] For example, if the determined compression format is X-axis dominant, then the lower left corner coordinate field xyz adopts the 32-26-26 format, where 32 bits represent the X coordinate in the lower left corner coordinate, 26 bits represent the Y coordinate in the lower left corner coordinate, and 26 bits represent the Z coordinate in the lower left corner coordinate.
[0069] For child node pointers, if computing device 110 determines that there is a non-leaf node among the multiple child nodes 122, it will point the child node pointer in the first compressed node format to the first non-leaf node (i.e., internal node) among the multiple child nodes 122.
[0070] If computing device 110 determines that there are no non-leaf nodes among the multiple child nodes 122, it sets the child node pointers in the first compressed node format to zero.
[0071] An example of a child node pointer can include 26 bits.
[0072] For the other fields in Table 1, the computing device 110 can also obtain the number of the first element included in the first leaf node among the multiple child nodes 122.
[0073] For example, if the third child node out of eight child nodes is the first leaf node, which includes four primitives numbered 100, 101, 102, and 103, then the first primitive included in the first leaf node is numbered 100.
[0074] Subsequently, the computing device 110 can set the primitive base number in the first compressed node format based on the acquired number.
[0075] An example of a primitive base number can include 29 bits. For instance, if the acquired number is 100, 100 can be represented by 29 bits.
[0076] For each of the multiple child nodes 122, the computing device 110 can set the number of elements corresponding to that child node in the first compressed node format based on the type of the child node and the number of elements included in the child node.
[0077] An example of a primitive quantity field corresponding to a child node can include 3 bits. Table 1 includes 8 primitive quantity fields, corresponding to 8 child nodes. However, it should be understood that this is only illustrative; the number of child nodes can be other numbers, and the number of primitive quantity fields can also be other numbers. For example, for n child nodes, there can be n primitive quantity fields. The primitive quantity field can also include other numbers of bits.
[0078] Taking a 3-bit primitive quantity field as an example, if computing device 110 determines that the child node is an internal node, it can set the corresponding primitive quantity field to 7. If computing device 110 determines that the child node is an empty node, it can set the corresponding primitive quantity field to 0. If computing device 110 determines that the child node is a leaf node, it sets the corresponding primitive quantity field based on the number of primitives included in the child node. For example, if the number of primitives included in the child node is 1-4, then the primitive quantity field is set to 1-4 respectively. Values 5 and 6 of the primitive quantity field can be reserved.
[0079] For each of the multiple child nodes 122, the computing device 110 can also set the difference field of the element number corresponding to the child node in the first compressed node format based on the type of the child node, the number of the first element included in the child node, and the element base number.
[0080] An example of the primitive number difference field corresponding to a child node is the primitive number difference field in Table 1, which consists of 5 bits. Table 1 includes 8 primitive number difference fields, corresponding to 8 child nodes. However, it should be understood that this is only an example; the number of child nodes can be other than 5, and the number of primitive number difference fields can also be other than 5. For example, for n child nodes, there can be n primitive number difference fields. The primitive number difference field can also include other numbers of bits.
[0081] Specifically, if the computing device 110 determines that the child node is a leaf node, it determines the difference between the number of the first element included in the child node and the element base number, and based on the determined difference, sets the element number difference field corresponding to the child node in the first compressed node format. For example, if the element base number is 100 and the number of the first element included in the child node is 105, then the element number difference field corresponding to the child node is set to 5.
[0082] For each of the multiple child nodes 122, the computing device 110 can also set multiple boundary offset fields in the first compressed node format corresponding to the child node based on the lower left and upper right corner coordinates of the bounding volume included by the child node and the lower left corner coordinate field in the first compressed node format.
[0083] An example of multiple boundary offset fields corresponding to child nodes can be “bound0”-“bound5” in Table 1, with each boundary offset field consisting of 6 bits.
[0084] Specifically, the computing device 110 can subtract the X-coordinate of the lower left corner of the bounding body included by the child node from the X-coordinate of the lower left corner field in the first compressed node format to obtain the minimum boundary offset of the bounding body included by the child node in the X-axis direction, and subtract the X-coordinate of the upper right corner of the bounding body included by the child node from the X-coordinate of the lower left corner field in the first compressed node format to obtain the maximum boundary offset of the bounding body included by the child node in the X-axis direction. For example, the "bound0" and "bound1" fields can be set based on the obtained minimum and maximum boundary offsets of the bounding body included by the child node in the X-axis direction.
[0085] Similarly, the computing device 110 can subtract the Y-coordinate of the lower left corner of the bounding body included by the child node from the Y-coordinate of the lower left corner field in the first compressed node format to obtain the minimum boundary offset of the bounding body included by the child node in the Y-axis direction, and subtract the Y-coordinate of the upper right corner of the bounding body included by the Y-coordinate of the lower left corner field in the first compressed node format to obtain the maximum boundary offset of the bounding body included by the child node in the Y-axis direction. For example, the "bound2" and "bound3" fields can be set based on the obtained minimum and maximum boundary offsets of the bounding body included by the child node in the Y-axis direction.
[0086] Similarly, the computing device 110 can subtract the Z-coordinate of the lower left corner of the bounding body included by the child node from the Z-coordinate in the lower left corner coordinate field of the first compressed node format to obtain the minimum boundary offset of the bounding body included by the child node in the Z-axis direction, and subtract the Z-coordinate of the upper right corner of the bounding body included by the child node from the Z-coordinate in the lower left corner coordinate field of the first compressed node format to obtain the maximum boundary offset of the bounding body included by the child node in the Z-axis direction. For example, the "bound4" and "bound5" fields can be set based on the obtained minimum and maximum boundary offsets of the bounding body included by the child node in the Z-axis direction.
[0087] Therefore, since the lower left corner coordinate field in the first compressed node format is already relatively accurate, the bounding body included by the child node is represented by the offset of the bounding body relative to the lower left corner coordinate field. This avoids using a large number of bits to represent the coordinates of the bounding body, thereby achieving compression.
[0088] Now back Figure 2 If the calculation device 110 determines at box 206 that the maximum number difference is greater than the representation range of the element number difference field in the first compressed node format, then at box 210, node 121 and multiple child nodes 122 are compressed based on the second compressed node format, and the length of the second compressed node format is greater than the length of the first compressed node format.
[0089] An example of the second compressed node format can be shown in Table 3 below:
[0090] Table 3
[0091]
[0092]
[0093] Node type can be represented by 1 bit. For example, 0 can represent the first compressed node format and 1 can represent the second compressed node format.
[0094] Specifically, computing device 110 can obtain the coordinates of the lower left and upper right corners of the bounding volume included in node 111. This step is similar to that of the first compressed node format and will not be described again.
[0095] Subsequently, the computing device 110 can determine multiple lengths of the bounding volume along multiple coordinate axes based on the lower left and upper right corner coordinates. This step is similar to the first compressed node format and will not be described again.
[0096] The computing device 110 can set multiple boundary length-related parameter fields in the second compressed node format based on multiple lengths.
[0097] Taking Table 3 as an example, the second compressed node format may include three boundary length-related parameter fields, each of which consists of 8 bits. It should be understood that the boundary length-related parameter fields in the second compressed node format may also include other numbers of bits, and the scope of this disclosure is not limited herein.
[0098] The process of setting multiple boundary length-related parameter fields in the second compression node format is similar to that of the first compression node format, and will not be described again.
[0099] The computing device 110 can also set the lower left corner coordinate field in the second compressed node format based on the lower left corner coordinate.
[0100] Taking Table 3 as an example, the lower left corner coordinate field in the second compressed node format can include 96 bits, of which the X coordinate subfield includes 32 bits, the Y coordinate subfield includes 32 bits, and the Z coordinate subfield includes 32 bits.
[0101] The process of setting the bottom left corner coordinate field in the second compressed node format is similar to that of the first compressed node format, and will not be described again.
[0102] For the child node pointer and element number fields in the second compressed node format, if the computing device 110 determines that each of the multiple child nodes 122 is a leaf node, then it sets the child node pointer in the second compressed node format to the number of the first element included in the first child node among the multiple child nodes 122, and sets the corresponding element number field in the second compressed node format based on the number of the first element included in each of the remaining child nodes 122 other than the first child node.
[0103] If the computing device 110 determines that there is a non-leaf node among the multiple child nodes 122, it points the child node pointer in the second compressed node format to the first non-leaf node among the multiple child nodes; and sets the corresponding element number field in the second compressed node format based on the number of the first element included in each leaf node among the multiple child nodes 122.
[0104] Taking Table 3 as an example, the child node pointer in the second compressed node format can include 29 bits, and the second compressed node format can include 7 primitive number fields, each of which can include 29 bits. The number of primitive number fields is one less than the number of child nodes. Thus, when all 8 child nodes 122 included in node 121 are leaf nodes, the child node pointer can no longer be used to point to the child nodes, but instead be used to represent the number of the first primitive included in the first child node, thereby saving one primitive number field.
[0105] If there are non-leaf nodes among the 8 child nodes 122, the child node pointer can be pointed to the first non-leaf node (that is, the internal node). For the other leaf nodes, the corresponding element number field can be set in order.
[0106] For each of the multiple child nodes 122, the computing device 110 can set the number of elements corresponding to that child node in the second compressed node format based on the type of the child node and the number of elements included in the child node.
[0107] Taking Table 3 as an example, the primitive quantity field corresponding to a child node can include 3 bits. Table 3 includes 8 primitive quantity fields, corresponding to 8 child nodes. However, it should be understood that this is only an example; the number of child nodes can be other numbers, and the corresponding primitive quantity field can also be other numbers, and the primitive quantity field can also include other numbers of bits.
[0108] Taking a 3-bit primitive quantity field as an example, if computing device 110 determines that the child node is an internal node, it can set the corresponding primitive quantity field to 7. If computing device 110 determines that the child node is an empty node, it can set the corresponding primitive quantity field to 0. If computing device 110 determines that the child node is a leaf node, it sets the corresponding primitive quantity field based on the number of primitives included in the child node. For example, if the number of primitives included in the child node is 1-4, then the primitive quantity field is set to 1-4 respectively. Values 5 and 6 of the primitive quantity field can be reserved.
[0109] For each of the multiple child nodes 122, the computing device 110 can also set multiple boundary offset fields in the second compressed node format corresponding to the child node based on the lower left and upper right corner coordinates of the bounding volume included by the child node and the lower left corner coordinate field in the second compressed node format.
[0110] An example of multiple boundary offset fields corresponding to child nodes can be “bound0”-“bound5” in Table 3, with each boundary offset field consisting of 8 bits.
[0111] The specific process is similar to that of the first compressed node format, and will not be described in detail here.
[0112] This allows for efficient compression of the bounding volume hierarchy. Furthermore, setting the size of the first compressed node format to 512 bits facilitates single-pass memory reads, improving memory access efficiency. Additionally, setting the size of the second compressed node format to 768 bits, 256 bits larger than 512, also facilitates memory reads.
[0113] Figure 3 A schematic block diagram of an example device 300 that can be used to implement embodiments of the present disclosure is shown. For example, such as Figure 1 The computing device 110 shown can be implemented by device 300. As shown, device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 302 or loaded from storage unit 308 into random access memory (RAM) 303. The random access memory 303 may also store various programs and data required for the operation of device 300. The CPU 301, ROM 302, and RAM 303 are interconnected via bus 304. Input / output (I / O) interface 305 is also connected to bus 304.
[0114] Multiple components in device 300 are connected to input / output interface 305, including: input unit 306, such as keyboard, mouse, microphone, etc.; output unit 307, such as various types of monitors, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0115] The various processes and handling described above, such as method 200, can be executed by the central processing unit 301. For example, in some embodiments, method 200 can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed on device 300 via read-only memory 302 and / or communication unit 309. When the computer program is loaded into random access memory 303 and executed by central processing unit 301, one or more actions of method 200 described above can be performed.
[0116] This disclosure relates to methods, apparatus, systems, electronic devices, computer-readable storage media, and / or computer program products. A computer program product may include computer-readable program instructions for performing various aspects of this disclosure.
[0117] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0118] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0119] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0120] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0121] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0122] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0123] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0124] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for compressing a bounding volume hierarchy, comprising: Obtain the nodes in the bounding volume hierarchy and the multiple child nodes of the nodes; Determine the maximum numbering difference among the multiple primitives included in the multiple child nodes; If it is determined that the maximum number difference is less than or equal to the representation range of the primitive number difference field in the first compressed node format, then the node and the plurality of child nodes are compressed based on the first compressed node format, wherein compressing the node and the plurality of child nodes based on the first compressed node format includes: determining the multiple lengths of the bounding volume in multiple coordinate axis directions; setting the compression format in the first compressed node format based on the size relationship between the multiple lengths; and If it is determined that the maximum number difference is greater than the representation range of the primitive number difference field in the first compressed node format, then the node and the plurality of child nodes are compressed based on the second compressed node format, wherein the length of the second compressed node format is greater than the length of the first compressed node format.
2. The method according to claim 1, wherein compressing the node and the plurality of child nodes based on the first compressed node format further comprises: Obtain the coordinates of the lower left and upper right corners of the bounding volume included in the node; Based on the lower left corner coordinates and the upper right corner coordinates, determine the multiple lengths of the bounding volume in multiple coordinate axis directions; Based on the compression format and the multiple lengths, set multiple boundary length-related parameter fields in the first compression node format; as well as Based on the compression format and the lower left corner coordinates, set the lower left corner coordinate field in the first compression node format.
3. The method according to claim 2, wherein the compression format comprises 2 bits.
4. The method according to claim 2, wherein setting the compression format in the first compression node format includes: If it is determined that the length corresponding to the X-axis among the plurality of lengths satisfies a predetermined relationship with the two lengths corresponding to the other two coordinate axes, then the compression format in the first compression node format is set to the first compression format. In the first compression format, the number of bits in the boundary length related parameter field corresponding to the X-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the X-axis coordinate subfield of the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis. If it is determined that the length corresponding to the Y-axis among the plurality of lengths satisfies the predetermined relationship with the two lengths corresponding to the other two coordinate axes, then the compression format in the first compression node format is set to the second compression format. In the second compression format, the number of bits in the boundary length related parameter field corresponding to the Y-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the Y-axis coordinate subfield in the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis. If it is determined that the length corresponding to the Z-axis among the plurality of lengths satisfies the predetermined relationship with the two lengths corresponding to the other two coordinate axes, then the compression format in the first compression node format is set to the third compression format. In the third compression format, the number of bits in the boundary length related parameter field corresponding to the Z-axis is greater than the number of bits in the other boundary length related parameter field corresponding to each other coordinate axis, and the number of bits in the Z-axis coordinate subfield in the lower left corner coordinate field is greater than the number of bits in the coordinate subfield of each other coordinate axis. as well as If it is determined that the length corresponding to each coordinate axis among the plurality of lengths does not satisfy the predetermined relationship relative to the two lengths corresponding to the other two coordinate axes, then the compression format in the first compression node format is set to a fourth compression format, in which the plurality of boundary length related parameter fields have the same number of bits, and each coordinate axis coordinate subfield in the lower left corner coordinate field has the same number of bits.
5. The method according to claim 4, wherein in the first compression format, the boundary length related parameter field corresponding to the X-axis includes 8 bits, the other boundary length related parameter field corresponding to each other coordinate axis includes 5 bits, the X-axis coordinate subfield in the lower left corner coordinate field includes 32 bits, and each other coordinate axis coordinate subfield includes 26 bits.
6. The method according to claim 4, wherein in the second compression format, the boundary length related parameter field corresponding to the Y-axis includes 8 bits, the other boundary length related parameter field corresponding to each other coordinate axis includes 5 bits, the Y-axis coordinate subfield in the lower left coordinate field includes 32 bits, and each other coordinate axis coordinate subfield includes 26 bits.
7. The method according to claim 4, wherein in the third compression format, the boundary length related parameter field corresponding to the Z-axis includes 8 bits, the other boundary length related parameter field corresponding to each other coordinate axis includes 5 bits, the Z-axis coordinate subfield in the lower left corner coordinate field includes 32 bits, and each other coordinate axis coordinate subfield includes 26 bits.
8. The method according to claim 4, wherein in the fourth compression format, the plurality of boundary length related parameter fields have 6 bits, and each coordinate axis subfield in the lower left corner coordinate field has 28 bits.
9. The method according to any one of claims 2-8, wherein compressing the node and the plurality of child nodes based on the first compressed node format further comprises: If it is determined that there is a non-leaf node among the plurality of child nodes, then the child node pointer in the first compressed node format is set to point to the first non-leaf node among the plurality of child nodes; as well as If it is determined that there are no non-leaf nodes among the plurality of child nodes, then the child node pointers in the first compressed node format are set to zero.
10. The method of claim 9, wherein the child node pointer comprises 26 bits.
11. The method according to any one of claims 2-8, wherein compressing the node and the plurality of child nodes based on the first compressed node format further comprises: Obtain the number of the first element included in the first leaf node among the plurality of child nodes; Based on the obtained number, set the basic number of the graphic element in the first compressed node format; For each of the plurality of child nodes, perform the following steps: Based on the type of the child node and the number of primitives included in the child node, set the primitive quantity field corresponding to the child node in the first compressed node format; Based on the type of the child node, the number of the first element included in the child node, and the basic element number, set the element number difference field in the first compressed node format corresponding to the child node; and Based on the lower left and upper right corner coordinates of the bounding volume included in the child node and the lower left corner coordinate field in the first compressed node format, multiple boundary offset fields corresponding to the child node are set in the first compressed node format.
12. The method of claim 11, wherein the primitive base number comprises 29 bits.
13. The method according to claim 11, wherein the primitive quantity field corresponding to the child node includes 3 bits, and the primitive number difference field corresponding to the child node includes 5 bits.
14. The method of claim 11, wherein the plurality of boundary offset fields corresponding to the child node include 6 boundary offset fields, and each boundary offset field includes 6 bits.
15. The method of claim 1, wherein the plurality of child nodes comprises 8 child nodes.
16. The method of claim 15, wherein the length of the first compressed node format comprises 512 bits, and wherein the first compressed node format comprises a 1-bit node type field.
17. The method of claim 1, wherein compressing the node and the plurality of child nodes based on a second compressed node format comprises: Obtain the coordinates of the lower left and upper right corners of the bounding volume included in the node; Based on the lower left corner coordinates and the upper right corner coordinates, determine the multiple lengths of the bounding volume in multiple coordinate axis directions; Based on the multiple lengths, set multiple boundary length-related parameter fields in the second compressed node format; as well as Based on the lower left corner coordinates, set the lower left corner coordinate field in the second compressed node format.
18. The method of claim 17, wherein compressing the node and the plurality of child nodes based on the second compressed node format further comprises: If it is determined that each of the plurality of child nodes is a leaf node, then: Set the child node pointer in the second compressed node format to the number of the first primitive included in the first child node among the plurality of child nodes; and Based on the number of the first element included in each of the multiple child nodes except the first child node, the corresponding element number field in the second compressed node format is set.
19. The method of claim 17, wherein compressing the node and the plurality of child nodes based on the second compressed node format further comprises: If it is determined that there is a non-leaf node among the plurality of child nodes, then: Set the child node pointer in the second compressed node format to the first non-leaf node among the plurality of child nodes; as well as Based on the number of the first element included in each leaf node among the plurality of child nodes, the corresponding element number field in the second compressed node format is set.
20. The method according to claim 18 or 19, wherein the child node pointer comprises 29 bits, the second compressed node format comprises 7 primitive number fields, and each primitive number field comprises 29 bits.
21. The method according to any one of claims 17-19, wherein compressing the node and the plurality of child nodes based on a second compressed node format further comprises: For each of the plurality of child nodes, perform the following steps: Based on the type of the child node and the number of primitives included in the child node, set the primitive quantity field corresponding to the child node in the second compressed node format; as well as Based on the lower left and upper right corner coordinates of the bounding volume included in the child node and the lower left corner coordinate field in the second compressed node format, multiple boundary offset fields corresponding to the child node are set in the second compressed node format.
22. The method according to claim 21, wherein the primitive quantity field corresponding to the child node includes 3 bits, the plurality of boundary offset fields corresponding to the child node include 6 boundary offset fields, and each boundary offset field includes 8 bits.
23. The method of claim 22, wherein the length of the second compressed node format comprises 768 bits, and wherein the second compressed node format comprises a 1-bit node type field and a 7-bit reserved field.
24. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-23.
25. A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the method of any one of claims 1-23.
Citation Information
Patent Citations
One-dimensional nondestructive geometric compressing method of three-dimensional grid model
CN101354788A
Apparatus and method for compressing leaf nodes of bounding volume hierarchy (BVH)
CN110363698A