Intersection test method, intersection test device and computer readable storage medium
By determining the intersection of rays and the three-dimensional axis alignment frame in the ray tracing system, using the three-condition determination method, the problem of large intersecting test calculation workload in the ray tracing system is solved, and the effect of reducing delay, power consumption and size is achieved.
Patent Information
- Application Number
- CN202210275784.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-03-23
- Filing Date
- 2022-03-21
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2042-03-21
AI Technical Summary
In ray tracing systems, the computational work required to perform intersection tests is relatively large, especially when rendering complex scenes, a large number of intersection tests of rays and scene objects are required.
By a method of determining whether the light ray intersects with the three-dimensional axis alignment frame, the method includes determining three conditions: the first condition, the second condition and the third condition, if at least one condition is not met, it is determined that the light ray does not intersect with the axis alignment frame.
Reduces the number of intersection tests that need to be performed, thereby reducing the latency, power consumption and physical dimensions of the ray tracing system.
Smart Images

Figure CN115115763B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to techniques for performing intersection testing in a ray tracing system. Background Art
[0002] Ray tracing is a computational rendering technique used to generate an image of a scene (e.g., a 3D scene) by tracing a light path ('ray') through the scene, usually from the perspective of a camera. Each ray is modeled as originating from a camera and entering the scene through a pixel. As the ray traverses the scene, it may intersect with an object within the scene. The intersection between the ray and the object it intersects may be modeled to create realistic visual effects. For example, in response to determining that the ray intersects with the object, a shader program (i.e., a portion of a computer code) may be executed for the intersection. A programmer may write a shader program to define how the system reacts to an intersection (the intersection may, for example, result in one or more secondary rays being emitted into the scene), for example, to represent the reflection of the ray from the intersecting object or the refraction of the ray through the object (e.g., if the object is transparent or translucent). As another example, a shader program may cause one or more rays to be emitted into the scene for determining whether an object is in a shadow at an intersection. The result of executing the shader program (and processing the associated secondary rays) may be a color value of a pixel through which the ray passes.
[0003] Rendering an image of a scene using ray tracing can involve performing many intersection tests, such as performing billions of intersection tests to render an image of the scene. In order to reduce the number of intersection tests that need to be performed, a ray tracing system can generate an acceleration structure, wherein each node of the acceleration structure represents an area within the scene. The acceleration structure is typically hierarchical (e.g., having a tree structure) such that it contains multiple levels of nodes, wherein nodes near the top of the acceleration structure represent relatively large areas in the scene (e.g., the root node can represent the entire scene), and nodes near the bottom of the acceleration structure represent relatively small areas in the scene. A "tree node" refers to a node having a pointer to other nodes in a hierarchical acceleration structure, i.e., a tree node has child nodes in a hierarchical acceleration structure. A "leaf node" refers to a node having one or more pointers to one or more primitives, i.e., a leaf node does not have child nodes in a hierarchical acceleration structure. In other words, a leaf node of an acceleration structure represents an area in a scene that defines one or more primitives. The acceleration structure may have different structures in different examples, such as a grid structure, an octree structure, a space partitioning structure (e.g., a kd tree), or a bounding volume hierarchy. A node may represent a suitable shape or area (which may be referred to as a "box" in this article) in a scene. In some examples, a node represents an axis-aligned bounding box (AABB) in the scene.
[0004] An acceleration structure may be used to perform an intersection test on a ray by first testing the ray for intersection with the root node of the acceleration structure (e.g., recursively). If the ray is found to intersect a parent node (e.g., a root node), the test may proceed to the child nodes of the parent node. In contrast, if the ray is found not to intersect a parent node, the intersection test on the child nodes of the parent node may be avoided, thereby saving computational effort. If the ray is found to intersect a leaf node, the ray may be tested against objects within the region represented by the leaf node to determine which object(s) the ray intersects with. If the ray is found to have more than one intersection point, the intersection point closest to the ray origin (i.e., the first intersection encountered by the ray in the scene) may be identified, and it may be determined that the ray intersects at this identified closest intersection point. It is possible that there are multiple closest hits for the ray, and in such a case, some tie-break logic may be used to select one of the multiple closest hits to be used as the identified closest intersection point. For some types of rays, it may not be necessary to identify the closest intersection point. For example, when processing shadow rays, an indication that there is at least one intersection is sufficient without determining which intersection is closest, and some APIs may allow the traversal of an acceleration structure for a shadow ray to terminate in response to finding any intersection, thereby reducing the number of intersection tests that need to be performed. Using acceleration structures (rather than testing rays directly with objects in the scene) reduces the number of intersection tests that need to be performed and simplifies intersection testing. Intersection testing is simpler because the nodes of the acceleration structures represent primitive shapes (e.g., axis-aligned bounding boxes or spheres), and intersection testing for these primitive shapes is simpler than intersection testing for more complex object shapes, such as those defined in terms of triangle primitives whose alignment relative to the axes of the coordinate system is not predetermined.
[0005] A ray (r) may be defined as r=O+Dt, where O is a vector representing the origin of the ray, D is a vector representing the direction of the ray, and t represents the distance along the ray from the origin. According to one approach, a ray may be tested against an axis-aligned box by finding an interval t for each of the x, y, and z dimensions within which the ray is between two planes representing the sides of the box that are perpendicular to said dimensions. This gives three intervals for values of t (one for the x dimension, one for the y dimension, and one for the z dimension). If the intersection of these three intervals (which is itself an interval) is empty, then the ray does not intersect the axis-aligned box; and if the intersection of these three intervals is not empty, then the ray may intersect the axis-aligned box. This intersection testing approach involves performing six tests to find three intervals t, and then performing comparisons to determine if the intersections of those intervals are empty.
[0006] According to another approach, the ray can be tested against the edges of the box that form the 2D outline of the box from the ray's point of view. The ray is determined to intersect the box if the ray passes inside each outline edge, and is determined not to intersect the box if the ray passes outside one or more of the outline edges of the box. An AABB typically has six outline edges (depending on the orientation of the AABB from the ray's point of view), so this approach typically requires performing six tests.
[0007] The above test will determine whether an infinitely long line aligned with the ray will intersect the box. However, the length of a ray is usually not infinite, and the ray may have one or more validity intervals. For example, a ray may have some minimum distance and some maximum distance from the ray origin, which may be calculated according to a minimum value of t (called the minimum culling distance, t min ) and the maximum value of t (called the maximum culling distance, t max ). Thus, a minimum distance test may be performed to check that the minimum culling distance is not greater than the maximum intersection distance to the intersection of the ray with the box; and a maximum distance test may be performed to check that the maximum culling distance is not less than the minimum intersection distance to the intersection of the ray with the box. In the first example described above where an intersection interval is used to determine whether a ray intersects a box, rather than performing separate minimum and maximum distance tests, a starting interval may be initialized to represent the distance between t min With t max The range of t values between t min With t max When the t values between the intervals intersect, the result of determining whether there is any intersection between the intervals is determined to be an intersection. min and t max Each endpoint of can be included in or excluded from the interval.
[0008] Since intersection testing of rays against shapes corresponding to nodes of an acceleration structure (e.g., axis-aligned boxes) is performed many times, it may be beneficial to implement the functionality for performing these intersection tests in a dedicated hardware module, for example using fixed-function circuitry, rather than using a software module that executes on a general-purpose processing unit to implement these intersection tests. Software implementations are typically more flexible because software is easier to change than hardware implementations after it is designed and / or created. However, hardware implementations typically provide more efficient implementations in terms of latency and power consumption, so if the desired functionality is known in advance, a hardware implementation may be preferred over a software implementation. When designing a hardware implementation of an intersection test module configured to perform intersection testing, there are typically the following competing goals: (i) having a smaller size (i.e., smaller silicon area), (ii) having lower latency, and (iii) having lower power consumption. Summary of the invention
[0009] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0010] A method for determining whether a ray intersects a three-dimensional axis-aligned box in a ray tracing system is provided, the method comprising:
[0011] Determine whether a first condition is satisfied, wherein the first condition is or is equal to
[0012] Determine whether a second condition is satisfied, wherein the second condition is or is equal to
[0013] Determine whether a third condition is satisfied, wherein the third condition is or is equal to and
[0014] determining whether the ray intersects the axis-aligned frame using the determination of whether the first condition, the second condition, and the third condition are satisfied;
[0015] Among them C x ,C y and C z are the x, y, and z components of the position of the center of the axis-aligned box relative to the origin of the ray, where H x ,H y and H z is the half-width of the axis-aligned box in the x, y, and z dimensions, and where D x ,D y and D z are the x, y, and z components of the light's direction vector.
[0016] Determining whether the ray intersects the axis-aligned box using the determination of whether the first condition, the second condition, and the third condition are satisfied may include determining that the ray does not intersect the axis-aligned box if at least one of the first condition, the second condition, and the third condition is determined not to be satisfied.
[0017] The method may further include determining whether a maximum distance condition is satisfied, wherein the maximum distance condition may be satisfied if a maximum distance of the ray from the ray origin to the intersection of the ray direction vector and the box is greater than or equal to a minimum distance from the ray origin to the intersection of the ray direction vector and the box, wherein the determination using the first condition, the second condition, and the third condition being satisfied may further include determining whether the ray intersects the axis-aligned box using the determination of whether the maximum distance condition is satisfied.
[0018] The method may further include determining whether a minimum distance condition is satisfied, wherein the minimum distance condition may be satisfied if a minimum distance of the ray from the ray origin to the intersection of the ray direction vector and the box is less than or equal to a maximum distance, wherein the determination using the first condition, the second condition, and the third condition are satisfied may further include determining whether the ray intersects the axis-aligned box using the determination of whether the minimum distance condition is satisfied.
[0019] Determining whether the minimum and maximum distance conditions are satisfied may include determining whether a single distance condition is satisfied, wherein determining that the single distance condition is satisfied may indicate that both the minimum distance condition and the maximum distance condition are satisfied.
[0020] A single distance condition can be or equal to where D is a number with component D x ,D y and D z The direction vector of the light ray, where C is a vector with component C x ,C y and C z The center position of the axis-aligned box, where H is the half-width of the axis-aligned box. x ,H y and H z where the point on the ray is at position O+Dt, where O is a vector representing the origin of the ray, and t represents the distance along the ray to the origin of the ray, and where and where t min is the minimum value of t that defines the minimum distance of the ray from the ray origin, and where t max is the maximum value of t that defines the maximum distance a ray can travel from the ray's origin.
[0021] If it is determined that all of the first, second, third maximum distance, and minimum distance conditions are met, then it can be determined that the ray intersects the axis-aligned box.
[0022] The method may further include selectively permuting and / or inverting the x, y, and z components of the light and the axis-aligned frame before determining whether the first condition, the second condition, and the third condition are satisfied, so that D z ≥D x ≥0 and D z ≥D y ≥0.
[0023] Pre-calculated light and and storing it in a storage device, wherein the method includes reading from the storage device and to determine whether the first condition, the second condition, and the third condition are satisfied.
[0024] The method may also include reading data defining the position and size of the axis-aligned frame, and using the read data to determine the C of the axis-aligned frame. x ,C y ,C z ,H x ,H y and H z .
[0025] C can be determined by subtracting the corresponding component of the ray origin from the corresponding component of the reading that defines the location of the box center. x ,C y and C z .
[0026] The determination of whether the first, second and third conditions are satisfied may be performed conservatively such that if a completely accurate determination had determined that the conditions were satisfied, any error introduced by rounding in the determination process could not cause a determination that the conditions were not satisfied.
[0027] It can be determined by The determination of whether the first condition is satisfied can be performed conservatively, where the determination can be made by determining whether The determination of whether the second condition is satisfied is performed conservatively, and wherein the determination can be performed by determining whether
[0028] to conservatively perform the determination of whether the third condition is satisfied, where roundup indicates that multiplication and addition operations are rounded toward +∞, where SafetyFactor xz Is to determine The upper limit of the error introduced by rounding when SafetyFactor yz Is to determine The upper limit of the error introduced by rounding when , and where SafetyFactor xy Is to determine The upper limit of the error introduced by rounding when
[0029] It can be determined by The determination of whether the first condition is satisfied can be performed conservatively, where the determination can be made by determining whether The determination of whether the second condition is satisfied is performed conservatively, and wherein the determination can be performed by determining whether The determination of whether the third condition is satisfied is performed conservatively, where roundup indicates that multiplication and addition operations are rounded toward +∞, and where rounddown indicates that multiplication and subtraction operations are rounded appropriately such that the corresponding overall expression is rounded toward –∞.
[0030] The method may also include outputting an indication of a result of determining whether the ray intersects the axis-aligned box.
[0031] The outputted indications may be used in a ray tracing system to render an image of the 3D scene.
[0032] The axis-aligned box may be an axis-aligned bounding box that circumscribes the geometry to be rendered.
[0033] The axis-aligned boxes may correspond to nodes of a hierarchical acceleration structure to be used to perform intersection testing in a ray tracing system.
[0034] The node may be part of a low level acceleration structure (BLAS) for representing geometry in instance space, and wherein the method may comprise transforming the ray into the instance space.
[0035] An intersection test module for use in a ray tracing system is provided, which is configured to determine whether a ray intersects a three-dimensional axis-aligned box, the intersection test module being configured to:
[0036] Determine whether a first condition is satisfied, wherein the first condition is or is equal to
[0037] Determine whether a second condition is satisfied, wherein the second condition is or is equal to
[0038] Determine whether a third condition is satisfied, wherein the third condition is or is equal to and
[0039] determining whether the ray intersects the axis-aligned frame using the determination of whether the first condition, the second condition, and the third condition are satisfied;
[0040] Among them C x ,C y and C z are the x, y, and z components of the position of the center of the axis-aligned box relative to the origin of the ray, where H x ,H y and H z is the half-width of the axis-aligned box in the x, y, and z dimensions, and where D x ,D y and Dz are the x, y and z components of the direction vector of the ray.
[0041] The intersection test module may further include a storage device configured to store the light and The value of which the intersection test module can be configured to read from storage and to determine whether the first condition, the second condition, and the third condition are satisfied.
[0042] The intersection test module may also be configured to output an indication of a result of determining whether the ray intersects the axis-aligned box, wherein the output indication may be used in a ray tracing system for rendering an image of the 3D scene.
[0043] An intersection testing module may be provided, configured to perform any of the methods described herein.
[0044] A computer readable code may be provided, which is configured to cause any of the methods described herein to be performed when the code is executed.
[0045] A method of performing an intersection test of a ray with a box in a ray tracing system may be provided, wherein the ray and the box are defined in 3D space using a spatial coordinate system, and wherein the ray is defined using a ray origin and a ray direction, the method comprising:
[0046] performing the intersection test using a ray coordinate system, wherein the ray coordinate system has an origin at the ray origin, and wherein the ray coordinate system has three basis vectors,
[0047] wherein a first basis vector of the basis vectors is aligned with the light direction, and
[0048] wherein a second basis vector and a third basis vector of the basis vectors: (i) are both orthogonal to the first basis vector, (ii) are not parallel to each other, and (iii) have zero as a component when expressed in the spatial coordinate system; and
[0049] The results of performing the intersection test are output for use by the ray tracing system.
[0050] An intersection test module configured to perform an intersection test of a ray and a box for use in a ray tracing system may be provided, wherein the ray and the box are defined in a 3D space using a spatial coordinate system, and wherein the ray is defined using a ray origin and a ray direction, the intersection test module being configured to:
[0051] performing the intersection test using a ray coordinate system, wherein the ray coordinate system has an origin at the ray origin, and wherein the ray coordinate system has three basis vectors,
[0052] wherein a first basis vector of the basis vectors is aligned with the light direction, and
[0053] wherein a second basis vector and a third basis vector of the basis vectors: (i) are both orthogonal to the first basis vector, (ii) are not parallel to each other, and (iii) have zero as a component when expressed in the spatial coordinate system; and
[0054] The results of performing the intersection test are output for use by the ray tracing system.
[0055] The intersection test module may be embodied in hardware on an integrated circuit. A method of manufacturing the intersection test module at an integrated circuit manufacturing system may be provided. An integrated circuit definition data set may be provided, which, when processed in the integrated circuit manufacturing system, configures the system to manufacture the intersection test module. A non-transitory computer readable storage medium may be provided, having stored thereon a computer readable description of the intersection test module, which, when processed in the integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the intersection test module.
[0056] An integrated circuit manufacturing system can be provided, comprising: a non-temporary computer-readable storage medium having stored thereon a computer-readable description of an intersection test module; a layout processing system configured to process the computer-readable description to generate a circuit layout description of an integrated circuit embodying the intersection test module; and an integrated circuit generation system configured to manufacture the intersection test module based on the circuit layout description.
[0057] A computer program code for executing any of the methods described herein may be provided. A non-transitory computer readable storage medium may be provided having computer readable instructions stored thereon which, when executed at a computer system, cause the computer system to perform any of the methods described herein.
[0058] As will be apparent to those skilled in the art, the features described above may be combined as appropriate and may be combined with any aspects of the examples described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Examples will now be described in detail with reference to the accompanying drawings, in which:
[0060] Figure 1 A ray tracing system according to examples described herein is shown;
[0061] Figure 2 The light and the box, the basis vectors of the space coordinate system, and the basis vectors of the light coordinate system are shown;
[0062] Figure 3 is a flow chart of a method of performing an intersection test to determine whether a ray intersects a 3D axis-aligned box according to examples described herein;
[0063] Figure 4a Rays and boxes are shown where the origin of the ray is outside the box;
[0064] Figure 4b The light and the box are shown with the end of the light in front of the box;
[0065] Figure 4c A ray and a box are shown where the ray's origin is before the box and the ray's end extends beyond the box;
[0066] Figure 5 A computer system is shown in which a ray tracing system is implemented; and
[0067] Figure 6 An integrated circuit manufacturing system for producing an integrated circuit embodying a ray tracing system is shown.
[0068] The accompanying drawings show various examples. It will be appreciated by the skilled person that the element boundaries (e.g., boxes, groups of boxes, or other shapes) shown in the accompanying drawings represent an example of boundaries. In some examples, it may be the case that an element can be designed as multiple elements, or multiple elements can be designed as one element. Where appropriate, common reference numerals are used throughout the accompanying drawings to indicate similar features. DETAILED DESCRIPTION
[0069] The following description is given by way of example to enable one skilled in the art to make and use the invention.The present invention is not limited to the embodiments described herein, and various modifications to the disclosed embodiments will be apparent to those skilled in the art.
[0070] Embodiments are now described by way of example only.
[0071] Even with the use of acceleration structures, the amount of work involved in performing intersection tests in a ray tracing system is still significant. For example, ray tracing can be used to render an image of a 3D scene, where the image may have about one million pixels. The pixel color value is derived from some distribution of samples associated with a point in the image plane (usually, there is a one-to-one correspondence between pixels and sample positions, but areas of the image may have higher or lower sample densities, or may otherwise be independent of the arrangement of pixels). In the context of ray tracing, the samples themselves are associated with a distribution of primary rays (in a statistical sense) parameterized by the neighborhood of each sample position. In the simplest example, a single primary ray is traced for each sample, and the result of the sample is determined using the primary ray. In other examples, multiple rays can be generated based on a distribution (e.g., random sampling) and some cumulative or combined results derived from individual primary rays. When it is determined that a ray intersects an object in the scene, a shader can be executed that can cause another ray (i.e., a "secondary ray") to be emitted into the scene. Each primary ray can cause the emission of several secondary rays, all of which are traced through the scene to determine their intersection points. Therefore, it is not uncommon to trace tens or hundreds of millions of rays through the scene to render an image. As graphics rendering technology has advanced, scenes to be rendered have become increasingly complex, so it is not uncommon for there to be thousands of objects in a scene, each of which may be represented by many primitives. In addition, the image being rendered may represent a frame in a series of frames to be rendered in real time, such as to be displayed to a user in real time. For example, a user may be playing a game, where the rendered image represents the user's view of a 3D scene as the user plays the game. In order to make the series of frames look like a continuous stream of video data, several frames per second may be rendered, such as 24, 30, or 60 frames per second, as some examples. Therefore, it can be understood that there is a lot of work involved in performing intersection tests in a ray tracing system to render a scene to be output in real time.
[0072] One way to overcome this problem and perform ray tracing to render the scene to be output in real time is to have one or more supercomputers perform all the processing. This can be considered a "brute force" approach. However, in addition to the goal of having high performance (performing ray tracing to render the scene to be output in real time), there is also a competing goal of reducing the size (e.g., silicon area) and power consumption of the ray tracing system. For example, there may be a goal of implementing a ray tracing system on a mobile device such as a tablet computer or a smartphone, whose acceptable size and power consumption may be much lower than that of a supercomputer. Therefore, when designing a ray tracing system, there may be a trade-off between performance, power consumption, and area. Depending on how this trade-off is implemented, the examples described herein may allow for improved performance without significantly increasing power consumption and area (compared to the prior art described above in the background section). Alternatively, in different implementations of the trade-off, the examples described herein may allow for reduced power consumption and / or size of the ray tracing system without significantly reducing the performance of the ray tracing system (compared to the prior art described above in the background section). Different implementations may be designed to target different points in the trade-off between performance, power consumption, and silicon area.
[0073] As described above, testing a ray for intersection with an axis-aligned bounding box (AABB) corresponding to a node of an acceleration structure is an extremely frequent operation in a ray tracing system. Specifically, intersection testing of a ray with a bounding volume (i.e., determining whether a ray intersects an axis-aligned box) is typically considered the majority of intersection tests performed to render a scene image using ray tracing. Therefore, any optimizations that can be made to the manner in which intersection testing is performed can be very useful in optimizing a ray tracing system in terms of reducing latency, power consumption, and physical size of the ray tracing system.
[0074] In the two examples given in the background section, six tests (plus the minimum and maximum distance tests) are performed to determine whether a ray intersects an axis-aligned box. However, according to the examples described herein, the number of tests that need to be performed to determine whether a ray intersects an axis-aligned box is reduced. Specifically, in the following example where the box is described as a center position and three half-widths, the number of tests is reduced to three (plus the minimum and maximum distance tests). In addition, in the examples described herein, some components of the basis vectors are zero when expressed in a spatial coordinate system. In addition, the ray can be rescaled so that the largest component of the ray direction vector has a unit magnitude. Since the scale value is either 1.0 or 0.0, choosing a ray coordinate system and rescaling the ray in the examples described herein can make two-thirds of the tests mathematically cheaper. This can be achieved by performing a small amount of pre-computation that is constant for the ray, and thus the cost of performing this pre-computation can be reduced because the pre-computation is performed once for the ray and then can be used in many intersection tests involving the ray. For example, in the case where the ray direction vector D has a component D x , Dy and D z In this case, the light can be pre-calculated and stored and The value of (or and As described in more detail below, the axes may be swapped (eg, permuted) to ensure that D z is the principal component of the light direction vector, i.e. |D z |≥|D x | and |D z |≥|D y |. Since any valid ray direction vector has non-zero magnitude, this means that |D z |>0. As another example, the ray's and The value of (or and The value of x and D y is non-zero, or if D x or D y is zero, then by using the concept of signed infinity as defined, for example, in the IEEE floating point format. In some instances, zero values may be replaced with non-zero values that are small enough to behave like zero in the operations described herein, and / or infinite values may be replaced with finite values that are large enough to behave like infinity in the operations described herein, and these examples make it unnecessary to treat some zeros and infinities as special cases and also avoid at least some ambiguous results that may result from multiplying or dividing by zero or infinity. Note that and The value of (or and As another example, the values of the light rays can be pre-calculated and stored. For the box test, we may only need the symbol D z , so in some examples, only the symbol D may be stored z For use in box testing, rather than storing D z or After these values have been pre-calculated, they can be used to perform intersection tests on the light. Pre-calculated values can be used for multiple intersection tests that can be performed in parallel. In some examples, the pre-calculated values are stored so that they can be read, rather than calculated for performing intersection tests on the light. The examples described herein exploit the symmetry of the test to efficiently perform two tests at the cost of one test, so that six tests (as in the prior art) can be reduced to three tests to determine whether the light intersects the axis-aligned box. In addition, selecting a light coordinate system so that some of its coordinates are 0 (and in some examples, rescaling the light so that some of the coordinates of the light coordinate system are 1) makes the processing of the light easier to implement. By reducing the number of tests that need to be performed to determine whether the light intersects the axis-aligned box and / or simplifying the processing of the light to determine whether the light intersects the box, the delay, size and / or power consumption of the intersection test module in the ray tracing system can be reduced.
[0075] Figure 1A ray tracing system 100 is shown that includes a ray tracing unit 102 and a memory 104. The ray tracing unit 102 includes a processing module 106, an intersection testing module 108, and processing logic 110. The intersection testing module 108 includes one or more box intersection testing units 112, one or more triangle intersection testing units 114, a ray rescaling unit 116, and an example transformation unit 118. It should be noted that there may be more than one ray rescaling unit and / or more than one example transformation unit. In operation, the ray tracing unit 102 receives geometric data defining objects within a 3D scene. The ray tracing unit 102 also receives ray data defining rays to be tested for intersection. The rays may be primary rays or secondary rays. The processing module 106 is configured to generate an acceleration structure based on the geometric data and send the acceleration structure to the memory 104 for storage therein. After the acceleration structure has been stored in the memory 104, the intersection test module 108 can retrieve the nodes of the acceleration structure (including the data defining the axis-aligned boxes corresponding to the nodes) from the memory 104 to perform ray intersection tests for the retrieved nodes. To avoid reading the entire acceleration structure at once, the intersection test module 108 retrieves a subset of boxes from one layer of the acceleration structure from the memory 104 at each stage based on the results of the previous intersection test. The box intersection test unit 112 performs intersection tests to determine whether the ray intersects with each of the bounding boxes corresponding to the nodes of the acceleration structure (where a miss can cull large pieces of the hierarchical acceleration structure). If the leaf node is determined to be intersected, the triangle intersection test unit 114 performs one or more triangle intersection tests to determine which object(s) (if any) the ray intersects with. The result of the intersection test indicates which object in the scene the ray intersected, and the result may also indicate the location on the object where the ray intersected the object, (e.g., barycentric coordinates), and may also indicate the distance along the ray at which the intersection occurred, and may also indicate the perceived orientation of the object from the perspective of the ray (e.g., clockwise / counterclockwise or front / back). In some cases, the intersection determination may be based on whether the distance along the ray at which the intersection occurred is between the minimum clipping distance and the maximum clipping distance (t min With t max ). In some cases, the intersection determination may be based on the perceived orientation of the object (e.g., for backface culling). The result of the intersection test is provided to the processing logic 110. The processing logic 110 is configured to process the result of the intersection test to determine a rendering value for an image representing the 3D scene. The rendering value determined by the processing logic 110 may be transferred back to the memory 104 to be stored therein to represent the image of the 3D scene.
[0076] In the two prior art methods mentioned above in the background section, when performing an intersection test of a ray with an axis-aligned box, the ray is defined in terms of components in a spatial coordinate system in which the axis-aligned box is defined. However, in the examples described herein, a ray coordinate system is derived with respect to the ray itself, and the box can be mapped onto the ray coordinate system. The term "spatial coordinate system" is used herein to refer to a coordinate system in which an axis-aligned box is defined, and in which the edges of the box are aligned with the basis vectors of the axes defining the coordinate system. The "spatial coordinate system" can be a world space coordinate system or an instance space coordinate system. In most of the examples described herein, the spatial coordinate system is a three-dimensional coordinate system, and the box is a three-dimensional axis-aligned box.
[0077] The term "ray coordinate system" is used herein to refer to a coordinate system that is specific to a ray and has its origin at the ray origin. It should be noted that in the examples described in detail herein, the origin of the ray coordinate system is the origin of the ray, but in other examples, the origin of the ray coordinate system can be adjusted by appropriately adjusting the minimum and maximum clipping distances (t min and t max ), any point along the light ray can be used as the origin of the light ray coordinate system. The light ray coordinate system has three basis vectors. The first basis vector of the basis vectors is aligned with the direction of the light ray. The second basis vector and the third basis vector of the basis vectors are both orthogonal to the first basis vector and are not parallel to each other. In the examples described herein, the second basis vector and the third basis vector of the light ray coordinate system are generally not orthogonal to each other, but in some examples, they may be orthogonal to each other. In addition, in the examples described herein, when expressed in the spatial coordinate system, the second basis vector and the third basis vector of the light ray coordinate system have zero as a component. In some examples, when expressed in the spatial coordinate system, the second basis vector and the third basis vector of the basis vector of the light ray coordinate system have a value of ±1 (i.e., a magnitude of 1) for one component.
[0078] In the examples described herein, intersection test module 108 uses a ray coordinate system to perform an intersection test to determine whether a ray intersects a box, where a box is an axis-aligned box in a spatial coordinate system. The result of performing the intersection test on the ray is output from intersection test module 108 for use by a ray tracing system, such as for determining which shader program to execute for the ray by processing logic 110.
[0079] The intersection test is performed using a ray coordinate system by translating one or more position vectors defining the position of the box by subtracting the ray origin from the one or more position vectors defining the position of the box. In one example, the position of the box is defined by: (i) a first position vector that defines a point with a minimum component value of the box in each of the three dimensions of the spatial coordinate system, and (ii) a second position vector that defines a point with a maximum component value of the box in each of the three dimensions of the spatial coordinate system. In another example, the position of the box is defined by a position vector that defines the center point of the box in the spatial coordinate system. The size of the box in each dimension can be defined by the width or half-width of each dimension in the spatial coordinate system. Subtracting the ray origin from the position vector defining the position of the box means that the position of the box is then defined relative to the ray origin. By first shifting the position of the box using the ray origin, all relative errors in downstream calculations are centered on the ray origin. Assuming that this is also true for the triangle tester, this makes it easier to ensure conservatism (i.e., no false negatives).
[0080] Figure 2 A ray 202 and a frame 204 are shown. As described above, the ray 202, r(t), can be represented as r(t)=O+Dt, where O is a vector representing the origin of the ray and D is a direction vector of the ray, where O=(O x ,O y ,O z ) and D=(D x ,D y ,D z ). The x, y, and z basis vectors of the spatial coordinate system are Figure 2 . Box 204 is an axis-aligned box relative to the x, y, and z basis vectors of a spatial coordinate system. As described above, the spatial coordinate system may be the world space coordinate system of the scene being rendered, or the spatial coordinate system may be an instance space coordinate system of a set of example geometric shapes within the scene being rendered. The origin of the ray coordinate system used in the intersection test is the origin of the ray. The position vector defining box 204 is translated by subtracting the ray origin from the position vector.
[0081] Additionally, in some examples described herein, the x, y, and z components of the ray and axis-aligned box are selectively permuted and / or inverted so that before performing the intersection test, D z ≥D x ≥0 and D z ≥D y ≥0 (Note that in these examples, D must also be present for the effective ray direction z > 0). The axes may be optionally inverted so that the light direction vector will point into an octant of the spatial coordinate system that has positive values for x, y, and z, and the axes may be optionally permuted so that D zwill be the principal component of the light direction, i.e. |D z |≥|D x | and |D z |≥|D y |.
[0082] Figure 2 shows the relationship of the ray 202 and the box 204 with respect to the basis vectors after a translation and optional displacement of the axes of the ray and the box has been performed so that the origin of the ray is at the origin of the coordinate system and so that |D z |≥
[0083] |D x | and |D z |≥|D y |. This ensures that D z Non-zero, because effective light cannot make D x =D y =D z =0.
[0084] The basis vectors of the light coordinate system are Figure 2 In the figure, they are represented as P, Q and S. The first basis vector S of the light coordinate system is set to be along the direction of the light, S = A (D x ,D y ,D z ), where A is a scalar value. In some examples, Make
[0085] As an example (hereinafter referred to as “first example”), the second basis vector and the third basis vector P and Q may be defined as and More generally, if Figure 2 As shown in the example in, P = B (D z ,0,-D x ) and Q=C(0,D z ,-D y ), where B and C are any non-zero scalar values. To give some other examples, B can be ±sgn(D z ) or ±sgn(D x ) or any product of these nonzero scalar values, for example, and C can be ±1, or
[0086] ±sgn(D z ), or ±sgn(D y ), or any product of these nonzero scalar values, such as Note that for non-zero values α, if α is positive, then sgn(α) = +1, and if α is negative, then sgn(α) = -1. If α = 0, then sgn(α) can be +1 or -1, depending on the sign bit of the floating-point representation of α. Note that the standard floating-point representation allows both +0 and -0 to be represented separately, and that unsigned 0 is typically identified as +0. In other words, if the adopted base distinguishes between -0 and +0 (as is the case with the IEEE floating-point system), then as an example, sgn(+0) = +1 and sgn(-0) = -1, otherwise sgn(0) = 1. The set of common values of A can be the union of the sets of common values of B and C. Note that S is orthogonal to P and Q, as can be seen from PS = QS = 0. However, according to D x and D y For example, unless D x or D y is zero, otherwise P and Q will not be orthogonal to each other. As mentioned above, P and Q are not parallel to each other, for example, P and Q are parallel to each other at least far enough so as not to cause problems due to rounding losses, otherwise the system may degenerate into a 1D scene. Note that D z cannot be zero, because the selective permutation of the axes makes D z is the principal component of the light direction, and since a valid light direction vector must have a non-zero magnitude in order to define a line. Therefore, among the possible components of the light basis vectors P and Q, and The value of is always well-defined and has a magnitude ranging from zero to an inclusive value, while and The value of has a magnitude ranging from one to positive infinity, inclusive.
[0087] The choice of scalar values A, B, and C may affect the handedness of the system. Figure 2 In , the world (or instance) space axes form a left-handed system. If we order the ray space axes as (X', Y', Z') = (P, Q, S), then they form a system with the same handedness (if and only if the principal axis is positive). Each scalar value (from the scalar values A, B, and C) that is negative flips the handedness of the system, e.g. from left-handed to right-handed. If an even number of scalar values A, B, and C are negative, then they cancel and we are back to a left-handed system.
[0088] In another example (not shown in the figure, hereinafter referred to as the “second example”), the second and third basis vectors P and Q are defined as and In this example ( Figure 2 not shown),
[0089] In general, these two examples can be described as the second basis vector P, which is defined as Right now or and the third basis vector Q, which is defined as Right now or
[0090] In another example (not shown in the drawings, hereinafter referred to as the "third example"), and For example, the second basis vector P can be defined as Right now or And the third basis vector Q can be defined as Right now or Notice, and
[0091] In another example (not shown in the figure, hereinafter referred to as the "fourth example"), B = ±1 and C = ±1. For example, the second basis vector P can be defined as That is, P = (+D z ,0,-D x ) or P=(-D z ,0,+D x ), and the third basis vector Q can be defined as That is, Q=(0,+D z ,-D y ) or Q=(0,-D z ,+D y ).
[0092] In another example (not shown in the drawings, hereinafter referred to as the "fifth example"), and For example, the second basis vector P can be defined as Right now or And the third basis vector Q can be defined as Right now or
[0093] In another example (not shown in the figure and hereinafter referred to as the "sixth example"), and Therefore, the second basis vector P can be defined as Right now or And the third basis vector Q can be defined as Right now or Due to D z is the principal component of the light direction vector, so D x or D y can be zero. Therefore, in these examples, when processing and In one approach, D x or D y The values of may be perturbed by some small amount so that they are never exactly zero. For example, a zero value may be replaced with a non-zero value that is small enough to behave like zero in the operations described herein.
[0094] In another example (not shown in the figure and hereinafter referred to as the "seventh example"), and Therefore, the second basis vector P can be defined as Right now or And the third basis vector Q can be defined as Right now or Due to D z is the principal component of the light direction vector, so D x or D y can be zero. Therefore, in these examples, when processing and As mentioned above, in one approach, D x or D y The values of may be perturbed by some small amount so that they are never exactly zero. For example, a zero value may be replaced with a non-zero value that is small enough to behave like zero in the operations described herein.
[0095] The example basis vectors given in the second, third, fourth and fifth examples above all have consistent handedness, while the handedness of the basis vectors given in the sixth and seventh examples above may have consistent or opposite handedness, depending on D x and D y symbol.
[0096] In another example (not shown), B = ±sgn(D z ) and C = ±sgn(D z). For example, the second basis vector P can be defined as That is, P = (+ | D z |,0,-sgn(D z )D x ) or P=(-|D z |,0,+sgn(D z )D x ), and the third basis vector Q can be defined as That is, Q=(0,+|D z |,-sgn(D z )D y ) or Q=(0,-|D z |,+sgn(D z )D y ).
[0097] In another example (not shown), B = ±sgn(D x ) and C = ±sgn(D y ). For example, the second basis vector P can be defined as That is, P = (+sgn (D x )D z ,0,-|D x |) or P = (-sgn (D x )D z ,0,+|D x |), and the third basis vector Q can be defined as Q =
[0098] That is Q=(0,+sgn(D y )D z ,-|D y |) or Q=
[0099] (0,-sgn(D y )D z ,+|D y |).
[0100] In all of these examples: (i) S is orthogonal to P and Q, (ii) P and Q are not parallel to each other, and (iii) P and Q have zero as a component when expressed in a spatial coordinate system. Furthermore, in some of these examples, P and Q have a value of ±1 as a component when expressed in a spatial coordinate system. Conditions (i) and (ii) together mean that P, Q, and S are always linearly independent. This means that the vectors are also spanning and thus form a basis. The fact that the determinant is never zero for valid (i.e., non-zero) ray directions also proves that the vectors form a non-degenerate basis.
[0101] The "reciprocal basis" is the basis vector P = B (D z,0,-D x ) and Q=C(0,D z ,-D y ), B is and C is In other words, B is a function with D in its denominator. x , and C is a fraction with D in its denominator y For example, the inverse basis can make and Make and As another example, the reciprocal bases can make and Make and One advantage of using a reciprocal basis is that each reciprocal can be evaluated with some precision (usually less precise than comparable floating point operations), and then those evaluations can be treated as if they were exact, essentially perturbing the direction of the ray directions in order to improve the precision of all intersection testers (improving consistency across the board).
[0102] The process of performing an intersection test of a ray with respect to a box (e.g., an axis-aligned box) may involve dividing a value (e.g., a component value that is constant on a plane defining a face of the axis-aligned box) by a component of the ray direction vector (e.g., D x ,D y or D z ). For example, an indication of the distance of the intersection between the ray and the plane defining the face of the axis-aligned box can be found by determining the value of t at the intersection point (where the ray is defined as r=O+tD) of the ray. As is well known in the art, division is generally a more complex operation to implement than multiplication, and thus division operations tend to be slower and consume more power than corresponding multiplication operations, and hardware configured to perform division operations (e.g., fixed function circuits) tend to be larger (i.e., have a larger silicon area) than hardware configured to perform corresponding multiplication operations. If a reciprocal basis is used, the value (e.g., a component value that is constant on the plane defining the face of the axis-aligned box) is divided by a component of the ray direction vector (e.g., D x ,D y or D z ) involves a multiplication operation (for example, or of or For example, if the axis corresponding to the smallest range of components of a given convex polygon is selected, a multiplication (ratio) is performed instead of a division operation. Therefore, using a reciprocal basis can improve efficiency (e.g., in terms of processing delay, power consumption, and silicon area) compared to using a non-reciprocal basis for the frame intersection test unit 112. It should be noted that calculating ray components in a reciprocal basis can be more complex than calculating ray components in a non-reciprocal basis. However, the reciprocal ray components can be calculated once, and then the frame intersection test unit 112 can use the calculated reciprocal ray components many times (e.g., hundreds of times), so the cost of calculating the reciprocal ray components is amortized by many intersection tests involving rays. Therefore, using a reciprocal basis can often improve the efficiency of the intersection test module 108 (e.g., in terms of processing delay, power consumption, and silicon area) compared to using a non-reciprocal basis.
[0103] It may also be beneficial to use a reciprocal basis in the triangle intersection test unit 114, since this allows for greater flexibility in how the intersection distance is calculated (if desired). In particular, if the intersection point (relative to the ray basis coordinate system) is determined, for example, by barycentric interpolation (p x ,p y ,p z ), then the intersection parameter t can optionally be computed as a component of , which can provide excellent error characteristics. This is in contrast to a non-reciprocal basis because the inverse of the ray is performed without increasing the storage for each ray. and Precomputing these additional terms may also sacrifice some consistency in the ray definition, since the computed inverse cannot usually be considered exact.
[0104] Using a ray coordinate system with basis vectors as described in the above examples can simplify some of the processing involved in intersection testing. Specifically, if a basis vector has zero as a component value, then multiplication and / or addition operations involving the basis vector (e.g., as used to perform a dot product or a cross product) will not include multiplication and / or addition operations for components that are zero, thereby reducing the number and / or complexity of operations that need to be performed. Similarly, if a basis vector has ±1 as a component value, then multiplication and / or addition operations involving the basis vector (e.g., as used to perform a dot product or a cross product) will not include multiplication operations for components that are ±1, thereby reducing the number and / or complexity of operations that need to be performed. Reducing the number of operations performed tends to reduce the delay and power consumption of the intersection test module 108, and in addition, reducing the complexity of the operations performed tends to improve accuracy. In addition, when the intersection test module 108 is implemented in a fixed-function circuit system, then reducing the number and / or complexity of operations performed tends to reduce the size (i.e., silicon area) of the intersection test module 108. For example, the fixed function circuit system may include one or more multiplication and addition components (e.g., a fused single rounding multiplication and addition unit) to perform multiplication and addition using the second basis vector and the third basis vector of the ray coordinate system. In a single rounding floating point implementation (i.e., rounding is applied to the accurate final result to ensure that the output can represent the value), this is more accurate and generally smaller in area than the product and sum of multiplication rounding (both products and sums). Its area can even be comparable to a multiplication rounding implementation with lower accuracy, which is unlikely to occur for more complex operations. There is no associativity between floating point addition and multiplication operations (unlike the real numbers that approximate them). The reduction operation reduces the possible sorting, so there may be other benefits in terms of result consistency.
[0105] In the main example described in this article, the ray data of the light has n=3 coefficients. However, in other examples, the ray data may have more than three coefficients. The construction of the described ray coordinate system can be applied to any dimension n≥2. For example, n basis vectors of the ray coordinate system can be defined, where the first basis vector of the basis vectors of the ray coordinate system is aligned with the ray direction, and there are (n-1) other basis vectors that are orthogonal to the first basis vector. If n>2, no pairs of vectors in the (n-1) other basis vectors are parallel. In addition, when expressed in a spatial coordinate system, the (n-1) other basis vectors have zeros for (n-2) components. The n basis vectors of the ray coordinate system form the basis of an n-dimensional space (the basis vectors are linearly independent and therefore spanning). For example, in four-dimensional space, the ray direction vector may be D=(D w ,D x ,D y ,D z ), and the four basis vectors of the light coordinate system can be: S = A (D w ,Dx ,D y ,D z ),P=B(D z ,0,0,-D w ) and Q=C(0,D z ,0,-D x ),R=
[0106] D(0,0,D z ,-D y ), where in this example the selective permutation of the axes ensures that D z is the principal component of the light direction vector, i.e. |D z |≥|D w |,|D z |≥|D x | and |D z |≥|D y |. In this example, A, B, C, and D are non-zero scalars, and they may be selected so that one of the coefficients is unified, e.g., as described above with respect to the three-dimensional example. In this example, the four dimensions may correspond to three spatial dimensions and one temporal dimension.
[0107] Returning to the 3D case, in some examples, the ray and the box are transformed from the space coordinate system into the ray coordinate system, where the intersection test is performed in the ray coordinate system. The test in the ray coordinate system can be performed by determining whether the ray intersects the volume defined by the edge of the box defined in the ray coordinate system. However, in some other examples, the ray and the box do not need to be fully transformed into the ray coordinate system. In these other examples, for example, as described below with reference to Figure 3 In the example described by the flowchart of , the intersection test is performed using the ray coordinate system without fully transforming the box into the ray coordinate system, that is, without determining the s, p, and q components of the box along the S, P, and Q axes of the ray coordinate system. It should be noted that defining a ray in the ray coordinate system is simple because the origin of the ray is at the origin of the ray coordinate system and the direction of the ray is parallel to the S axis, so that the components of the ray along the P and Q axes of the ray coordinate system have zero values.
[0108] In the above example, the axes are selectively permuted to ensure that D z are the principal components of the light direction vector. Furthermore, the axes can be optionally inverted (or "reflected") to ensure that all components of the light direction vector are non-negative, i.e. D z >0,D x ≥0 and D y ≥ 0. The selective inversion of the axes makes the light direction vector point to an octant of the spatial coordinate system with positive values for x, y, and z. z are the principal components of the light direction vector, which means and is in the range of 0 to 1 and means and In the interval from 1 to positive infinity. On axis D z ≥D x ≥0 and D z ≥D y ≥0 after selective substitution and selective inversion.
[0109] Figure 3 is a flow chart of a method of performing an intersection test to determine whether a ray 202 intersects a 3D axis-aligned box 204 .
[0110] In step S302, data defining the light 202 and the frame 204 is obtained at the intersection test module 108. Specifically, data defining the light origin and the components of the light direction in the spatial coordinate system are obtained. The data defining the light origin may be three components of the light origin position in the spatial coordinate system. x , O y and O z .exist Figure 3 In the example shown, the data defining the direction of the light includes three components D of the light direction in the spatial coordinate system: x , D y and D z Alternatively, as described above, some different values defining the light direction may have been pre-calculated and stored in the memory, so that the pre-calculated values can be read in step S302. For example, three values may be read to define the light direction data, and these three values may be and In other examples, different pre-computed values can be read to define the ray direction, for example and D z As another example, you can read and As another example, you can read and In other examples, other values that can be used to define the direction of the light can be pre-calculated and read. Note that the box test process described herein performed by the (one or more) box intersection test unit 112 can use and sgn(D z ) without determining the value of D z or The triangle intersection test process performed by the triangle intersection test unit (s) 114 can determine D z or The value of .
[0111] In reference Figure 3 In the described example, the x, y and z components defining the center position of the frame in each of the three dimensions of the spatial coordinate system and the half width (H) of the frame are read in step S302. x ,H y and H z ) data.
[0112] In step S304, the intersection test module 108 subtracts the corresponding component of the ray origin from the corresponding component of the read data at the position of the center of the definition box ( x ,O y and O z ), thereby determining the component of the position of the center of the box relative to the origin of the light (C x ,C y and C z ). Figure 2 A frame 204 is shown, where the component C of the frame center position is (C x ,C y ,C z ) is relative to the ray origin, and the half-width of the box in each of the x, y, and z dimensions of the spatial coordinate system is given by H = (H x ,H y ,H z ) is given.
[0113] In step S306, the intersection test module 108 (eg, the ray rescaling unit 116) selectively permutes and / or inverts the x, y, and z components of the data defining the ray and the box so that D z ≥D x ≥0 and D z ≥D y ≥0. The permutation of the axes can be thought of as rearranging the axes. Specifically, the permutation of the axes includes rotation of three axes, transposition of two axes, or identity (i.e., without changing the axes). It should be noted that a permutation involving transposition of two axes will change the handedness of the coordinate system, while a permutation not involving transposition of two axes will not change the handedness of the coordinate system. The permutation of the axes is performed so that the principal component of the ray direction is D z (That is, make sure |D z |≥|D x | and |D z |≥|D y|). For example, if the original z component of the light direction vector has a larger magnitude than the original x and y components of the light direction vector, no permutation is used (which can be considered as a permutation using an identity operation); if the original x component of the light direction vector has a larger magnitude than the original y and z components of the light direction vector, the permutation may include a rotation of three axes such that the x component becomes the z component, the z component becomes the y component, and the y component becomes the x component; and if the original y component of the light direction vector has a larger magnitude than the original x and z components of the light direction vector, the permutation includes a transposition of the y and z axes such that the y component becomes the z component, and the z component becomes the y component (and the x component remains the x component). Selective permutation may be performed only in step S306 (i.e., selective inversion is not performed), but in reference to Figure 3 In the described method, selective inversion of the zero axis, one or more axes is performed so that the ray direction enters an octant with positive x, y, and z. "Inversion" of an axis may be referred to as "reflection", "reversal", or "negation", and may involve changing the sign of all component values along the axis in question in a dimension. The data defining the ray includes the ray origin and the ray direction, and the data defining the box includes the box center position relative to the ray origin and the box half-width in each dimension. It should be noted that inverting an odd number of axes will invert the perceived orientation of the geometric shape.
[0114] The position of any point in the box relative to the ray origin is given by:
[0115]
[0116] In step S308, the intersection test module 108 (specifically, the frame intersection test unit 112) determines whether three conditions are met. Specifically, step S308 includes determining whether a first condition is met, wherein the first condition is or equals Step S308 further includes determining whether a second condition is satisfied, wherein the second condition is or equals Step S308 further includes determining whether a third condition is satisfied, wherein the third condition is or equals Note that finding the magnitude of a value represented in a floating point format can be performed essentially free (i.e., with little or no latency or power consumption) because the magnitude of a floating point number is found by simply ignoring the sign bit of the floating point number. Therefore, determining the magnitude of the values on the left hand side of the three comparisons is easy to implement in hardware. It can also be noted that the values on the right hand side are all non-negative, and a custom floating point addition operation can take advantage of this to reduce implementation cost. Furthermore, note that these magnitudes on the left hand side of the comparisons are not negative, and note that the expressions on the right hand side of the comparisons are also not negative because D x ,D y ,D z,H x ,H y and H y Comparing two floating point values that are known to be both non-negative is cheaper to implement in hardware (e.g., it may be implemented in hardware with less silicon area and / or with lower latency and / or lower power consumption) than the more general comparison of two floating point numbers where the numbers may be negative or positive.
[0117] The "equivalent" conditions may be mathematically equivalent (i.e., mathematically identical) and / or substantially equivalent (i.e., will provide the same results depending on the precision of the intersection test module, even if they are not mathematically completely equivalent). Examples of conditions that are equivalent (specifically, mathematically equivalent) to the first condition are
[0118] If all three conditions are met, then an infinitely long line aligned with the ray (e.g., a line defined by the ray direction vector) will intersect the box. If any of the three conditions are not met, the method proceeds to step S314, in which the intersection test module 108 determines that the ray does not intersect the box. It should be noted that according to this method, at most only three conditions need to be tested (rather than six as in the prior art) in order to determine whether an infinitely long line aligned with the ray will intersect the box. Therefore, the number of calculations that need to be performed in the intersection test module is reduced compared to the prior art method described above in the background section. As mentioned above, the ray coordinate system is used to provide symmetry in the calculations performed, so that the number of calculations that need to be performed is reduced by half, i.e., from six to three. In some examples (e.g., where the box intersection test unit 112 is implemented in hardware, such as in a fixed function circuit system), the three comparisons can be performed independently, such as in parallel, wherein if any one or more of the three comparisons are not met, it is determined that the ray 'misses' relative to the box. In other examples (e.g., where the box intersection test unit 112 is implemented in software, such as a module of computer code executed on a processing unit), the three comparisons may be performed in sequence, with the second condition being checked only if the first condition is met, and the third condition being checked only if both the first and second conditions are met. If any one or more of the three comparisons are not met, then the ray is determined to have missed relative to the box, but this second approach allows for a miss to be determined without having to perform all three comparisons if either the first or second comparisons are not met.
[0119] Now refer to Figure 2The illustrated ray 202 and box 204 provide an explanation of why these three conditions can be used to determine whether a ray intersects a box. A ray coordinate system is used, and as described above, the first basis vector (S) is aligned with the direction of the ray, and the second and third basis vectors (P and Q) are both orthogonal to the first basis vector (S). In addition, the origin of the ray coordinate system is located at the origin of the ray. Therefore, any vector from the origin to any point on the ray path must be orthogonal to the second and third basis vectors (P and Q). The ray can only intersect the box if the point on the ray is also a point in the box. Therefore, the ray can only intersect the box if the vector from the origin to the point in the box is both orthogonal to the second and third basis vectors (P and Q). If two vectors are orthogonal to each other, their dot product is zero. The above equation (1) defines the point in the box. In this example, the ray coordinate system is determined. The second basis vector and the light coordinate system The third basis vector of .
[0120] Therefore, a ray can intersect a box only if:
[0121]
[0122] For any values of i, j and k, such that |i|≤1, |j|≤1 and |k|≤1.
[0123] Expanding formula (2), we get:
[0124] and
[0125]
[0126] Solving these equations for i and j yields:
[0127]
[0128] For any solution that lies in the box, we know that -1≤i≤1 and -1≤j≤1, so this leads to:
[0129]
[0130] These inequalities give four bounds on k, which are denoted as k ilower ,k iupper ,k jlower and k jupper :
[0131]
[0132]
[0133] The solution for different bounds on k gives:
[0134]
[0135] Since the axes are selectively rearranged and / or reflected in step S306, it is known that D x ,D y and D z are all positive. Half width H x ,H y and H z are also positive. Therefore, from the above equation we can see that k ilower ≤k iupper and k jlower ≤k jupper .
[0136] For any point in the box -1≤k≤1, the following four conditions must be satisfied:
[0137] k ilower ≤1
[0138] -1≤k iupper
[0139] k jlower ≤1
[0140] -1≤k jupper
[0141] Substituting these conditions into the above given ilower ,k iupper ,k jlower and k jupper In the formula, we get:
[0142]
[0143] By understanding the symmetry of these four inequalities, we can see that these four conditions are reduced to two conditions:
[0144]
[0145] These conditions are the first two conditions checked in step S308.
[0146] To derive the third condition, note that the solution for k must satisfy:
[0147] k ilower ≤k≤k iupper
[0148] k jlower ≤k≤k jupper
[0149] And in order to get a valid solution for k, the ranges must overlap, so
[0150] k ilower ≤k jupper
[0151] k jlower ≤k iupper
[0152] We can expand this to give:
[0153]
[0154] Then, we can use ilower ,k iupper ,k jlower and k jupper Substitute the expressions in brackets into the given equation to get:
[0155]
[0156] Expanding and rearranging these inequalities yields:
[0157]
[0158] By understanding the symmetry of these two inequalities, it can be seen that the conditions are reduced to one condition:
[0159]
[0160] This is the third condition checked in step S308.
[0161] So, summarizing the math given above, in order for a ray to intersect a box, the following three conditions must be met:
[0162]
[0163] This is the condition checked by the frame intersection test unit 112 in step S308 .
[0164] Pre-calculated light and 's values and stores them instead of calculating them each time an intersection test is performed on a ray. Reading the pre-computed and The process of calculating the values is simple; in particular, it is simpler than performing a division operation each time one of these values is needed. For example, these values can be obtained in step S302. In step S304, C can be easily calculated by subtracting the world space component of the box center read in step S302 from the corresponding component of the ray origin. x ,Cy and C z The half width H x ,H y and H z The three comparisons of step S308 are also easily obtained, for example, they can be read in step S302. Therefore, the three comparisons of step S308 are easily implemented in the intersection test module 108. Specifically, each of the operations performed in step S308 only includes some multiplication and addition operations and comparison operations. The multiplication and addition operations can be implemented using a small fixed-function circuit system with extremely low latency and low power consumption in the block intersection test unit 112, for example, by using a fused multiplication and addition unit.
[0165] The determination of whether the first condition, the second condition, and the third condition are satisfied is used to determine whether the ray 202 intersects the axis-aligned frame 204. Specifically, as mentioned above, if it is determined that at least one of the first condition, the second condition, and the third condition is not satisfied, the method proceeds from step S308 to step S314, where it is determined that the ray misses the frame (i.e., the ray does not intersect the frame). If it is determined in step S308 that all three conditions are satisfied, the method proceeds to step S310.
[0166] In step S310, the intersection test module 108 (specifically, the box intersection test unit 112) determines whether the minimum distance condition and the maximum distance condition are satisfied. The minimum distance condition is satisfied if the minimum distance of the ray from the ray origin is less than or equal to the maximum distance from the ray origin to the intersection of the ray direction vector and the box. In other words, if the starting point of the ray (given by the value t min definition) does not exceed the box, the minimum distance condition is met. Figure 4a An example is shown where the intersection test module 108 determines whether the ray 402 intersects the box 404. In step S308, it will be determined that all three conditions are met because the dashed line representing the ray direction vector from the origin intersects the box 404. Specifically, the closest intersection of the ray direction vector with the box 404 is at point 406, and the farthest intersection of the ray direction vector with the box 404 is at point 408. In some examples, t min = 0, so that the minimum distance from the light ray to the origin is zero, but Figure 4a In the example shown, t min ≠0. It is worth noting that due to the selective permutation and inversion of the x, y and z components of the light and the box in step S306, the direction vector of the light will be in the positive octant, that is, D x ≥0,D y ≥0, and D z ≥0. Figure 4aIn the example shown, the minimum distance of the ray from the ray origin 410 is greater than the maximum distance from the ray origin to the intersection of the ray direction vector with the box at point 408. Therefore, in this example, in step S310, it will be determined that the minimum distance condition is not satisfied. As will become apparent after the following description of the maximum distance condition, it should be noted that in Figure 4a In the example shown, the maximum distance condition is satisfied because the maximum distance of the ray from the ray origin at point 412 is greater than the minimum distance from the ray origin to the intersection of the ray direction vector with the box at point 406 .
[0167] The maximum distance condition is satisfied if the maximum distance of the ray from the ray origin is greater than or equal to the minimum distance from the ray origin to the intersection of the ray direction vector and the box. In other words, if the end of the ray (given by the value t max Definition) is not in front of the box, the maximum distance condition is met. Figure 4b An example is shown where the intersection test module 108 determines whether the ray 422 intersects the frame 424. In step S308, it will be determined that all three conditions are met because the dashed line representing the ray direction vector from the origin intersects the frame 424. Specifically, the closest intersection of the ray direction vector with the frame 424 is at point 426, and the farthest intersection of the ray direction vector with the frame 424 is at point 428. Figure 4b In the example shown, the maximum distance of the ray from the ray origin 432 is less than the minimum distance from the ray origin to the intersection of the ray direction vector with the box at point 426. Therefore, in this example, in step S310, it will be determined that the maximum distance condition is not satisfied. Figure 4b The minimum distance condition is satisfied in the example shown because the minimum distance of the ray from the ray origin at point 430 is less than the maximum distance from the ray origin to the intersection of the ray direction vector with the box at point 428 .
[0168] Figure 4c An example is shown where the intersection test module 108 determines whether ray 442 intersects box 444. In step S308, it will be determined that all three conditions are met because the dashed line representing the ray direction vector from the origin intersects box 444. Specifically, the closest intersection of the ray direction vector with box 444 is at point 446, and the farthest intersection of the ray direction vector with box 424 is at point 448. Figure 4c In the example shown, the minimum distance condition is satisfied because the minimum distance of the ray from the ray origin at point 450 is less than the maximum distance from the ray origin to the intersection of the ray direction vector with the box at point 448. Figure 4c In the example shown, the maximum distance condition is satisfied because the maximum distance of the ray from the ray origin at point 452 is greater than the minimum distance from the ray origin to the intersection of the ray direction vector with the box at point 446 .
[0169] An example method for performing minimum and maximum distance culling in step S310 is now described. min and t max , the central t value (t c ) and half-width t value (t h ) is precomputed as:
[0170]
[0171] For brevity, we extend the ≤ (and similarly ≥) binary operators to 3D as…
[0172]
[0173] …and similarly, define the vector, piecewise absolute value operator for
[0174]
[0175] The minimum and maximum distance conditions are met only when:
[0176]
[0177] It is possible to precompute t for rays used for multiple box tests c .D and t h .D vector value. It is worth noting that in this embodiment, both the minimum distance and maximum distance conditions are tested by a single comparison in step S310, where the single comparison is In other words, the step S310 of determining whether the minimum distance and maximum distance conditions are met includes determining whether a single distance condition is met, wherein determining that the single distance condition is met indicates that both the minimum distance condition and the maximum distance condition are met. Again, the symmetry of the conditions is used to reduce the two conditions (the minimum and maximum distance conditions) to a single condition that needs to be met. In other examples, the minimum and maximum distance conditions are tested with separate comparisons in step S310.
[0178] The above results can be shown as follows. In order to meet the minimum and maximum distance conditions, corresponding to t on the ray min The point must not be behind the box, that is
[0179] t min .D≤C+H
[0180] And similarly, t max Not in front, that is
[0181] t max .D≥CH
[0182] This means
[0183]
[0184] and
[0185]
[0186] These together mean
[0187]
[0188] The determination of whether the minimum distance condition and the maximum distance condition are satisfied in step S310 is used to determine whether the ray intersects the axis-aligned box. If one or both of the minimum distance condition and the maximum distance condition are not satisfied (e.g., Figure 4a and Figure 4b ), the method proceeds from step S310 to step S314, in which the intersection test module 108 (specifically, the box intersection test unit 112) determines that the ray does not intersect the box. However, if both the minimum distance condition and the maximum distance condition are met (e.g., Figure 4c ), the method proceeds from step S310 to step S312, in which the intersection test module 108 (specifically, the frame intersection test unit 112) determines whether the ray intersects the frame. It should be noted that in order to achieve step S312, that is, in order for the intersection test module to determine that the ray intersects the axis-aligned frame, it is determined that all of the first conditions, the second conditions, the third conditions, the maximum distance conditions, and the minimum distance conditions are satisfied in steps S308 and S310. In the example described herein, the three conditions of step S308 and the condition of step S310 are the only conditions for determining whether the ray intersects the frame. Note that the minimum distance and maximum distance conditions of step S310 can be reduced to a single distance condition as described above (e.g. ). In addition, it should be noted that steps S308 and S310 may be performed in parallel or sequentially in different implementations.
[0189] After step S312 and / or S314, the method proceeds to step S316, in which the intersection test module 108 outputs an indication of the result of determining whether the ray intersects the box. This indication can be a binary indication (e.g., a one-bit flag) to indicate a 'hit' or 'miss' of the ray relative to the box. In other examples, the indication can be in a different form. In step S318, the output indication is used in the ray tracing system 100 (e.g., the processing logic 110) to render an image of the 3D scene. For example, the box can define a geometric shape to be rendered in the scene. If the box corresponds to a node of a hierarchical acceleration structure to be used to perform intersection testing in the ray tracing system, the indication of whether the ray intersects the box can be used to determine whether to test the ray for intersection with the box corresponding to any child node in the node corresponding to the intersecting box. For example, if the ray intersects with the box corresponding to the parent node, the ray is tested for intersection with the box corresponding to the child node of the parent node, and if the ray does not intersect with the box corresponding to the parent node, the ray is not tested for intersection with the box corresponding to the child node of the parent node. If the ray intersects the box corresponding to a leaf node of the hierarchical acceleration structure, the ray may be tested for intersection with any geometric shapes (eg, triangles or other primitives) referenced by the leaf node.
[0190] exist Figure 3 In the example shown, data defining the light and the frame are read in step S302, then in step S304, the component of the light origin is subtracted from the data defining the frame position, and then in step S306, the x, y and z components of the light and the frame are selectively displaced and / or inverted so that D z ≥D x ≥0 and D z ≥D y ≥ 0. However, the order of these three steps (steps S302 to S306) may be different in different examples. For example, the x, y, and z components of the light and frame data may be selectively permuted and / or inverted before the data is acquired. It is useful to perform such selective permutation and / or inversion of the x, y, and z components of the light data before reading in the data, so that we know D before reading in the data. z ≥D x ≥0 and D z ≥D y ≥ 0. This allows certain pre-calculations to be performed on the ray data, and the pre-calculated data can be stored in a storage device (e.g., memory on ray tracing unit 102) before being read into intersection test module 108. This means that the processing involved in this pre-calculation can be performed once for a ray, and used multiple times if the ray is involved in multiple intersection tests. As described above, the pre-calculated ray direction data read by the intersection test module can include and D z or The value of and D z or or and D z or The values of are given only to give some examples, and in other examples other values may be pre-calculated and read in order to define the ray direction. If the values of are pre-calculated and stored in a storage device, the intersection test module 108 can simply read these values from the storage device and use them to perform the determination in step S308 without having to calculate these values each time they are needed (for example, without having to perform a division operation).
[0191] Furthermore, in some examples, the component of the ray origin may be subtracted from the component of the center position of the defined box in a pre-processing stage before the intersection test module 108 obtains the data. In these examples, the intersection test module may read C x ,C y and C z The intersection test module 108 can simply read in the H values for performing the determination in step S308 without having to calculate these values (ie, without having to perform the subtraction of step S304). x ,H y and H z values for use in performing the determination in step S308 without first performing any calculations on these values.
[0192] The above describes a method used in a ray tracing system that does not introduce any errors into its calculations. However, some calculations, such as calculations performed using numbers in floating point format, may introduce rounding errors. This is partly because the precision with which floating point numbers can be represented varies for numbers of different magnitudes. The 'step size' between sequential floating point numbers is generally roughly proportional to the magnitude of the floating point value (with some exceptions, such as near zero). In some examples, the frame intersection test unit 112 of the intersection test module 108 is configured to operate conservatively when testing AABBs. Specifically, the comparison for determining whether the three conditions are met in step S308 can be made to operate conservatively. This means that the method may sometimes give a 'false positive' result (i.e., the method may sometimes indicate that the ray intersects the frame even if the ray does not intersect), but the method will not give a 'false negative' result (i.e., the method will not indicate that the ray does not intersect the frame when the ray actually intersects the frame). False positive results do not introduce rendering errors into the ray tracing process because if a ray is determined to intersect a box, the ray will be tested for intersection with another object bounded by the box (e.g., another box corresponding to a child node, or some geometric shape), and thus will ultimately be found not to intersect the other object. False positive results may reduce the efficiency of the intersection testing process due to the increased number of tests performed, but this is acceptable provided that the proportion of positive results that are false positive results (not true results) is low, such as less than 1% or less than 5%, as some examples. Therefore, a small number of false positive results are acceptable in the ray-box intersection testing process. However, 'false negative' results may introduce rendering errors into the ray tracing process because if a ray is determined to miss a box, the ray will not be tested for intersection with another object bounded by the box even though the ray may actually intersect the other object. Rendering errors are generally unacceptable, and therefore false negative results are unacceptable in the ray-box intersection testing process.
[0193] Therefore, in some examples, the determination of whether the first condition, the second condition, and the third condition are satisfied is performed conservatively in step S308, so that in a case where a completely accurate determination would have determined that the conditions were satisfied, any error introduced by rounding during the determination process will not cause a determination that the conditions are not satisfied.
[0194] For example, by determining whether to conservatively perform the determination of whether the first condition is satisfied; to conservatively perform the determination of whether the second condition is satisfied; and to conservatively perform the determination of whether the third condition is satisfied. In these expressions, "roundup" indicates that the expression is rounded toward +∞, and "rounddown" indicates that the multiplication and subtraction operations are appropriately rounded so that the corresponding overall expression is rounded toward -∞. In this example, it is simple to implement "roundup" rounding because all subcomponents are positive, so each calculation (i.e., multiplication or addition) is rounded toward +∞, and this will have the effect of rounding the overall expression toward +∞. However, implementing "rounddown" rounding is not simple because the appropriate rounding to be applied to each calculation in the expression (e.g., each multiplication or addition / subtraction) depends on the relative signs and magnitudes of the values in the expression. In the absence of actual calculation results, the relative signs and magnitudes of the values are not known in advance, so in order to implement "rounddown" rounding, calculations can be performed on the rounded-up and rounded-down results, and then the appropriately rounded results of each calculation in the expression can be selected so that the overall expression is rounded toward -∞. This could be implemented, for example, using some form of interval arithmetic, but this is complex and often means that the size and / or latency of the intersection test module 108 increases.
[0195] In another example, by determining whether to conservatively perform the determination of whether the first condition is satisfied; to conservatively perform the determination of whether the second condition is satisfied; and The determination of whether the third condition is satisfied is performed conservatively. As in the above example, "roundup" indicates that multiplication and addition operations are rounded toward +∞. Instead of using "rounddown" rounding, three "SafetyFactors" are used: (i) "SafetyFactor xz ”, which is to determine (ii) “SafetyFactor yz ”, which is to determine and (iii) the “SafetyFactor xy ”, which is when determining The use of safety factors is easier to implement than using "rounddown" rounding (which may result in a smaller silicon area and latency for the intersection test module 108) because the three safety factors can be predetermined and simply added to the rounded-up expression. Using safety factors may make the intersection test more "conservative" than using "rounddown" rounding, i.e., may result in more false positives, but this may be considered acceptable, particularly if it results in a smaller silicon area for the intersection test module 108. As mentioned above, false positives in the ray box intersection test do not introduce rendering errors, but may slightly reduce the efficiency of the intersection test process by increasing the number of tests performed. The values of the three safety factors are determined to ensure that any rounding errors introduced in the calculations performed in step S308 do not cause false negative results. The safety factor can be determined based on one or more of the input values, such as based on the components of C and H. For simplicity, the safety factor can be based solely on the exponent of the floating point value of one or more input values. For example, SafetyFactor xz It may depend on C x ,C z and Function of
[0196] SafetyFactor yz It may depend on C y ,C z and function; and SafetyFactor xy It may depend on C x ,C y , and For example, the exponents of the relevant input parameters can be used together with some pre-calculated worst-case errors (e.g., rounded up to a power of 2) to determine the safety factor. In a simpler embodiment, the maximum magnitude component in the input can be determined, and the safety factor can be determined based on this.
[0197] In some examples, a top-level acceleration structure (TLAS) may be used to represent a scene in a world space coordinate system. The nodes of the TLAS correspond to boxes representing regions in the scene (e.g., AABBs aligned with the axes of the world space coordinate system). A set of geometric shapes (e.g., representing objects) may be defined, and one or more examples of the set of geometric shapes may be inserted into corresponding positions within the scene. The set of geometric shapes is defined in an instance space coordinate system, and a bottom-level acceleration structure (BLAS) is created using nodes corresponding to boxes representing regions in the instance space (e.g., AABBs aligned with the axes of the instance space coordinate system). One or more nodes of the TLAS may reference nodes of the BLAS. The ray first traverses the nodes of the TLAS, where if it is found that the ray intersects with a node of a node that references the BLAS, the ray may be tested for intersection with the box corresponding to the node of the BLAS. The intersection test module 108 (e.g., the example transformation unit 118) may transform the ray into the instance space coordinate system in order to test for intersection with the box corresponding to the node of the BLAS. The boxes described herein may correspond to nodes of a TLAS (ie, the boxes may be axis-aligned boxes in world space), or the boxes described herein may correspond to nodes of a BLAS (ie, the boxes may be axis-aligned boxes in instance space).
[0198] Figure 5 A computer system in which the ray tracing system described herein may be implemented is shown. The computer system includes a CPU 502, a GPU 504, a memory 506, and other devices 514, such as a display 516, a speaker 518, and a camera 522. A ray tracing unit 510 (corresponding to the ray tracing unit 102) is implemented on the GPU 504 and a neural network accelerator (NNA) 511. In other examples, the ray tracing unit 510 may be implemented on the CPU 502 or within the NNA 511, or as a separate processing unit in the computer system. The components of the computer system may communicate with each other via a communication bus 520. A storage device 512 (corresponding to the memory 104) is implemented as part of the memory 506.
[0199] Figure 1 The ray tracing system is shown as comprising several functional blocks. This is merely illustrative and is not intended to define a strict division between different logical elements of such an entity. Each functional block may be provided in any suitable manner. It should be understood that the intermediate values described herein as being formed by the ray tracing system need not be physically generated by the ray tracing system at any point in time, and may simply represent logical values that are convenient for describing the processing performed by the ray tracing system between its input and output.
[0200] The ray tracing unit, and specifically the intersection test module described herein, can be embodied in hardware on an integrated circuit. The intersection test module described herein can be configured to perform any of the methods described herein. Generally speaking, any of the functions, methods, techniques or components described above can be implemented in software, firmware, hardware (e.g., fixed logic circuitry), or any combination thereof. The terms "module", "function", "component", "element", "unit", "block" and "logic" may be used herein to generally represent software, firmware, hardware or any combination thereof. In the case of software implementation, a module, function, component, element, unit, block or logic represents a program code that performs a specified task when executed on a processor. The algorithms and methods described herein can be performed by one or more processors that execute code, which causes the processor to perform the algorithm / method. Examples of computer-readable storage media include random access memory (RAM), read-only memory (ROM), optical disk, flash memory, hard disk storage, and other memory devices that can use magnetic, optical and other technologies to store instructions or other data and can be accessed by a machine.
[0201] As used herein, the terms computer program code and computer readable instructions refer to any kind of executable code for execution by a processor, including code expressed in machine language, interpreted language, or scripting language. Executable code includes binary code, machine code, byte code, code that defines an integrated circuit (such as a hardware description language or netlist), and code written in languages such as C, Executable code can be, for example, any kind of software, firmware, script, module or library that, when properly executed, processed, interpreted, compiled, or run in a virtual machine or other software environment, enables the processor of a computer system supporting the executable code to perform the tasks specified by the code.
[0202] A processor, computer or computer system may be any kind of device, machine or special purpose circuit, or a collection or part thereof, which has processing capabilities so that instructions can be executed. A processor may be or include any kind of general or special purpose processor, such as a CPU, GPU, NNA, system on chip, state machine, media processor, application specific integrated circuit (ASIC), programmable logic array, field programmable gate array (FPGA), etc. A computer or computer system may include one or more processors.
[0203] The present invention is also intended to cover software that defines the configuration of hardware as described herein, such as HDL (Hardware Description Language) software, for designing integrated circuits or for configuring programmable chips to perform desired functions. That is, a computer-readable storage medium may be provided having encoded thereon computer-readable program code in the form of an integrated circuit definition data set that, when processed (i.e., run) in an integrated circuit manufacturing system, configures the system to manufacture an intersection test module configured to perform any of the methods described herein, or to manufacture an intersection test module that includes any of the devices described herein. The integrated circuit definition data set may be, for example, an integrated circuit description.
[0204] Thus, a method of manufacturing an intersection test module as described herein at an integrated circuit manufacturing system may be provided. Furthermore, an integrated circuit definition data set may be provided which, when processed in an integrated circuit manufacturing system, enables the method of manufacturing an intersection test module to be performed.
[0205] The integrated circuit definition data set may be in the form of computer code, for example as a netlist, code for configuring a programmable chip, as a hardware description language that defines hardware suitable for fabrication at any level in an integrated circuit, including as register transfer level (RTL) code, as a high-level circuit representation such as Verilog or VHDL, and as a low-level circuit representation such as OASIS (RTM) and GDSII. Higher-level representations that logically define hardware suitable for fabrication in an integrated circuit, such as RTL, may be processed on a computer system configured to generate a manufacturing definition of the integrated circuit in the context of a software environment that includes definitions of circuit elements and rules for combining those elements to generate a manufacturing definition of the integrated circuit defined by the representation. As is typically the case with software executed at a computer system to define a machine, one or more intermediate user steps (e.g., providing commands, variables, etc.) may be required to configure the computer system to generate a manufacturing definition of the integrated circuit to execute code that defines the integrated circuit to generate the manufacturing definition of the integrated circuit.
[0206] Now about Figure 6 An example of processing an integrated circuit definition data set at an integrated circuit manufacturing system to configure the system to manufacture an intersection test module is described.
[0207] Figure 6An example of an integrated circuit (IC) manufacturing system 602 is shown, which is configured to manufacture an intersection test module as described in any of the examples herein. In particular, the IC manufacturing system 602 includes a layout processing system 604 and an integrated circuit generation system 606. The IC manufacturing system 602 is configured to receive an IC definition data set (e.g., defining an intersection test module as described in any of the examples herein), process the IC definition data set, and generate an IC (e.g., which embodies an intersection test module as described in any of the examples herein) based on the IC definition data set. The processing of the IC definition data set configures the IC manufacturing system 602 to manufacture an integrated circuit that embodies an intersection test module as described in any of the examples herein.
[0208] The layout processing system 604 is configured to receive and process an IC definition data set to determine a circuit layout. Methods for determining a circuit layout based on an IC definition data set are known in the art and may, for example, involve synthesizing RTL code to determine a gate-level representation of a circuit to be generated, such as in terms of logic components (e.g., NAND, NOR, AND, OR, MUX, and FLIP-FLOP components). By determining location information for the logic components, the circuit layout may be determined based on the gate-level representation of the circuit. This may be done automatically or with user involvement in order to optimize the circuit layout. When the layout processing system 604 has determined the circuit layout, it may output the circuit layout definition to the IC generation system 606. The circuit layout definition may be, for example, a circuit layout description.
[0209] As is known in the art, IC generation system 606 generates an IC according to a circuit layout definition. For example, IC generation system 606 may implement a semiconductor device manufacturing process to generate an IC, which may involve a multi-step sequence of photolithography and chemical processing steps during which electronic circuits are gradually formed on a wafer made of semiconductor material. The circuit layout definition may be in the form of a mask that may be used in a photolithography process to generate an IC according to the circuit definition. Alternatively, the circuit layout definition provided to IC generation system 606 may be in the form of a computer readable code that IC generation system 606 may use to form a suitable mask for generating an IC.
[0210] The different processes performed by IC manufacturing system 602 may all be performed at one location, such as by one party. Alternatively, IC manufacturing system 602 may be a distributed system such that some processes may be performed at different locations and may be performed by different parties. For example, some of the following stages may be performed at different locations and / or by different parties: (i) synthesizing RTL code representing an IC definition data set to form a gate-level representation of a circuit to be generated; (ii) generating a circuit layout based on the gate-level representation; (iii) forming a mask based on the circuit layout; and (iv) using the mask to manufacture the integrated circuit.
[0211] In other examples, processing the integrated circuit definition data set at the integrated circuit manufacturing system may configure the system to manufacture the intersection test module without processing the IC definition data set to determine the circuit layout. For example, the integrated circuit definition data set may define the configuration of a reconfigurable processor such as an FPGA, and processing the data set may configure the IC manufacturing system to generate (e.g., by loading the configuration data into the FPGA) the reconfigurable processor having the defined configuration.
[0212] In some embodiments, when processed in an integrated circuit manufacturing system, the integrated circuit manufacturing definition data set may enable the integrated circuit manufacturing system to generate an apparatus as described herein. Figure 6 An integrated circuit manufacturing system configured in the manner described may manufacture the apparatus as described herein.
[0213] In some examples, the integrated circuit definition data set may include software that runs on, or in combination with, hardware defined at the data set. Figure 6 In the example shown, the IC generation system can be further configured by the integrated circuit definition dataset to load firmware onto the integrated circuit according to the program code defined at the integrated circuit definition dataset when manufacturing the integrated circuit, or otherwise provide the integrated circuit with program code for use with the integrated circuit.
[0214] Compared with known implementations, the implementation of the concepts set forth in this application in devices, equipment, modules and / or systems (and in the methods implemented herein) can improve performance. Performance improvements can include one or more of improved computing performance, reduced latency, increased throughput and / or reduced power consumption. During the manufacture of such devices, devices, modules and systems (e.g., in integrated circuits), a trade-off can be made between performance improvements and physical implementations to improve manufacturing methods. For example, a trade-off can be made between performance improvements and layout area to match the performance of known implementations, but using less silicon. For example, this can be accomplished by reusing functional blocks in a serial manner or sharing functional blocks between elements of devices, devices, modules and / or systems. In contrast, the concepts of improvements (such as reduced silicon area) that cause physical implementations of devices, devices, modules and systems set forth in this application can be compromised for performance improvements. For example, this can be accomplished by manufacturing multiple examples of modules within a predefined area budget.
[0215] Applicants hereby independently disclose each individual feature described herein and any combination of two or more such features, to the extent that such feature or combination can be implemented according to the common general knowledge of a person skilled in the art based on the specification as a whole, regardless of whether such feature or combination of features solves any problem disclosed herein. In view of the foregoing description, it will be clear to a person skilled in the art that various modifications can be made within the scope of the invention.
Claims
1. A method for determining whether a ray intersects a three-dimensional axis-aligned box in a ray tracing system, the method comprising: Determine whether a first condition is satisfied, wherein the first condition is or mathematically equivalent to Determine whether a second condition is satisfied, wherein the second condition is or mathematically equivalent to Determine whether a third condition is satisfied, wherein the third condition is or mathematically equivalent to as well as If it is determined that at least one of the first condition, the second condition, and the third condition is not satisfied: then determining that the ray does not intersect the axis-aligned frame; Among them C x ,C y and C z are the x, y, and z components of the position of the center of the axis-aligned box relative to the origin of the ray, where H x ,H y and H z is the half-width of the axis-aligned box in the x, y, and z dimensions, and where D x ,D y and D z are the x, y and z components of the direction vector of the ray.
2. The method according to claim 1, further comprising: determining whether a maximum distance condition is satisfied, wherein the maximum distance condition is satisfied if the maximum distance of the ray from the ray origin is greater than or equal to the minimum distance from the ray origin to the intersection of the ray direction vector and the axis-aligned box, The determination of whether the maximum distance condition is satisfied is used to determine whether the ray intersects the axis-aligned box.
3. The method according to claim 2, further comprising: determining whether a minimum distance condition is satisfied, wherein the minimum distance condition is satisfied if the minimum distance of the ray from the ray origin is less than or equal to the maximum distance from the ray origin to the intersection of the ray direction vector and the axis-aligned box, The determination of whether the minimum distance condition is satisfied is used to determine whether the ray intersects the axis-aligned box. 4 . The method of claim 3 , wherein determining whether the minimum distance condition and the maximum distance condition are satisfied comprises determining whether a single distance condition is satisfied, wherein determining that the single distance condition is satisfied indicates that both the minimum distance condition and the maximum distance condition are satisfied.
5. The method according to claim 4, wherein the single distance condition is or mathematically equivalent to where D is a number with component D x ,D y and D z The direction vector of the light ray, where C is a vector with component C x ,C y and C z The position of the center of the axis-aligned box is H, where H is the half-width H of the axis-aligned box. x ,H y and H z where O is a vector representing the origin of the ray, and t represents the distance along the ray to the origin of the ray, and where and where t min is the minimum value of t that defines the minimum distance of the ray to the ray origin, and where t max is the maximum value of t which defines the maximum distance of the ray from the ray origin. 6 . The method according to claim 3 , wherein if it is determined that all of the first condition, the second condition, the third condition, the maximum distance condition and the minimum distance condition are satisfied, then it is determined that the ray intersects the axis-aligned frame.
7. The method according to any one of claims 1 to 5, further comprising selectively permuting and / or inverting the x, y and z components of the ray and the axis-aligned frame before determining whether the first condition, the second condition and the third condition are satisfied, so that D z ≥D x ≥0 and D z ≥D y ≥0.
8. The method according to any one of claims 1 to 5, wherein the light rays are pre-calculated. and and stores it in a storage device, wherein the method comprises reading from the storage device and to perform the determination of whether the first condition, the second condition, and the third condition are satisfied.
9. The method according to any one of claims 1 to 5, further comprising reading data defining the position and size of the axis-aligned frame, and using the read data to determine the C of the axis-aligned frame. x ,C y ,C z ,H x ,H y and H z .
10. The method of claim 9, wherein C is determined by subtracting corresponding components of the ray origin from corresponding components of the read data defining the position of the center of the axis-aligned frame. x ,C y and C z .
11. A method according to any one of claims 1 to 5, wherein the determination of whether the first condition, the second condition and the third condition are satisfied is performed conservatively so that if a completely accurate determination has determined that the conditions are satisfied, any errors introduced by rounding in the determination process cannot cause a determination that the conditions are not satisfied.
12. The method according to claim 11, wherein by determining whether to conservatively perform said determination of whether said first condition is satisfied; By determining whether to conservatively perform said determination of whether said second condition is satisfied; and And by determining whether to conservatively perform the determination of whether the third condition is satisfied, where roundup indicates that multiplication and addition operations are rounded towards +∞, where SafetyFactor xz Is to determine The upper limit of the error introduced by rounding when SafetyFactor yz Is to determine The upper limit of the error introduced by rounding when , and where SafetyFactor xy Is to determine The upper limit of the error introduced by rounding when 13. The method according to claim 11, wherein by determining whether to conservatively perform said determination whether said first condition is satisfied, By determining whether to conservatively perform said determination of whether said second condition is satisfied; and And by determining whether to conservatively perform the determination of whether the third condition is satisfied, where roundup indicates that multiplication and addition operations are rounded toward +∞, and where rounddown indicates that multiplication and subtraction operations are rounded appropriately so that the corresponding overall expression is rounded toward –∞.
14. The method of any one of claims 1 to 5, further comprising outputting an indication of a result of determining whether the ray intersects the axis-aligned box.
15. The method of claim 14, wherein the outputted indication is used in the ray tracing system to render an image of a 3D scene.
16. The method of any one of claims 1 to 5, wherein the axis-aligned box is an axis-aligned bounding box that bounds a geometric shape to be rendered.
17. The method of any one of claims 1 to 5, wherein the axis-aligned box corresponds to a node of a hierarchical acceleration structure to be used for performing intersection testing in the ray tracing system.
18. The method of claim 17, wherein the node is part of an underlying acceleration structure for representing geometry in instance space, and wherein the method includes transforming the ray into the instance space.
19. An intersection testing device for use in a ray tracing system, configured to determine whether a ray intersects a three-dimensional axis-aligned box, the intersection testing device being configured to: Determine whether a first condition is satisfied, wherein the first condition is or mathematically equivalent to Determine whether a second condition is satisfied, wherein the second condition is or mathematically equivalent to Determine whether a third condition is satisfied, wherein the third condition is or mathematically equivalent to as well as If it is determined that at least one of the first condition, the second condition and the third condition is not satisfied: using the determination to determine (S314) that the ray does not intersect the axis-aligned frame; Among them C x ,C y and C z are the x, y, and z components of the position of the center of the axis-aligned box relative to the origin of the ray, where H x ,H y and H z is the half-width of the axis-aligned box in the x, y, and z dimensions, and where D x ,D y and D z are the x, y and z components of the direction vector of the ray.
20. A non-transitory computer readable storage medium having computer readable code stored thereon, the computer readable code being configured to cause the method according to any one of claims 1 to 18 to be performed when the computer readable code is executed.
Citation Information
Patent Citations
Compressed ray direction data in a ray tracing system
CN109087384A
Reduced acceleration structures for ray tracing systems
CN109509138A