Ray tracing system, method of performing intersection test, and storage medium
By introducing AllHit and AnyHit tests into the ray tracing system, the problem of high computational cost in rendering complex 3D scenes is solved, rendering speed is improved and power consumption is reduced, making it suitable for resource-constrained mobile devices.
Patent Information
- Application Number
- CN202110705659.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-08-26
- Filing Date
- 2021-06-24
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2041-06-24
AI Technical Summary
Existing ray tracing systems are computationally intensive when performing intersection tests, making it difficult to meet the needs of real-time rendering of complex 3D scenes, especially on resource-constrained mobile devices, where there is a trade-off between performance, power consumption, and area.
The tester module is used to perform beam separation and intersection tests, including the first beam intersection test (AllHit) and the second beam intersection test (AnyHit). By performing fast binary judgment on the beams, the number of individual beam tests is reduced, and the AllHit and AnyHit tests are executed in parallel to improve efficiency.
By reducing the number of intersection tests and parallel processing, the performance of the ray tracing system has been improved and power consumption reduced, adapting to the resource constraints of mobile devices and achieving faster rendering speeds and lower energy consumption.
Smart Images

Figure CN113936087B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] This disclosure relates to techniques for performing intersection tests in a ray tracing system. BACKGROUND
[0002] Ray tracing is a computational rendering technique that is used to generate an image of a scene (e.g., a 3D scene) by tracing paths of light (“rays”) in the scene from the viewpoint of a camera. Each ray is modeled as originating from the camera and passing through a pixel into the scene. As a ray traverses the scene, it can intersect with objects within the scene. The intersection between a ray and an object it intersects with can be modeled to create realistic visual effects. For example, in response to determining that a ray intersects with an object, a shader program (i.e., a portion of computer code) can be executed for the intersection. A programmer can write the shader program to define how the system reacts to the intersection, e.g., which can result in one or more secondary rays being emitted into the scene, such as to represent a reflection of the ray off of the intersecting object or a refraction of the ray through the object (e.g., if the object is transparent or translucent). As another example, the shader program can cause one or more rays to be emitted into the scene for determining whether the object is in shadow at the intersection point. The result of executing the shader program (and processing the related secondary rays) can be a color value for the pixel through which the ray passed.
[0003] To reduce the number of intersection tests that need to be performed, a ray tracing system can generate an acceleration structure, where each node of the acceleration structure represents a region within the scene. The acceleration structure is typically hierarchical (e.g., has a tree structure) such that it contains multiple levels of nodes, with nodes closer to the top of the acceleration structure representing relatively large regions in the scene (e.g., a root node can represent the entire scene) and nodes closer to the bottom of the acceleration structure representing relatively small regions in the scene. A “tree node” refers to a node that has pointers to other nodes in the hierarchical acceleration structure (i.e., a tree node has child nodes in the hierarchical acceleration structure). A “leaf node” refers to a node that has one or more pointers to one or more primitives (i.e., a leaf node does not have child nodes in the hierarchical acceleration structure). In other words, a leaf node of the acceleration structure represents a region in the scene that bounds one or more objects. The acceleration structure can have different structures in different examples, such as a grid structure, an octree structure, a space partitioning structure (e.g., a k-d tree), or a bounding volume hierarchy. The nodes can represent suitable shapes or regions in the scene (which can be referred to herein as “boxes”). In some examples, the nodes represent axis-aligned bounding boxes (AABBs) in the scene.
[0004] An acceleration structure can be used to perform intersection tests on rays by first testing the rays for intersection with a root node of the acceleration structure (e.g., in a recursive manner). If a ray is found to intersect a parent node (e.g., the root node), the test can proceed to the child nodes of the parent node. In contrast, if a ray is found not to intersect a parent node, intersection tests for the child nodes of the parent node can be avoided, thereby saving computational effort. If a ray is found to intersect a leaf node, it can be tested against objects within the region represented by the leaf node to determine which object(s) the ray intersects. If a ray is found to have more than one intersection point, the closest intersection point to the ray's origin (i.e., the first intersection the ray encounters in the scene) can be identified and it can be determined that the ray intersects at this identified closest intersection point. Using an acceleration structure (rather than testing rays directly against objects in a scene) reduces the number of intersection tests that need to be performed and simplifies the intersection tests. The intersection tests are simpler because the nodes of the acceleration structure represent basic shapes (e.g., axis-aligned bounding boxes or spheres) for which intersection tests are simpler than for more complex object shapes, e.g., basic shapes defined in terms of triangle primitives that are not predetermined to be oriented. SUMMARY
[0005] This Summary is provided to introduce some 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 in limiting the scope of the claimed subject matter.
[0006] Provided herein is a ray tracing system, comprising:
[0007] a tester module configured to receive a bundle of rays to be tested for intersection with a frame, wherein the tester module comprises:
[0008] a first test block configured to perform a first bundle intersection test to determine whether all of the rays of the bundle intersect the frame, wherein if the first bundle intersection test determines that all of the rays of the bundle intersect the frame, the intersection test result for the bundle relative to the frame is that all of the rays of the bundle intersect the frame; and
[0009] a second test block configured to perform a second bundle intersection test to determine whether all of the rays of the bundle miss the frame, wherein if the second bundle intersection test determines that all of the rays of the bundle miss the frame, the intersection test result for the bundle relative to the frame is that all of the rays of the bundle miss the frame, and
[0010] wherein the tester module is configured to, in the event that the first beam intersection test is inconclusive as to whether all of the rays of the beam intersect the frame, and in the event that the second beam intersection test is inconclusive as to whether all of the rays of the beam miss the frame:
[0011] separating the beam of rays into individual rays; and
[0012] performing an intersection test on the individual rays relative to the frame to determine which of the individual rays intersect the frame.
[0013] The second test block can be configured to perform the second beam intersection test irrespective of the result of the first beam intersection test performed by the first test block.
[0014] The tester module can be configured to cause the first test block to perform the first beam intersection test on the beam relative to the frame while the second test block performs the second beam intersection test on the beam relative to the frame.
[0015] The second test block can be configured to perform the second beam intersection test on the beam relative to the frame in response to the result of the first beam intersection test performed by the first test block on the beam relative to the frame being that the first beam intersection test is inconclusive as to whether all of the rays of the beam intersect the frame.
[0016] The tester module can be configured to perform the intersection test on the individual rays relative to the frame using one or both of the first test block and the second test block.
[0017] The tester module can comprise:
[0018] a set of one or more first test blocks, wherein each first test block of the one or more first test blocks is configured to perform a first beam intersection test to determine whether all rays of a beam intersect a frame; and
[0019] a set of one or more second test blocks, wherein each second test block of the one or more second test blocks is configured to perform a second beam intersection test to determine whether all rays of a beam miss a frame,
[0020] wherein the test blocks are organized into pairs of test blocks, each pair of test blocks comprising: (i) a first test block from the set of one or more first test blocks, and (ii) a second test block from the set of one or more second test blocks.
[0021] The tester module can be configured to pass the bundle of rays and data representing the box to a pair of test blocks, such that the first test block of the pair of test blocks performs the first beam intersection test on the bundle of rays with respect to the box, and the second test block of the pair of test blocks performs the second beam intersection test on the bundle of rays with respect to the box.
[0022] The tester module can be configured to pass first and second individual rays and data representing the box to a pair of test blocks, such that the first test block of the pair of test blocks performs an intersection test on the first individual ray with respect to the box, and the second test block of the pair of test blocks performs an intersection test on the second individual ray with respect to the box.
[0023] The tester module can further include a result processor configured to process the intersection test results of the bundle of rays with respect to the box.
[0024] The tester module can further include a memory configured to store data describing the box, the data having been fetched from the memory to perform the intersection tests with respect to the box.
[0025] The ray tracing system can further include a beam constructor configured to:
[0026] receive a ray; and
[0027] group the received ray together based on a similarity of the received ray, thereby constructing a bundle of rays to be tested for intersection with the box.
[0028] The beam constructor can be configured to:
[0029] maintain a set of open beams to which new rays can be added; and
[0030] for each of the received rays:
[0031] determine a similarity level of the received ray to each of the open beams;
[0032] based on the determined similarity level, identify, for the received ray, a best matching open beam of the set of open beams; and
[0033] if the determined similarity level of the best matching open beam is above a threshold, add the received ray to the best matching open beam.
[0034] The beam constructor can further be configured to, for each of the received rays:
[0035] If the determined level of similarity of the best matching open beam is below the threshold, a new beam is created and the received ray is added to the new beam.
[0036] The received rays grouped together to construct a beam can: (i) include new rays that have not previously been included in a ray beam, but (ii) not include rays that have previously been included in a ray beam.
[0037] The received rays grouped together to construct a beam can include:
[0038] new rays that have not previously been included in a ray beam, and
[0039] rays that have previously been included in a ray beam that has been deconstructed.
[0040] The ray tracing system can further include a scheduler configured to:
[0041] form a grouping including one or both of a ray indication and a beam indication, the ray and beam requiring access to the same memory block to perform an intersection test; and
[0042] cause data to be fetched from the memory block and passed to the tester module to perform an intersection test on one or both of the ray and beam indicated in the indication in the grouping.
[0043] A ray tracing system configured to perform any of the methods described herein is provided.
[0044] A computer-implemented method of performing an intersection test in a ray tracing system is provided, the method including:
[0045] receiving a beam of rays to be tested for intersection with a box;
[0046] performing a first beam intersection test to determine whether all of the rays of the beam intersect the box, wherein if the first beam intersection test determines that all of the rays of the beam intersect the box, the intersection test result for the beam relative to the box is that all of the rays of the beam intersect the box; and
[0047] if the first beam intersection test does not determine that all of the rays of the beam intersect the box, using a result of performing a second beam intersection test to determine the intersection test result for the beam relative to the box, the second beam intersection test determining whether all of the rays of the beam miss the box,
[0048] wherein if the result of performing the second beam intersection test indicates that all of the rays of the beam miss the box, the beam intersection test result for the beam relative to the box is that all of the rays of the beam miss the box, and
[0049] wherein if the first beam intersection test is inconclusive that all of the rays of the beam intersect the box, and if the result of performing the second beam intersection test does not indicate that all of the rays of the beam miss the box, the method further comprises:
[0050] separating the beam of rays into individual rays; and
[0051] performing an intersection test relative to the box on the individual rays to determine which of the individual rays intersect the box.
[0052] There can be only two possible results of the first beam intersection test: (i) the first beam intersection test determines that all of the rays of the beam intersect the box, or (ii) the first beam intersection test is inconclusive that all of the rays of the beam intersect the box.
[0053] There can be only two possible results of the second beam intersection test: (i) the second beam intersection test determines that all of the rays of the beam miss the box, or (ii) the second beam intersection test is inconclusive that all of the rays of the beam miss the box.
[0054] The first and second beam intersection tests can be performed in parallel relative to the beam.
[0055] The second beam intersection test can be performed relative to the beam in response to a result of the first beam intersection test relative to the beam being that the first beam intersection test is inconclusive that all of the rays of the beam intersect the box.
[0056] Performing the first beam intersection test relative to the box on the beam of rays can comprise:
[0057] identifying profile edges of the box from a perspective of the beam of rays;
[0058] for each of the identified profile edges:
[0059] obtaining components of a vector that provides an outer bound relative to the identified profile edge to the beam of rays, such that the vector is at least as likely to pass outside of the identified profile edge as any one of the rays of the beam; and
[0060] determining whether the vector passes inside or outside of the profile edge; and
[0061] determining, using the result of determining for each of the identified profile edges whether the vector passes inside or outside the profile edge, an intersection test result of the ray bundle with respect to the box,
[0062] wherein if it is determined for each of the identified profile edges that the vector passes inside the respective identified profile edge, the intersection test result of the ray bundle with respect to the box is that all of the rays in the ray bundle intersect the box; and
[0063] wherein if it is determined for one or more of the identified profile edges that the vector passes outside the respective identified profile edge, the intersection test result of the ray bundle with respect to the box is that not all of the rays in the ray bundle intersect the box.
[0064] performing the second beam intersection test of the ray bundle with respect to the box can include:
[0065] identifying profile edges of the box from the perspective of the ray bundle;
[0066] for each of the identified profile edges:
[0067] obtaining a component of a vector providing an inside boundary to the ray bundle with respect to the identified profile edge, such that the vector is at least as likely to pass inside the identified profile edge as any one of the rays of the bundle; and
[0068] determining whether the vector passes inside or outside the profile edge; and
[0069] determining, using the result of determining for each of the identified profile edges whether the vector passes inside or outside the profile edge, an intersection test result of the ray bundle with respect to the box,
[0070] wherein if it is determined for each of the identified profile edges that the vector passes inside the respective identified profile edge, the intersection test result of the ray bundle with respect to the box is that not all of the rays in the ray bundle miss the box; and
[0071] wherein if it is determined for one or more of the identified profile edges that the vector passes outside the respective identified profile edge, the intersection test result of the ray bundle with respect to the box is that all of the rays in the ray bundle miss the box.
[0072] Data for a ray bundle can be stored in a data structure and can include:
[0073] origin data for the ray bundle;
[0074] vector data describing components of a vector providing a boundary for the ray bundle; and
[0075] one or more pointers to ray data for the rays of the ray bundle.
[0076] The box can be an axis-aligned bounding box.
[0077] Described herein is a computer-implemented method of performing an intersection test in a ray tracing system, the method comprising:
[0078] receiving a ray bundle to test for intersection with a box;
[0079] identifying silhouette edges of the box from a perspective of the ray bundle;
[0080] for each of the identified silhouette edges:
[0081] obtaining components of a vector providing a boundary for the ray bundle; and
[0082] determining whether the vector passes inside or outside of the silhouette edge; and
[0083] determining an intersection test result for the ray bundle relative to the box using results of determining whether the vector passes inside or outside of the identified silhouette edges.
[0084] Described herein is a ray tracing system comprising:
[0085] a tester module configured to receive a ray bundle to test for intersection with a box, wherein the tester module comprises:
[0086] a set of one or more test blocks configured to perform an intersection test relative to the box for the received ray bundle by:
[0087] identifying silhouette edges of the box from a perspective of the ray bundle;
[0088] for each of the identified silhouette edges:
[0089] obtaining components of a vector providing a boundary for the ray bundle; and
[0090] determining whether the vector passes inside or outside of the silhouette edge; and
[0091] determining an intersection test result for the ray bundle relative to the box using results of determining whether the vector passes inside or outside of the identified silhouette edges.
[0092] The ray tracing system described herein can be embodied in hardware on an integrated circuit. A method of manufacturing a ray tracing system at an integrated circuit manufacturing system can be provided. An integrated circuit definition data set that, when processed in an integrated circuit manufacturing system, configures the system to manufacture a ray tracing system can be provided. A non-transitory computer readable storage medium having stored thereon a computer readable description of a ray tracing system that, when processed in an integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the ray tracing system can be provided.
[0093] An integrated circuit manufacturing system can be provided comprising: a non-transitory computer readable storage medium having stored thereon a computer readable description of a ray tracing system; a layout processing system configured to process the computer readable description so as to generate a circuit layout description of an integrated circuit embodying the ray tracing system; and an integrated circuit generation system configured to manufacture the ray tracing system from the circuit layout description.
[0094] A computer program code for performing any of the methods described herein can be provided. A non-transitory computer readable storage medium having stored thereon computer readable instructions that, when executed at a computer system, cause the computer system to perform any of the methods described herein can be provided.
[0095] As will be apparent to those skilled in the art, the above features can be combined as appropriate, and can be combined with any of the aspects of the examples described herein. BRIEF DESCRIPTION OF DRAWINGS
[0096] The present application is described by way of example with reference to the accompanying drawings. In the drawings:
[0097] Figure 1 A schematic diagram of an edge test for determining whether a ray intersects a 2D box is shown;
[0098] Figure 2 A schematic diagram of a three-dimensional box against which an intersection test of a ray is performed is shown;
[0099] Figure 3 A first example ray tracing system is shown;
[0100] Figure 4 A flowchart of a first method of performing an intersection test in a ray tracing system is shown;
[0101] Figure 5 Three example ray bundles to be tested for intersection against a two-dimensional box are shown;
[0102] Figure 6Three example ray bundles to be tested for intersection relative to a three- dimensional box are shown;
[0103] Figure 7 Another example of a ray bundle to be tested for intersection relative to a two- dimensional box is shown;
[0104] Figure 8a And Figure 8b Two further examples of three-dimensional boxes are shown, seen from different perspectives;
[0105] Figure 9 A second example ray tracing system is shown;
[0106] Figure 10 is a flowchart of a method of processing rays to be tested for intersection in a ray tracing system;
[0107] Figure 11 is a flowchart of a method of performing intersection tests on a bundle of rays relative to a box in a ray tracing system;
[0108] Figure 12 is a flowchart of another method of performing intersection tests on a bundle of rays relative to a box in a ray tracing system;
[0109] Figure 13a An example data structure for storing data for a ray is shown;
[0110] Figure 13b An example data structure for storing data for a bundle of rays is shown;
[0111] Figure 14 A computer system implementing a ray tracing system is shown;
[0112] Figure 15 An integrated circuit manufacturing system for generating an integrated circuit embodying a ray tracing system as described herein is shown;
[0113] Figure 16a Ray bundles with different origins to be tested for intersection relative to a box in a 2D example are shown;
[0114] Figure 16b A ray bundle shown being tested for intersection relative to a box in an AnyHit test by increasing the effective size of the box is shown; Figure 16a A ray bundle shown being tested for intersection relative to a box in an AllHit test by reducing the effective size of the box is shown; and
[0115] Figure 16c A ray bundle shown being tested for intersection relative to a box in an AllHit test by reducing the effective size of the box is shown; and Figure 16a A ray bundle shown being tested for intersection relative to a box in an AllHit test by reducing the effective size of the box is shown; and
[0116] Figure 17 Three example ray bundles to be tested for intersection relative to two 2D boxes are shown.
[0117] The drawings illustrate various examples. A skilled artisan will understand that boundaries shown in the drawings (e.g., a box, a group of boxes, or other shapes) represent one example of a boundary. In some examples, it can be the case that an element can be designed to be multiple elements, or multiple elements can be designed to be one element. Where appropriate, common reference numerals have been used throughout the various drawing figures to designate similar features. DETAILED DESCRIPTION
[0118] The following description is presented to enable any person skilled in the art to make and use the application. The present application is not limited to the embodiments described herein and various modifications can be made by those skilled in the art upon reading and understanding the present disclosure. Embodiments are described by way of example only.
[0119] Even with acceleration structures, the amount of work involved in performing intersection tests in a ray tracing system is still large. For example, ray tracing can be used to render an image of a 3D scene, where the image can have approximately one million pixels. A ray can be traced for each sample location. In some examples, there can be one sample location per pixel location, while in some other examples there can be multiple sample locations per pixel location (e.g., to allow for performing a process such as multi-sample anti-aliasing (MSAA) in rendering a final pixel value). When a ray intersects an object in the scene, a shader can be executed, which 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, which are all traced through the scene to determine their intersection points. Thus, it is not uncommon for tens or hundreds of millions of rays to be traced through a scene to render an image. As graphics rendering technology has developed, scenes to be rendered tend to be more complex, so it is not uncommon for there to be thousands of objects in a scene, each of which can be represented by several primitives. Furthermore, the image being rendered can represent a frame in a series of frames to be rendered in real time, e.g., for display to a user in real time. For example, a user can be playing a game, where the rendered image represents the user’s 3D scene view as the user plays the game. To make the series of frames appear like a continuous stream of video data, several frames can be rendered per second, e.g., 24, 30, or 60 frames per second, as some examples. Thus, it can be appreciated 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.
[0120] 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 of the processing. This can be viewed as a "brute force" approach. However, in addition to having the goal of high performance (performing ray tracing to render the scene to be output in real time), there is also the competing goal of reducing the size (e.g., silicon area) and power consumption of the ray tracing system. For example, there can be a goal to implement a ray tracing system on a mobile device such as a tablet computer or a smartphone, which can have far lower acceptable size and power consumption than a supercomputer. Thus, when designing a ray tracing system, there can be a tradeoff between performance, power consumption, and area. Depending on how this tradeoff is implemented, examples described herein can allow for improved performance without significantly increasing power consumption and area (as compared to prior art described above in the Background section). Alternatively, in different implementations of the tradeoff, examples described herein can allow for reduced power consumption and / or size of the ray tracing system without significantly reducing the performance of the ray tracing system (as compared to prior art described above in the Background section). Different implementations can be designed to target different points in the tradeoff between performance, power consumption, and silicon area.
[0121] Generally, when performing intersection tests on rays within a scene, many rays are tested for intersection with respect to the same box (e.g., where the box represents a node in a hierarchical acceleration structure). In some cases, the rays can be grouped together into a ray bundle, and the intersection test can be performed on the ray bundle. In the case where the intersection test results for all rays within the bundle are the same, it is possible to perform fewer intersection tests (e.g., one or two intersection tests) for the entire ray bundle and use the test results to infer the intersection test results for all rays in the bundle, rather than performing all intersection tests for each individual ray within the bundle. In this case, the test used to infer the intersection test results for all rays in the bundle is referred to as a bundle intersection test. It should be understood that the term "bundle intersection test" does not refer to simply performing separate tests for each individual ray in the bundle. Rather, the bundle intersection test performed on the ray bundle provides a bundle intersection test result for the entire bundle, which can be used to infer the intersection test results that apply to all rays in the bundle. For example, if we can guarantee that all rays in a ray bundle have the same intersection test result with respect to a box (e.g., hit or miss), then the result for the entire bundle can be determined, and used as the intersection test result for all rays in the bundle. In this way, separate intersection tests for individual rays within at least some bundles can be avoided. Thus, performing intersection tests on ray bundles can reduce the total number of intersection tests performed, and can reduce the number of times memory is accessed to fetch ray data. As described in more detail below, the bundle intersection tests in examples described herein allow a single vector to be tested against each profile edge of a box, providing the intersection test result for the bundle. For example, for each profile edge of a box, a vector is obtained that provides a boundary for the ray bundle, and it can be determined whether the vector passes inside or outside the profile edge. From the perspective of a ray traveling from its origin, the profile of a box is a 2D projection of the box. If the vector passes outside the profile edge, then the vector does not pass within the perimeter of the profile. If the vector passes inside all profile edges, then the vector does pass within the perimeter of the profile. The result of determining whether the respective vector passes inside or outside each profile edge can be used to determine the intersection test result for the ray bundle with respect to the box. Each profile edge is a straight edge, such as an edge between two vertices of the profile. By reducing the number of calculations that need to be performed to determine whether the rays of a bundle intersect a box (compared to prior art), the intersection test result can be determined more quickly, i.e., the latency of the ray tracing system can be reduced (or in other words, the performance of the ray tracing system can be improved), and the power consumption of the ray tracing system can be reduced.
[0122] As described in more detail below, two types of bundle intersection tests are described herein:
[0123] (i) A first beam intersection test (which can be referred to herein as an “AllHit” intersection test) determines whether all rays of a beam intersect the box. The first beam intersection test can provide a binary result, such that there are only two possible outcomes for the first beam intersection test: (i) the first beam intersection test determines that all rays of the beam intersect the box, or (ii) the first beam intersection test does not determine that all rays of the beam intersect the box.
[0124] (ii) A second beam intersection test (which can be referred to herein as an “AnyHit” test) determines whether all rays of a beam miss the box. In other words, the second beam intersection test determines whether any ray of a beam hits the box. The second beam intersection test can provide a binary result, such that there are only two possible outcomes for the second beam intersection test: (i) the second beam intersection test determines that all rays of the beam miss the box, or (ii) the second beam intersection test does not determine that all rays of the beam miss the box.
[0125] Very similar logic can be used to implement these two different types of beam intersection tests, but the bounding vectors with respect to the respective profile edge tests of the box are different. If a vector that bounds a beam of rays does not cross one side of a profile edge, then it is known that no ray of the beam crosses this side of the profile edge. In other words, either: (i) the vector is at least as likely to cross inside the profile edge as any ray in the beam, or (ii) the vector is at least as likely to cross outside the profile edge as any ray in the beam. Note that different bounding vectors can be used for different profile edges. Furthermore, in the examples described below, the logic configured to perform these two types of beam intersection tests can also correctly perform intersection tests on individual rays (each of which can be considered to be a beam comprising only one ray). In this way, the ray tracing system does not need different dedicated test blocks to perform intersection tests on individual rays and on beams of rays, i.e. the same test block can be used to test individual rays and beams of rays. This is particularly useful when the test block is implemented in hardware (e.g. fixed function circuitry), as it reduces the likelihood of bottlenecks being introduced in the system due to one type of test block saturating and the other type of test block being idle.
[0126] The first bundle intersection test and the second bundle intersection test can be implemented separately, and they can each provide a benefit in reducing the number of intersection tests that need to be performed (where all rays within a bundle will get the same result (hit or miss)). However, in some examples, both types of bundle intersection test can be implemented in the same ray tracing system. This can be particularly beneficial because it can avoid performing separate intersection tests for individual rays in the case where all rays of a bundle hit the box and all rays of a bundle miss the box. In some examples, an AllHit test can be performed for a bundle of rays with respect to a box, and if the AllHit test determines that all rays of the bundle hit the box, then the intersection test result is that all rays of the bundle hit the box. If the AllHit test does not determine that all rays of the bundle hit the box, then an AnyHit test can be performed for the bundle with respect to the box. If the AnyHit test determines that all rays of the bundle miss the box, then the intersection test result is that all rays of the bundle miss the box. If the intersection test result has not been found, then a separate intersection test can be performed for each ray of the bundle with respect to the box. In this example, the AnyHit test is conditionally performed based on the result of the AllHit test. This is an example of how the method can be implemented in software. In different examples (e.g., when the method is implemented in hardware such as fixed function circuitry), the AllHit test and the AnyHit test can be performed in parallel. In these examples, the AnyHit test will be performed regardless of the result of the AllHit test. Performing the AllHit and AnyHit tests in parallel can reduce the latency of the method.
[0127] A general example method of performing an intersection test will now be described, in which a single ray is tested against a box. This can be used to continue explaining how a bundle of rays can be tested against a box. In three-dimensional (3D) examples, a box is a 3D volume. In 3D examples, a box can be any suitable shape, such as a cuboid (e.g., a cube), a sphere, a cylinder, a cone, a pyramid, a prism, etc. In two-dimensional (2D) examples, a box is a 2D region. In these 2D examples, a box can be any suitable shape, such as a rectangle (e.g., a square), a circle, a triangle, a hexagon, etc. In examples described in detail herein, the edges of a box are aligned with the axes of the space in which ray tracing is being performed. For example, a box can be an axis-aligned bounding box (AABB), and can correspond to a node of a hierarchical acceleration structure.
[0128] A ray can be mathematically represented in vector form as:
[0129] r = o + Td (1)
[0130] where r is the ray, o is the origin of the ray relative to the coordinate system being used, and d is the direction vector of the ray, and T is a scalar.
[0131] A plane can be represented in vector form as a set of points p such that:
[0132] (p - p0) · n = 0 (2)
[0133] where p o is a known point on the plane and n is a normal vector to the plane. In other words, the set of points p that satisfy equation (2) lie on the plane.
[0134] At the intersection between a ray and a plane, r = p. The intersection distance between the origin of a ray and a plane (i.e., the distance between the origin of the ray and the intersection of the ray with the plane) can be found by combining equation (1) and equation (2) with r = p and rearranging for T. In the example explained below, it is assumed that the plane is axis-aligned, i.e., aligned with the coordinate system, and thus the normal vector n contains only one non-zero component, which equals 1 for a normalized vector (but note that in other examples, the planes defining the edges of a bounding box can not be axis-aligned). For generality, the non-zero component of the normal vector is denoted as the i-th component (also for three-dimensional examples, i e x, y, z), the combination of equations (1) and (2) can be rewritten as:
[0135] o i + Td i - p oi = 0 (3)
[0136] and thus:
[0137]
[0138] Figure 1 An example of two rays 101 and 103 and a bounding box 105 is shown. In this example, the bounding box is two-dimensional (2D) and is defined by a space bounded by four boundary edges for ease of illustration. As shown, ray 101 intersects the bounding box 105 and ray 103 does not intersect the bounding box 105.
[0139] To determine whether a ray intersects a 2D bounding box 105, side tests are performed for points A and B, where A and B are at exactly opposite corners of the bounding box 105. Each side test is performed to determine which side of the tested point the ray passes through. In different examples, when the bounding box is a 3D bounding box, the side tests determine which side of the edge the ray passes through.
[0140] To perform the intersection test for point A, the two intersection distances for each ray are determined. In Figure 1 , these intersection distances are denoted as T x and T y . T x is the distance between the origin of the ray and a point that has the same x-component as point A; T yIt is the distance between the origin of the ray and the point on which the ray has the same y-component as point A.
[0141] For intersecting rays, for example, for intersecting ray 101 tested relative to point A:
[0142] T y ≤T x (5) For the non-intersecting ray 103 relative to point A:
[0143] T x <T y (6)
[0144] Using the equation for T given in (4), it can be seen that the generalized inequality to be evaluated to determine which side the ray passes through (in the 3D example) or (in the 2D example) at the edge is given by the following equation:
[0145]
[0146] To avoid the cost of performing division, inequality (7) can be rewritten as:
[0147] (p oi -o i )d j ≤(p oj -o j )d i (8)
[0148] exist Figure 1 In the example shown, point A is the bottom right corner of the box, i = y and j = x, and if inequality (8) (or inequality (7)) is true, the ray passes inside point A, and if inequality (8) (or inequality (7)) is false, the ray passes outside point A. A similar test is performed relative to corner point B, which is the top left corner of box 105 (i.e., exactly opposite point A). For point B, the values can be set to i = x and j = y (the opposite of the test for point A), and if inequality (8) (or inequality (7)) is true, the ray passes inside point B, and if inequality (8) (or inequality (7)) is false, the ray passes outside point B. To determine if the ray intersects box 105, both inequalities for points A and B must be true, and if either inequality is false, the ray does not intersect box 105.
[0149] Figure 2An example of a 3D box 201 as seen from the origin of the intersecting rays to be tested relative to box 201 is shown. In this example, box 201 is an axis-aligned bounding box (AABB). Because box 201 is axis-aligned, each edge of box 201 is parallel to one of the x, y, or z axes. The box is shown as including a set of contour edges, labeled 1 to 6. Contour edges are edges that define a portion of the contour of the box. Contour edges are determined from the line of sight along the direction of the ray vector; that is, the box is depicted as seen from, for example, a viewpoint located at the origin of the ray and pointing in the direction of the ray. In other words, in Figure 2 The outline edges marked 1 to 6 are the edges of the 2D projection of box 201 as seen from the perspective of light rays traveling from the origin. Box 201 is Figure 2 The cuboid in the example shown gives box 201 four or six outline edges, depending on the viewpoint from which the box is viewed. Figure 2 The box 201 shown is for illustration only and may, for example, represent the volume corresponding to the root node, parent node, child node and / or leaf node in the acceleration structure.
[0150] In this 3D example, the two planes intersect to form a line, rather than a point as in the 2D case. Therefore, a side test performed on the 3D box is used to determine which side of the contour edge (in the form of a line) the ray passes through, which may be referred to herein as the “edge test”. To determine whether the ray intersects with box 201, an intersection test is performed on each of the contour edges 1 to 6. Each intersection test includes performing a comparison of the values specified in inequality (8).
[0151] Box 201 is formed by six planes, where for each axis (x, y, z), two of the planes have normals parallel to the axis, such that the component values of those planes with respect to the axis are constant within each plane. Of the two parallel planes, one will have a higher component value along the relevant axis. Therefore, for each axis, there exist a maximum and a minimum component value defined by the planes defining box 201. Along each axis (x, y, z) min ,y min and z min The minimum value of ) can be defined by defining the "minimum" position as vector p. min , where p min =(x min y min , z min ), and along each axis (x max ,y max and z max The maximum value of ) can be defined by defining the "maximum" position as vector p. max , where p max =(x max ymax , z max Therefore, p min and p max It is the exact opposite corner position of box 201, and can be used in inequality (8) for edge comparison testing.
[0152] To simplify the edge comparison test, vector p′ min and p′ max It can be defined (and, for example, pre-computed) as follows:
[0153] p′ min =p min -o (9)
[0154] p′ max =p max -o (10)
[0155] Vector p′ min and p′ max Representing the origin (o) and p respectively min and p max The displacement between them. As described above, since box 201 is axis-aligned, it is evident that there are two planes of the bounding box on each axis: two "x" planes (planes with constant x components), two "y" planes (planes with constant y components), and two "z" planes (planes with constant z components). Vector p′ min The components represent the displacements of the x, y, and z components from the origin of the ray to the smallest x, y, and z plane. Vector p′ max The components represent the displacements of the x, y, and z components from the origin of the ray to the plane of maximum x, y, and z.
[0156] The choice between the minimum and maximum planes for evaluating inequality (8) will depend on which two planes intersect at the edge of the tested profile.
[0157] Equations (9) and (10) can be used to rewrite inequality (8) as:
[0158] p′ i d j ≤p′ j d i (11)
[0159] Where p′ i =p min,i -o i or p′ i =p max,i -o i , and p′ j =p min,j -o j or p′j = p max,j -o j .
[0160] For example, Figure 2 the profile edge 6 shown is along the intersection between the smallest x-plane (i.e., of the two planes having a constant x-value, the plane having the smaller x-value) and the largest z-plane (i.e., of the two planes having a constant z-value, the plane having the larger z-value). If the ray intersects the largest z-plane before intersecting the smallest x-plane, i.e., if p' d < p d, then the ray will pass the intersection test based on edge 6. max,z d x ≤ p' d min,x d z where p' = p - o and p' = p + o. max,z = p max,z -o z and p' = p - o. min,x = p min,x -o x
[0161] As another example, Figure 2 the profile edge 2 shown is along the intersection between the largest x-plane (i.e., of the two planes having a constant x-value, the plane having the larger x-value) and the largest y-plane (i.e., of the two planes having a constant y-value, the plane having the larger y-value). If the ray intersects the largest x-plane before intersecting the largest y-plane, i.e., if p' d < p d, then the ray will pass the intersection test based on edge 2. max,x d y ≤ p' d max,y d x where p' = p - o and p' = p + o. max,x = p max,x -o x and p' = p - o. max,y = p max,y -o y
[0162] How the test is performed for each of the six profile edges labeled 1 through 6 in FIG. 2A will be apparent. If all six tests are passed, then the ray is determined to intersect the box 201. However, if any one or more of the six tests is not passed, then the ray is determined not to intersect the box 201, i.e., the ray passes outside one or more of the six profile edges. Figure 2 Thus, to perform a ray intersection test on the box 201, an edge test is performed for each profile edge 1 through 6 to determine on which side of each of those edges the ray passes, with each edge test involving performing an evaluation to determine whether the condition specified in equation (11) is true for the two planes forming the edge being tested.
[0163] Thus, to perform a ray intersection test on the box 201, an edge test is performed for each profile edge 1 through 6 to determine on which side of each of those edges the ray passes, with each edge test involving performing an evaluation to determine whether the condition specified in equation (11) is true for the two planes forming the edge being tested.
[0164] As described in more detail below, a distance check and a direction check can also be performed to check whether the origin and direction of the ray cause the ray to be travelling away from the box, or whether the ray endpoint does not reach the box. If the ray is travelling away from the box, or the ray endpoint does not reach the box, the ray does not intersect the box and no edge tests need to be performed on the profile edges of the box.
[0165] Figure 3 An example of a ray tracing system for performing intersection tests is shown. The ray tracing system 300 is configured to implement intersection tests of rays with a box (e.g. an axis-aligned box).
[0166] The ray tracing system 300 comprises a dispatcher 301, a request queue 303, a memory 305 and a tester module 307. The tester module 307 comprises a test queue 309, a set of one or more test blocks (generally denoted 311) and a result processor 313. The request queue 303 and the test queue 309 can take the form of a buffer, such as a stack (i.e. a first-in, last-out (FILO) buffer) or a first-in, first-out (FIFO) buffer. The test blocks can be implemented as hardware units (e.g. using fixed function circuitry) or in software as shader code executed, for example, by a processing unit.
[0167] The dispatcher 301 receives instructions to trace a set of one or more rays (i.e. to perform intersection tests thereon). The dispatcher can collect the rays before sending them to the request queue 303. The dispatcher 301 can do so to group rays that need to access the same block or portion of the memory 305. A block or portion of the memory 305 can be a contiguous block of memory at a set of memory addresses that can be fetched together from the memory 305. A set of rays that reference the same block of the memory 305 can be referred to as a group. For example, rays to be tested with respect to the same box or object can be grouped into a group such that the data for the box or object can be fetched from the memory 305 once for the intersection tests of all the rays in the group. As an example, for an initial stage of the intersection tests, it can be that all the rays will intersect the root node and therefore need to access the same block of the memory 305, falling within one group. Once the dispatcher has collected one or more rays into a group, the dispatcher will issue the group and cause the group to join the request queue 303 to request the node data for the group from the memory 305 (i.e. the data describing the box corresponding to the appropriate node of the acceleration structure for which the rays of the group are to be tested for intersection). The node data for the group is then retrieved from the memory 305 and passed to the tester module 307.
[0168] At tester module 307, packet node data is received at test queue 309. Packet ray data is also received at the tester module. Packet ray data can be received from memory (e.g., memory 305), or in other examples, via... Figure 3 The link (not shown) receives ray data from request queue 303 to associate it with corresponding node data at test queue 309. Tester module 307 distributes rays from groups to test blocks 311. Tester module 307 can distribute rays sequentially. When rays from a group have been distributed to a test block, the test block performs an intersection test to, for example, pass through appropriate edges of the frame (e.g., as described above, for...). Figure 2 An edge test is performed on the six contour edges of the marked box 201 to determine whether the ray intersects with the box corresponding to the node targeted by the ray test.
[0169] Each test block outputs the results of the intersection tests it has performed to the result processor 313. The result processor 313 processes the results of the intersection tests. Specifically, if it is found that a ray does not intersect with the node it is testing, the processor 313 does not schedule an intersection test for the ray relative to the child nodes of the non-intersecting node. If the result processor 313 determines that a ray does intersect with the node it is testing, then the ray is output from the tester module 307 back to the scheduler 301, where the ray is grouped and scheduled to perform intersection tests relative to the child nodes of the intersecting node.
[0170] The above process is repeated iteratively until no more light rays hit the target. In response to a light ray intersecting a leaf node, objects within that leaf node (e.g., triangles) are scheduled to perform an intersection test with the light ray. Tester module 307 may include object test blocks ( Figure 3The object test block is configured to perform intersection tests against the rays that intersect the leaf node relative to the objects within the leaf node. Objects can be described as having triangular primitives, such that the object test block is configured to test the intersection of rays relative to triangles in the scene. Those skilled in the art will know how to test the intersection of a ray with a triangular primitive, and the details of this process are not described in detail herein. If the result of all intersection tests for a ray is that the ray does not intersect any objects in the scene, then a "miss" result is returned and can be processed accordingly. If the result of all intersection tests for a ray is that the ray intersects a single object, then the data for this intersection can be returned along with a "hit" result and processed accordingly. If the result of all intersection tests for a ray is that the ray intersects more than one object, then the intersection distances of the intersections (i.e. the distance from the ray origin to the intersection point) are compared to find the "closest hit", i.e. the intersection point closest to the ray origin (i.e. the intersection point with the smallest T value). The data for this closest hit intersection can be returned along with a "hit" result and processed accordingly.
[0171] As described above, in examples described herein, rays can be grouped into bundles, and then bundle intersection tests can be performed on the bundles of rays. This can reduce the number of intersection tests that need to be performed. The number of rays in a bundle can vary. There can be a maximum number of rays that can be included in a bundle, and this maximum number of rays can vary in different examples. For example, the maximum number of rays in a bundle can be 4, 16 or 32, as just three examples.
[0172] The methods described above for performing intersection tests relative to a box for individual rays can be extended to perform intersection tests relative to a box for bundles of rays. For example, Figure 4 is a flowchart of a method of performing intersection tests on bundles of rays, which can be performed by the tester module 307.
[0173] In step S402, a bundle of rays is received at the tester module 307. The bundle of rays is to be tested for intersection with a box. The bundle of rays is described in more detail below with reference to Figure 10 The flowchart shown describes an example process for grouping rays together to form a bundle. In a first example, all rays within a bundle have the same origin (but in other examples, the rays within a bundle can have different ray origins). The rays within a bundle can have different ray direction vectors. A vector for the bundle can be defined to provide a boundary to the bundle of rays, i.e. to define the edges of the bundle. The boundary vector for the bundle can tightly bound the rays within the bundle. For example, Figure 5 shows three bundles of rays being tested for intersection with a box Figure 5A 2D example of the intersection of the 2D rays (generally denoted as 504, 506, and 508) with the 2D box 502. The first ray bundle 504 has two vectors 5041 and 5042 that provide a boundary to the first ray bundle; the second ray bundle 506 has two vectors 5061 and 5062 that provide a boundary to the second ray bundle; and the third ray bundle 508 has two vectors 5081 and 5082 that provide a boundary to the third ray bundle. The indications of the ray bundles and the box are provided to the test block 311. Steps S404 to S416 can be performed by one of the test block 311.
[0174] In step S404, distance checks and direction checks are performed on the ray bundle with respect to the box. In step S406, it is determined whether the ray bundle passes the distance checks and the direction checks. The direction check determines whether the box is behind the origin of the ray bundle. In other words, the direction check determines whether the box is behind the origin when viewed from the origin of the ray bundle in a direction within the range of directions bounded by the boundary vectors of the ray bundle. For example, the direction check can involve, for each component (i.e., each of the x, y, and z components, generally denoted as the ith component), checking whether the component value of the origin of the bundle (o i ) is greater than the maximum component value of the box (p i ) if the component of the particular one of the boundary vectors of the bundle (d max,i ) is positive; and checking whether the component value of the origin of the bundle (o i ) is less than the minimum component value of the box (p i ) if the component of the particular one of the boundary vectors of the bundle (d min,i ) is negative. If either of these two conditions is satisfied for one or more of the components, it can be determined that the ray will not intersect the box without performing edge tests on the profile edges of the box. The particular one of the boundary vectors of the bundle selected in the direction check can depend on whether the bundle intersection test is a first bundle intersection test (i.e., an “AllHit” test) intended to determine whether all rays of the bundle hit the box, or a second bundle intersection test (i.e., an “AnyHit” test) intended to determine whether all rays of the bundle miss the box.
[0175] Figure 17 A 2D example of the following two axis-aligned boxes is shown: a box 1702 having a minimum component p min,a and a maximum component p max,a , and a box 1704 having a minimum component p min,b and a maximum component p max,b . Figure 17Three beams are also shown: beam 1706, with boundary vectors 17061 and 17062 (both with negative x-components); beam 1708, with boundary vectors 17081 (with negative x-components) and 17082 (with positive x-components); and beam 1710, with boundary vectors 17101 and 17102 (both with positive x-components). The origin of all beams 1706, 1708, and 1710 is located at position o. For example, for the AnyHit test, the direction test is useful when all (e.g., both) the i-th components of the beam's boundary vectors have the same sign (e.g., when the i-th component is an x-component, which is true for beams 1706 and 1710, but not for beam 1708). For example, if the boundary vector with the smallest i-th component has a positive i-th component, which means that the i-th component of all boundary vectors has a positive value (e.g., the boundary vectors of bundle 1710 all have positive x-components), then the boundary vector with the smallest i-th component (e.g., boundary vector 17101) is the "specific boundary vector" among the aforementioned boundary vectors. Because the i-th component of the "specific boundary vector" among the boundary vectors is positive, the direction check involves checking the component value (o) at the bundle origin. i Is it greater than the maximum component value of the box (p)? max,i For example, the x-component of boundary vector 17101 is positive, therefore the direction check involves checking the x-component (o) of the bundle origin. x Is it greater than the x component p? max,a (For box 1702) and p max,b (For box 1704). In Figure 17 In the example shown, bundle 1710 will pass the orientation check of the AnyHit test relative to box 1704, but will not pass the orientation check of the AnyHit test relative to box 1702. If the boundary vector with the largest i-th component has a negative i-th component, which means that the i-th component of all boundary vectors has a negative value (e.g., the boundary vectors of bundle 1706 all have negative x-components), then the boundary vector with the largest i-th component (e.g., boundary vector 17062) is the "specific boundary vector" among the aforementioned boundary vectors. Because the i-th component of the "specific boundary vector" among the boundary vectors is negative, the orientation check involves checking the component value (o) at the bundle origin. i Is it less than the minimum component value of the box (p)? min,i For example, the x-component of boundary vector 17062 is negative, therefore the direction check involves checking the x-component (o) of the bundle origin. x Is it less than the x component p? min,a (For box 1702) and p min,b (For box 1704). In Figure 17In the example shown, bundle 1706 will pass the orientation check of the AnyHit test relative to box 1702, but will not pass the orientation check of the AnyHit test relative to box 1704. For the AnyHit test, the orientation check does not determine whether an intersection with the box is possible if none of the i-th components of the boundary vectors have the same sign (e.g., for bundle 1708, the boundary vector with the smallest x-component does not have a positive x-component and the boundary vector with the largest x-component does not have a negative x-component). In contrast, for the AllHit test, the orientation test can be useful even if the signs of the i-th components of the boundary vectors are not all the same. For example, for the AllHit test, the boundary vector with the largest i-th component has a positive i-th component (e.g., when the i-th component is an x-component (true for bundles 1708 and 1710)), then the boundary vector with the largest i-th component (e.g., boundary vector 17082 for bundle 1708 and boundary vector 17102 for bundle 1710) is a “specific boundary vector” among the aforementioned boundary vectors. Because the i-th component of the "specific boundary vector" in the boundary vector is positive, the direction check involves checking the component value (o) at the origin of the bundle. i Is it greater than the maximum component value of the box (p)? max,i For example, the x-components of boundary vectors 17082 and 17102 are positive, therefore the orientation check of bundles 1708 and 1710 involves checking the x-component (o) of the bundle origin. x Is it greater than the x component p? max,a (For box 1702) and p max,b (For box 1704). In Figure 17 In the example shown, bundles 1708 and 1710 will pass the first direction check of the AllHit test relative to box 1704, but will not pass the first direction check of the AllHit test relative to box 1702. Similarly, for the AllHit test, if the boundary vector with the smallest i-th component has a negative i-th component (e.g., when the i-th component is the x-component, which is true for bundles 1706 and 1708), then the boundary vector with the smallest i-th component (e.g., boundary vector 17061 for bundle 1706 and boundary vector 17081 for bundle 1708) is the “specific boundary vector” among the aforementioned boundary vectors. Because the i-th component of the “specific boundary vector” among the boundary vectors is negative, the direction check involves checking the component value (o) at the origin of the bundle. i Is it less than the minimum component value of the box (p)? min,i For example, the x-components of boundary vectors 17061 and 17081 are negative, therefore the orientation check of bundles 1706 and 1708 involves checking the x-component (o) of the bundle origin. x Is it less than the x component p? min,a (For box 1702) and p min,b(for block 1704). In Figure 17 In the example shown, beam 1706 will pass the second direction check of the AllHit test with respect to block 1702, but will not pass the second direction check of the AllHit test with respect to block 1704. If a beam does not pass either direction check of the AllHit test, it is determined to have failed the direction test, and thus the intersection test result is a miss in Figure 17 In the example shown, beam 1708 will not pass the direction check of the AllHit test with respect to both blocks 1702 and 1704.
[0176] Summary of Direction Checks:
[0177] - For the AllHit test, for each of the i-th components:
[0178] o If the i-th component of either bounding vector of the beam is negative, a miss is found in p min,i >o i ; and
[0179] o If the i-th component of either bounding vector of the beam is positive, a miss is found in p max,i <o i ; and
[0180] - For the AnyHit test, for each of the i-th components:
[0181] o If the i-th component of both bounding vectors of the beam are negative, a miss is found in p min,i >o i ; and
[0182] o If the i-th component of both bounding vectors of the beam are positive, a miss is found in p max,i <o i .
[0183] A distance check determines whether a ray beam terminates at a point in front of a block. The maximum distance that a ray of a beam can travel in a scene before being terminated (or "clipped") can be provided in the data of the ray beam. If the distance check determines that the ray beam terminates at a point in front of the block (i.e., before it reaches the block), the intersection test result can be determined to be a miss of the block without needing to perform edge tests on the profile edges of the block. For example, the distance check can involve performing a check on each component (i.e., each of the x, y, and z components, generally denoted as the i-th component). If either of the components satisfies the inequality, it can be determined to have failed the distance check. For example, for the AnyHit test, if p min,i >o i , the distance check can determine, for each of the i-th components, which i-th component of which bounding vector has the greatest value, and then it can be determined whether pmin,i > o i + T max d i,max where T is the maximum value of T (i.e., the value of T when the ray is intercepted before it has intersected any object in the scene), where d max = max(d i,max , d i,1 ), and where d i,2 is the ithcomponent of the first bounding vector of the beam and d i,1 is the ithcomponent of the second bounding vector of the beam. In this example, the beam has only two bounding vectors. In this example, if p i,2 > o min,i + T i d max , then the distance check fails. For an AnyHit test, if p i,max < o max,i , then the distance check can determine which ithcomponent of which bounding vector has the minimum value, and then it can determine whether p i < o max,i + T i d max , where d i,min = min(d i,min , d i,1 ), and where d i,2 is the ithcomponent of the first bounding vector of the beam and d i,1 is the ithcomponent of the second bounding vector of the beam. In this example, the beam has only two bounding vectors. In this example, if p i,2 < o max,i + T i d max , then the distance check fails.
[0184] As another example, for an AllHit test, if p i,min > o min,i , then the distance check can determine which ithcomponent of which bounding vector has the minimum value (thus identifying d i ), and then it can determine whether p i,min > o min,i + T i d max . In this example, if p i,min > o min,i + T i d max , then the distance check fails. For an AllHit test, if p i,min < o max,i , then the distance check can determine which ithcomponent of which bounding vector has the minimum value (thus identifying d ithen the distance check can determine, for each of the i-th components, which of the boundary vectors has the largest i-th component (thereby identifying d i,max max,i i max i,max In this example, if p max,i i max i,max then the distance check fails. In the example of the distance check described above, if the distance check fails, then the intersection test result is determined to be that the ray bundle misses the box without needing to perform edge tests on the profile edges of the box.
[0185] If the distance check or the direction check fails, then the method proceeds from step S406 to step S408. In step S408, the intersection test result is determined to be that the ray bundle misses the box. This intersection test result can be output from the test block 311 to the result processor 313 without performing steps S410 to S416.
[0186] If the distance check and the direction check pass, then the method proceeds from step S406 to step S410.
[0187] The distance check and the direction check are optional, i.e. in some examples, steps S404 to S408 can not be performed. Performing the distance check and the direction check (in steps S404 to S408) can reduce the number of edge tests that need to be performed on the profile edges, because some intersection test results (i.e. misses) can be determined by the distance check and the direction check without needing to perform edge tests on the profile edges.
[0188] In step S410, the test block 311 identifies the profile edges of the box from the perspective of the ray bundle.
[0189] Steps S412 and S414 are performed for each profile edge identified in step S410.
[0190] In step S412, components of a vector are obtained that provide a bound to the beam of rays. The vector whose components are obtained depends on the particular silhouette edge being tested, and different vectors can have their components obtained for different silhouette edges. The components of a vector can be "obtained" by determining (e.g., calculating) the components of the vector or by receiving (e.g., reading) the components of the vector. The vector can or can not be the same as the direction vector of one of the rays of the beam. For example, the components of the vector can be obtained by identifying the minimum component value and the maximum component value in each dimension from the direction vectors of the rays in the beam, where the obtained components of the vector that provide a bound to the beam of rays are selected from a set of component values including the identified minimum component value and the identified maximum component value in each dimension.
[0191] If the beam of rays does not pass outside the identified silhouette edge, then it is known that none of the rays of the beam pass outside the silhouette edge, in which sense the vector can provide an outside bound to the beam of rays with respect to the silhouette edge. Also, if the beam of rays does not pass inside the identified silhouette edge, then it is known that none of the rays of the beam pass inside the silhouette edge, in which sense the vector can provide an inside bound to the beam of rays with respect to the silhouette edge.
[0192] In step S414, the test block 311 determines whether the vector obtained in step S412 passes inside or outside the silhouette edge in question. This can be done as described above in relation to the single ray versus box test, e.g. according to the inequality (11) given above. In the examples described herein, for each silhouette edge a single vector is obtained in step S412 and tested in step S414. The choice of which bound vector to test with respect to each silhouette edge depends on whether an AllHit test or an AnyHit test is performed, as explained in more detail below.
[0193] In step S416, the result of the beam intersection test relative to the frame is determined using the result of whether each determined vector in the identified contour edge passes inside or outside the contour edge. For example, if the test of all contour edges indicates that the corresponding vector passes inside the corresponding contour edge, then in step S416, the result of the beam intersection test relative to the frame is determined as "hit" or "pass"; while if the test of one or more contour edges indicates that the corresponding vector passes outside the corresponding contour edge, then in step S416, the result of the beam intersection test relative to the frame is determined as "miss" or "fail". For the AnyHit test, a "pass" or "hit" result means that all beams of the beams not yet identified in the test miss the frame, while a "fail" or "miss" result means that all beams of the beams already identified in the test miss the frame. For the AllHit test, a "pass" or "hit" result means that all beams of the beams already identified in the test hit the frame, while a "fail" or "miss" result means that all beams of the beams not yet identified in the test hit the frame.
[0194] For example, a beam intersection test could be an AllHit test (e.g., if the test output is inverted, it could be called an "AnyMiss test"). As described above, the AllHit test has only two possible outcomes: (i) the AllHit test determines that all rays of the beam intersect the frame, or (ii) the AllHit test is uncertain that all rays of the beam intersect the frame. In this example, for each of the outline edges of the marker, the vector obtained in step S412 provides an outer boundary to the beam of rays relative to the outline edge of the marker. If the beam of rays does not pass outside the outline edge of the marker, it is known that none of the rays of the beam pass outside the outline edge of the marker, and in this sense, the vector provides an outer boundary to the beam of rays relative to the outline edge of the marker. As mentioned above, the vector can have the maximum or minimum component value of the ray direction vector of the rays in the beam in each dimension. The choice of maximum or minimum component value in each dimension depends on the outline edge being tested and whether the vector provides an inner or outer boundary. The resulting vector can be the same as or different from the direction vector of one ray of the beam.
[0195] If each defined vector in the outline edge of the sign passes inside the outline edge of the sign, the result of the intersection test of the ray beam with respect to the box is that all rays in the ray beam intersect the box. If one or more defined vectors in the outline edge of the sign pass outside the outline edge of the corresponding sign, the result of the intersection test of the ray beam with respect to the box is not that all rays in the ray beam intersect the box; for example, one or more rays in the beam may miss the box.
[0196] For example, in Figure 5In the illustrated 2D example, the AllHit test can be performed on the first ray bundle 504 with respect to the 2D box 502. In the 2D example, the contour edge reduces to only two contour points, at Figure 5 With respect to the contour point 5101, the vector 5041 is obtained for the bundle 504 (in step S412), because this vector 5041 provides an outer bound to the bundle 504 with respect to the contour point 5101, i.e. if the bundle does not pass outside the identified contour point 5101, it is known that none of the rays of the bundle 504 pass outside the identified contour point 5101. In step S414, it is determined that the vector 5041 passes inside the contour point 5101. In particular, with respect to the contour point 5101, it is determined (p min,x -o x )d y,1 ≤(p max,y -o y )d x,1 where p min,x and p max,y are the x-component value and the y-component value at the point 5101, o x and o y are the x-component value and the y-component value of the origin of the ray bundle 504, and d x,1 and d y,1 are the x-component value and the y-component value of the direction of the vector 5041. This test determines that all rays of the ray bundle 504 pass inside the contour point 5101 of the box 502. With respect to the contour point 5102, the vector 5042 is obtained for the bundle 504 (in step S412), because this vector 5042 provides an outer bound to the bundle 504 with respect to the contour point 5102. In step S414, it is determined that the vector 5042 passes inside the contour point 5102. In particular, with respect to the contour point 5102, it is determined (p min,y -o y )d x,2 ≤(p max,x -o x )d y,2 where p max,x and p min,y are the x-component value and the y-component value at the point 5102, o x and o y are the x-component value and the y-component value of the origin of the ray bundle 504, and d x,2 and d y,2These are the x and y component values of the direction of vector 5042. This test determines that all rays of the ray beam 504 pass inside the contour point 5102 of the frame 502. These two tests are sufficient to determine that all rays of the beam 504 hit the frame 502. Therefore, in step S416, it is determined that the result of the AllHit test of the ray beam 504 relative to the frame 502 is that all rays of the beam 504 hit the frame 502.
[0197] As another example, in Figure 5 In the 2D example shown, an AllHit test can be performed on the second ray beam 506 relative to the 2D frame 502. A vector 5061 is obtained for the beam 506 (in step S412) relative to the contour point 5101, because this vector 5061 provides the outer boundary of the beam 506 relative to the contour point 5101. In step S414, it is determined that the vector 5061 passes through the interior of the contour point 5101. Specifically, relative to the contour point 5101, it is determined according to inequality (11) that (p min,x -o x )d y,1 ≤(p max,y -o y )d x,1 , where p min,x and p max,y These are the x and y component values at point 5101, o x and o y These are the x and y component values of the origin of the ray beam 506, and d x,1 and d y,1 These are the x and y component values of the direction of vector 5061. This test determines that all rays of the ray bundle 506 pass inside the contour point 5101 of the frame 502. Vector 5062 is obtained for the bundle 506 (in step S412) relative to the contour point 5102, because this vector 5062 provides the outer boundary of the bundle 506 relative to the contour point 5102. In step S414, it is determined that vector 5062 passes outside the contour point 5102. Specifically, relative to the contour point 5102, it is determined that the ray bundle 506 does not satisfy inequality (11). In other words, for the ray bundle 506, the following is not true: (p min,y -o y )d x,2 ≤(p max,x -o x )d y,2 , where p max,x and p min,y These are the x and y component values at point 5102, o x and o y These are the x and y component values of the origin of the ray beam 506, and d x,2 and dy,2 These are the x and y component values of the direction of vector 5062. This test does not guarantee that all rays of ray beam 506 will pass inside the contour point 5102 of frame 502. Therefore, in step S416, the result of the AllHit test of ray beam 506 relative to frame 502 is not that all rays of beam 506 will hit frame 502. In other words, the AllHit test does not guarantee that all rays of beam 506 will hit frame 502.
[0198] As another example, in Figure 5 In the 2D example shown, an AllHit test can be performed on the third ray beam 508 relative to the 2D frame 502. A vector 5081 is obtained for the beam 508 (in step S412) relative to the contour point 5101, because this vector 5081 provides the outer boundary of the beam 508 relative to the contour point 5101. In step S414, it is determined that the vector 5081 passes through the interior of the contour point 5101. Specifically, relative to the contour point 5101, it is determined according to inequality (11) that (p min,x -o x )d y,1 ≤(p max,y -o y )d x,1 , where p min,x and p max,y These are the x and y component values at point 5101, o x and o y These are the x and y component values of the origin of the ray beam 508, and d x,1 and d y,1 These are the x and y component values of the direction of vector 5081. This test determines that all rays of the ray beam 508 pass inside the contour point 5101 of the frame 502. Vector 5082 is obtained for the beam 508 (in step S412) relative to the contour point 5102, because this vector 5082 provides the outer boundary of the beam 508 relative to the contour point 5102. In step S414, it is determined that vector 5082 passes outside the contour point 5102. Specifically, relative to the contour point 5102, it is determined that the ray beam 508 does not satisfy inequality (11). In other words, for the ray beam 508, the following is not true: (p min,y -o y )d x,2 ≤(p max,x -o x )d y,2 , where p max,x and p min,y These are the x and y component values at point 5102, o x and o y These are the x and y component values of the origin of the ray beam 508, and dx,2 and d y,2 These are the x and y component values of the direction of vector 5082. This test does not guarantee that all rays of ray beam 508 will pass inside the contour point 5102 of frame 502. Therefore, in step S416, the result of the AllHit test of ray beam 508 relative to frame 502 is not that all rays of beam 508 will hit frame 502. In other words, the AllHit test does not guarantee that all rays of beam 508 will hit frame 502.
[0199] As can be seen, the AllHit test results are the same for beams 506 and 508, namely, it is not confirmed that all rays in beams 506 or 508 hit box 502. This is also true even if some rays in beam 508 do hit box 502.
[0200] Figure 6 This shows that three light beams will be tested. Figure 6 The 3D example of the intersection of the 3D box (generally represented as 604, 606, and 608) with the 3D box 602. Figure 6 It is drawn from the perspective of the origin of the light rays. The first ray beam 604 consists of four rays ( Figure 6 (Shown in black circles), and the dashed box represents the axis-aligned box defining the ray beam 604, that is, the axis-aligned box whose minimum and maximum component values in each of the x, y, and z dimensions are equal to the minimum and maximum component values of the direction vector of the ray in the beam. The second ray beam 606 includes four rays ( Figure 6 (Shown in black circles), and the dashed box indicates the axis alignment frame defining the ray beam 606. The third ray beam 608 includes four rays ( Figure 6 (shown as a black circle in the middle), and the dashed box indicates the axis alignment frame that defines the ray beam 608.
[0201] An AllHit test can be performed on the first ray beam 604 relative to the 3D frame 602. The frame 602 has six contour edges. Figure 6 The values are represented as 1 to 6. Relative to contour edge 1, the components of the vector with the maximum y and z values of the direction vector of the light rays of bundle 604 are obtained. In this example, the upper right ray shown in bundle 604 is an example of a ray with these component values in the y and z directions. This vector provides an outer boundary to bundle 604 relative to contour edge 1, i.e., if the bundle does not pass outside the identified contour point 5101, then it is known that the light rays of bundle 604 do not pass outside the identified contour edge 1. In step S414, it is determined that the vector passes inside contour edge 1. Specifically, relative to contour edge 1, it is determined according to inequality (11) (p max,z -o z )d y ≤(pmax,y -o y )d z where p max,z is the z-component value of the plane on the top of the box 602, p max,y is the y-component value of the plane on the back right of the box 602, o y and o z are the y and z component values of the origin of the ray bundle 604, and d y and d z are the y and z component values of the vector that defines the outer bound of the bundle 604 relative to the contour edge 1. This test determines that all the rays of the ray bundle 604 pass inside the contour edge 1 of the box 602. Relative to the contour edge 6, the components of the vector that will have the minimum x value and the maximum z value of the direction vectors of the rays of the bundle 604 are obtained. The vector with these x and z components will provide the outer bound to the bundle 604 relative to the contour edge 6. It should be noted that in this example, none of the four vectors in the bundle 604 have both the minimum x value and the maximum z value. In step S414, it is determined that the vector with the obtained x and z components passes inside the contour edge 6. Specifically, relative to the contour edge 6, it is determined from the inequality (11) that max,z -o z )d x ≤(p min,x -o x )d z where p max,z is the z-component value of the plane on the top of the box 602, p min,x is the x-component value of the plane on the back left of the box 602, o x and o z are the x and z component values of the origin of the ray bundle 604, and d x and d z are the x and y component values of the vector that defines the outer bound of the bundle 604 relative to the contour edge 6. This test determines that all the rays of the ray bundle 604 pass inside the contour edge 6 of the box 602. For brevity, we have not described the tests of the bundle 604 relative to the contour edges 2 to 5, but from the description of the tests relative to the contour edges 1 and 6, and from the symmetry of the box 602, it is clear that the same tests are performed. Figure 6 It will be apparent that the AllHit test will determine that all the rays of the bundle 604 pass inside all the contour edges of the box 602. Therefore, in step S416, it is determined that the result of the AllHit test of the ray bundle 604 relative to the box 602 is that all the rays of the bundle 604 hit the box 602.
[0202] An AllHit test can be performed on the second ray beam 606 relative to the 3D frame 602. The components of the vector with the maximum x and y values of the direction vector of the ray beam 606 are obtained relative to the contour edge 2. In this example, the upper right ray shown in the beam 606 is an example of a ray with these component values in the x and y directions. This vector provides an outer boundary to the beam 606 relative to the contour edge 2. In step S414, it is determined that the vector crosses outside the contour edge 2. Specifically, relative to the contour edge 2, inequality (11) is not satisfied, i.e., it is not (p max,x -o x )d y ≤(p max,y -o y )d x , where p max,x It is the x-component value of the plane to the right front of frame 602, p max,y It is the y-component value of the plane to the right rear of frame 602, o x and o y These are the x and y component values of the origin of the ray beam 606, and d x and d y These are the x and y component values of the vector defining bundle 606 relative to the outer boundary of contour edge 2. For simplicity, we have not described the test of bundle 606 relative to contour edges 1 or 3 through 6, but from... Figure 6 It will be apparent that the AllHit test will determine that all rays of beam 606 are inside contour edges 3 to 6 of frame 602, but not all rays of beam 606 are inside contour edge 1. Therefore, in step S416, the result of the AllHit test on beam 606 relative to frame 602 does not determine that all rays of beam 606 hit frame 602. It should be noted that in some examples (e.g., implemented in software), tests may be performed sequentially on different contour edges, and in these examples, the result of the AllHit test may be determined immediately after obtaining a first “fail” or “missed” result for a contour edge (e.g., contour edge 1 in the example given above regarding beam 606), which avoids testing one or more other contour edges (e.g., contour edges 2-6). However, in other examples (e.g., implemented in hardware), tests may be performed on different contour edges in parallel.
[0203] Similarly, an AllHit test can be performed on the third ray bundle 608 with respect to the 3D box 602. With respect to the profile edge 5, the components of the vector having the minimum x and y values of the direction vectors of the rays of the bundle 608 will be obtained. In this example, the lower left ray shown in the bundle 608 is an example of a ray having these component values in the x and y directions. This vector provides an outer bound to the bundle 608 with respect to the profile edge 5. In step S414, it is determined that the vector passes outside of the profile edge 5. Specifically, with respect to the profile edge 5, the inequality (11) is not satisfied, i.e., not (p min,y -o y )d x ≤(p min,x -o x )d y where p min,x is the x component value of the plane behind the left of the box 602, p min,y is the y component value of the plane in front of the left of the box 602, o x and o y are the x and y component values of the origin of the ray bundle 608, and d x and d y are the x and y component values of the vector defining the outer bound of the bundle 608 with respect to the profile edge 5. For brevity, we have not described the testing of the bundle 608 with respect to the profile edges 1-4 or 6, but it will be apparent that the AllHit test will determine that all of the rays of the bundle 608 are inside of the profile edges 1-4 and 6 of the box 602. Figure 5 As a result of the testing with respect to the profile edge 5, in step S416, the result of the AllHit test of the ray bundle 608 with respect to the box 602 is not that all of the rays of the bundle 608 hit the box 602.
[0204] If the result of the AllHit test of the ray bundle with respect to the box is not that all of the rays of the ray bundle intersect the box (e.g., bundles 506 and 508 with respect to the box 502 and bundles 606 and 608 with respect to the box 602), the method can further include determining whether any of the rays of the ray bundle intersect the box.
[0205] As another example, the beam intersection test can be an AnyHit test (e.g., if the test output is inverted, it can be called an "AllMiss test"). As described above, the AnyHit test has only two possible outcomes: (i) the AnyHit test determines that all rays of the beam miss the frame, or (ii) the AnyHit test is uncertain whether all rays of the beam miss the frame. In this example, for each of the identified contour edges, the vector obtained in step S412 provides an inner boundary to the beam of rays relative to the identified contour edge. If the beam of rays does not pass inside the contour edge of the identified beam, it is known that none of the rays of the beam pass inside the contour edge of the identified beam, and in this sense, the vector provides an inner boundary to the beam of rays relative to the contour edge of the identified beam. As mentioned above, the vector can have the maximum or minimum component value of the ray direction vector of the rays in the beam in each dimension. The choice of maximum or minimum component value in each dimension depends on the contour edge being tested and whether the vector provides an inner or outer boundary. The resulting vector can be the same as or different from the direction vector of one ray of the beam.
[0206] If for each defined vector in the outline edge of the identifier it passes inside the outline edge of the identifier, the intersection test result of the ray beam relative to the box is not that all rays in the ray beam miss the box. If for one or more defined vectors in the outline edge of the identifier it passes outside the outline edge of the corresponding identifier, the intersection test result of the ray beam relative to the box is that all rays in the ray beam miss the box.
[0207] For example, in Figure 5 In the 2D example shown, an AnyHit test can be performed on the first ray beam 504 relative to the 2D frame 502. A vector 5042 is obtained for the beam 504 (in step S412) relative to the contour point 5101, because this vector 5042 provides an internal boundary to the beam 504 relative to the contour point 5101; that is, if the beam does not pass inside the identified contour point 5101, then it is known that the rays of the beam 504 do not pass inside the identified contour point 5101. In step S414, it is determined that the vector 5042 passes inside the contour point 5101. Specifically, relative to the contour point 5101, it is determined according to inequality (11) that (p min,x -o x )d y,2 ≤(p max,y -o y )d x,2 , where p min,x and p max,y These are the x and y component values at point 5101, o x and o y These are the x and y component values of the origin of the ray beam 504, and dx,2 and d y,2 These are the x and y component values of the direction of vector 5042. Vector 5041 is obtained relative to contour point 5102 for bundle 504 (in step S412) because this vector 5041 provides the inner boundary of bundle 504 relative to contour point 5102. In step S414, it is determined that vector 5041 passes through the interior of contour point 5102. Specifically, relative to contour point 5102, it is determined according to inequality (11) (p min,y -o y )d x,1 ≤(p max,x -o x )d y,1 , where p max,x and p min,y These are the x and y component values at point 5102, o x and o y These are the x and y component values of the origin of the ray beam 504, and d x,1 and d y,1 These are the x and y component values of the direction of vector 5041. The results of these two tests are used to determine that not all rays from beam 504 miss frame 502. Therefore, in step S416, the result of the AnyHit test on beam 504 relative to frame 502 does not determine that all rays from beam 504 miss frame 502; for example, at least one ray from beam 504 may hit frame 502. In other words, the AnyHit test does not guarantee that all rays from beam 504 miss frame 502.
[0208] As another example, in Figure 5 In the 2D example shown, an AnyHit test can be performed on the second ray beam 506 relative to the 2D frame 502. A vector 5062 is obtained for the beam 506 (in step S412) relative to the contour point 5101, because this vector 5062 provides the inner boundary of the beam 506 relative to the contour point 5101. In step S414, it is determined that the vector 5062 passes through the interior of the contour point 5101. Specifically, relative to the contour point 5101, it is determined according to inequality (11) that (p min,x -o x )d y,2 ≤(p max,y -o y )d x,2 , where p min,x and p max,y These are the x and y component values at point 5101, o x and o y These are the x and y component values of the origin of the ray beam 506, and d x,2 and d y,2These are the x and y component values of the direction of vector 5062. Vector 5061 is obtained for bundle 506 (in step S412) relative to contour point 5102, because this vector 5061 provides the inner boundary of bundle 506 relative to contour point 5102. In step S414, it is determined that vector 5061 passes outside contour point 5102. Specifically, relative to contour point 5102, it is determined that ray bundle 506 does not satisfy inequality (11). In other words, for ray bundle 506, the following is not true: (p min,y -o y )d x,1 ≤(p max,x -o x )d y,1 , where p max,x and p min,y These are the x and y component values at point 5102, o x and o y These are the x and y component values of the origin of the ray beam 506, and d x,1 and d y,1 These are the x and y component values of the direction of vector 5061. This test determines that all rays of the ray beam 506 pass outside the contour point 5102 of the frame 502. Therefore, in step S416, the result of the AnyHit test of the ray beam 506 relative to the frame 502 is that all rays of the beam 506 miss the frame 502.
[0209] As another example, in Figure 6 In the 2D example shown, an AnyHit test can be performed on the third ray beam 508 relative to the 2D frame 502. A vector 5082 is obtained for the beam 508 (in step S412) relative to the contour point 5101, because this vector 5082 provides the inner boundary of the beam 508 relative to the contour point 5101. In step S414, it is determined that the vector 5082 passes through the interior of the contour point 5101. Specifically, relative to the contour point 5101, (p) is determined according to inequality (11). min,x -o x )d y,2 ≤(p may,y -o y )d x,2 , where p min,x and p max,y These are the x and y component values at point 5101, o x and o y These are the x and y component values of the origin of the ray beam 508, and d x,2 and d y,2These are the x and y component values of the direction of vector 5082. Vector 5081 is obtained relative to contour point 5102 for bundle 508 (in step S412) because this vector 5081 provides the inner boundary of bundle 508 relative to contour point 5102. In step S414, it is determined that vector 5081 passes through the interior of contour point 5102. Specifically, relative to contour point 5102, it is determined according to inequality (11) (p min,y -o y )d x,1 ≤(p max,x -o x )d y,1 , where p max,x and p min,y These are the x and y component values at point 5102, o x and o y These are the x and y component values of the origin of the ray beam 508, and d x,1 and d y,1 These are the x and y component values of the direction of vector 5081. Therefore, in step S416, the result of the AnyHit test of the light beam 508 relative to the box 502 does not guarantee that all rays of the beam 508 will miss the box 502; for example, at least one ray of the beam 508 may hit the box 502. In other words, the AnyHit test does not guarantee that all rays of the beam 508 will miss the box 502.
[0210] As can be seen, the AnyHit test results are the same for both beams 504 and 508, namely, all rays in beams 504 or 508 miss frame 502. This is also true even if some rays in beam 508 do not hit frame 502.
[0211] refer to Figure 6 The 3D example shown can perform an AnyHit test on the first ray beam 604 relative to the 3D frame 602. The components of the vector with the minimum y and z values of the direction vector of the ray beam 604 are obtained relative to the contour edge 1. In this example, the lower left ray shown in the beam 604 is an example of a ray with these component values in the y and z directions. This vector provides an inner boundary to the beam 604 relative to the contour edge 1. In step S414, it is determined that the vector passes through the interior of the contour edge 1. Specifically, relative to the contour edge 1, it is determined according to inequality (11) that (p max,z -o z )d y ≤(p max,y -o y )d z , where p max,z It is the z-component value of the plane on the top of frame 602, p max,yis the y-component value of the plane at the back right of the box 602, o y and o z are the y-component value and z-component value of the origin of the ray bundle 604, and d y and d z are the y-component value and z-component value of the vector that defines the inner boundary of the bundle 604 with respect to the contour edge 1. With respect to the contour edge 6, the components of the vector that has the maximum x value and the minimum z value of the direction vectors of the rays of the bundle 604 will be obtained. The vector with these x and z components will provide an inner boundary to the bundle 604 with respect to the contour edge 6. It should be noted that in this example, none of the four vectors in the bundle 604 has both the maximum x value and the minimum z value. In step S414, it is determined that the vector with the obtained x and z components passes inside the contour edge 6. Specifically, with respect to the contour edge 6, the inequality (11) is determined to be not true, i.e. (p max,z -o z )d x ≤(p min,x -o x )d z where p max,z is the z-component value of the plane on the top of the box 602, p min,x is the x-component value of the plane at the back left of the box 602, o x and o z are the x-component value and z-component value of the origin of the ray bundle 604, and d x and d z are the x-component value and y-component value of the vector that defines the inner boundary of the bundle 604 with respect to the contour edge 6. For brevity, we have not described the testing of the bundle 604 with respect to the contour edges 2 to 5, but from the description of the testing of the contour edges 1 and 6, and from the description of the AnyHit testing of the bundle 604 with respect to the contour edge 6, it will be apparent how to perform the AnyHit testing of the bundle 604 with respect to the contour edges 2 to 5. Figure 6 It will be apparent that the AnyHit testing will determine that the ray bundle 604 is inside all the contour edges of the box 602. Therefore, in step S416, the result of the AnyHit testing of the ray bundle 604 with respect to the box 602 is not that all the rays of the bundle 604 miss the box 602, e.g. one or more rays of the bundle 604 can hit the box 602.
[0212] The AnyHit testing can be performed with respect to the 3D box 602 also for the second ray bundle 606. With respect to the contour edge 2, the components of the vector that has the minimum x value and y value of the direction vectors of the rays of the bundle 606 will be obtained. In this example, the lower left ray shown in the bundle 606 is an example of a ray that has these component values in the x and y directions. This vector provides an inner boundary to the bundle 606 with respect to the contour edge 2. In step S414, it is determined that the vector passes outside the contour edge 2. Specifically, with respect to the contour edge 2, the inequality (11) is not satisfied, i.e. (p max,x -ox d y ≤(p max,y -o y )d x where p max,x is the x-component value of the plane to the right front of the box 602, p max,y is the y-component value of the plane to the right back of the box 602, o x and o y are the x-component value and the y-component value of the origin of the ray bundle 606, and d x and d y are the x-component value and the y-component value of the vector that defines the inner boundary of the bundle 606 with respect to the contour edge 2. This test determines that all the rays of the ray bundle 606 pass outside the contour edge 2 of the box 602. For brevity, we do not describe the tests of the bundle 606 with respect to the contour edges 1 or 3 to 6, but it will be evident from the description of the tests of the bundle 606 with respect to the contour edge 2 that the AnyHit test of the ray bundle 606 with respect to the box 602 in step S416 is determined by the fact that all the rays of the bundle 606 miss the box 602. Figure 6 It will be evident that the AnyHit test will determine that the bundle 606 is inside the contour edges 1 and 3 to 6 of the box 602. As a result of the test with respect to the contour edge 2, the result of the AnyHit test of the ray bundle 606 with respect to the box 602 in step S416 is determined by the fact that all the rays of the bundle 606 miss the box 602.
[0213] An AnyHit test can be performed with respect to the 3D box 602 on a third ray bundle 608. With respect to the contour edge 5, the components of the vector with the maximum x and y values of the direction vectors of the rays of the bundle 608 are obtained. In this example, the upper right ray shown in the bundle 608 is an example of a ray with these component values in the x and y directions. This vector provides an inner boundary to the bundle 608 with respect to the contour edge 5. In step S414, it is determined that the vector passes inside the contour edge 5. In particular, with respect to the contour edge 5, the inequalities (11) are satisfied, i.e., (p min,y -o y )d x ≤(p min,x -o x )d y where p min,x is the x-component value of the plane to the left back of the box 602, p min,y is the y-component value of the plane to the left front of the box 602, o x and o y are the x-component value and the y-component value of the origin of the ray bundle 608, and d x and d y are the x-component value and the y-component value of the vector that defines the inner boundary of the bundle 608 with respect to the contour edge 5. For brevity, we do not describe the tests of the bundle 608 with respect to the contour edges 1 to 4 or 6, but it will be evident from the description of the tests of the bundle 608 with respect to the contour edge 5 that the AnyHit test of the ray bundle 608 with respect to the box 602 in step S416 is determined by the fact that all the rays of the bundle 608 miss the box 602. Figure 10It will be apparent that the AnyHit test will determine that the bundle 608 is inside the profile edges 1 to 4 and 6 of the box 602. Thus, in step S416, the result of the AnyHit test of the bundle 608 relative to the box 602 is not a determination that all of the rays of the bundle 608 miss the box 602, e.g., one or more of the rays of the bundle 608 can hit the box 602.
[0214] If the intersection test result of the AnyHit test of the bundle of rays relative to the box is not that all of the rays in the bundle of rays miss the box, the method can further comprise determining which of the rays in the bundle of rays intersect the box. Alternatively, if the intersection test result of the AnyHit test of the bundle of rays relative to the box corresponding to the parent node in the hierarchical acceleration structure is not that all of the rays in the bundle of rays miss the box, the method can further comprise performing an AnyHit test on the box corresponding to a child node, i.e., a node that is a child of the parent node in the hierarchical acceleration structure.
[0215] In some examples traversing a hierarchical acceleration structure, a ray bundle can be tested against a box corresponding to a root node of the acceleration structure using an AnyHit test. If the result of the AnyHit test for the bundle is "hit" (which can be referred to as "passing") (i.e., if the result of the AnyHit test does not indicate that all rays in the bundle miss the box), the bundle can be tested against boxes corresponding to each of some nodes that are children of the node in the acceleration structure for which the box was found to intersect the bundle. This process continues down the hierarchy of the acceleration structure. If the bundle fails the AnyHit test (i.e., the AnyHit test determines that all rays of the bundle miss the box), the bundle is not tested against boxes corresponding to some nodes that are children of the node for which the AnyHit test returned "miss" or "failed." If any ray in the bundle would hit the box, the entire bundle is pulled down to be tested at the next lower level of the acceleration structure. As the bundle penetrates deeper into the hierarchical acceleration structure (i.e., when the bundle is tested against lower levels of the acceleration structure), the boxes against which the bundle is tested become smaller, and the likelihood of rays unnecessarily participating in intersection tests against boxes that they miss increases. Thus, there can be a threshold level in the hierarchical acceleration structure such that below the threshold level, if the bundle passes the AnyHit test at the threshold level, the bundle will be split into individual rays to be tested against boxes corresponding to nodes at levels below the threshold level. In different examples, the threshold level can be different, and as two examples, the threshold level can be based on node depth in the hierarchical acceleration structure, or based on the size of the bounding box being tested. If the ray bundle passes the AnyHit test for a leaf node, the rays of the bundle can be split from the bundle, and the individual rays can be tested for intersection with the primitive pointed to by the leaf node's pointer. Alternatively, the bundle can be tested for intersection with the primitive pointed to by the leaf node's pointer. The system can include different test blocks to test rays against primitives, rather than against boxes. Note that the shape of a primitive is not typically rectangular or cubical (primitives are typically triangular).
[0216] In the examples described above, all rays of a ray bundle have the same origin. This helps to simplify the intersection tests performed on the ray bundle. However, if a bundle can only contain rays with the same origin, this greatly limits which rays can be grouped together to form a bundle, meaning that some rays can not be able to be grouped into a bundle. Primary rays typically have the same origin (i.e., corresponding to the viewpoint from which the scene is being observed). However, secondary rays (i.e., rays emitted from an intersection point in the scene) typically have different origins. Allowing rays with different origins to be grouped together into a bundle can increase the number of rays (specifically, secondary rays) that can be grouped together into a bundle. Reference is made below to Figures 16a to 16cThe method of grouping rays together into bundles is described in more detail. In some examples, not all rays of a bundle of rays have the same origin. For example, the rays within a bundle of rays can have different origins. The origins can be within a threshold difference, above which a ray would not be included in the same bundle. In these examples, even though the origins of the rays within a bundle can not be exactly the same, the difference between the origins of the rays in the bundle is not large. This allows for an intersection test to be performed on the bundle while still providing useful results about the rays of the bundle.
[0217] For example, the data for a bundle can specify the maximum and minimum ray origin component values in each dimension for the rays within the bundle. For example, the vector o min and o max may be specified, where the x, y, and z components of o min are the minimum values of the x, y, and z component values of the origins of the rays in the bundle, and where the x, y, and z components of o max are the maximum values of the x, y, and z component values of the origins of the rays in the bundle. During an intersection test, when calculating the distance from the ray origin to the plane representing a side of a box, the distance to the minimum origin or the maximum origin of the bundle in a particular dimension is used. The choice of using the minimum component or the maximum component of the origin of the ray of the bundle in an intersection test depends on whether an AllHit test or an AnyHit test is being performed.
[0218] For example, for an AnyHit test, it is better to produce a hit result (i.e., a pass, which indicates that not all rays in the bundle missed the box) than a miss result (i.e., a fail, which indicates that all rays in the bundle missed the box). This is because if the AnyHit test produces a false miss result (i.e., a miss result when one or more rays of the bundle actually hit the box), this can cause a rendering error; whereas if the AnyHit test produces a false hit result (i.e., a hit result when all rays of the bundle actually missed the box), this does not cause a rendering error, but can decrease the efficiency of the intersection test because additional intersection tests are performed unnecessarily. Thus, the effective size of the box is increased so that the maximum origin component value is used in the case of the example given above, in the value (p min,i -o i ) is replaced with the value (p min,i -o max,i ), where i e {x, y, z}, where o max,i is the maximum value of the i-th component of the origins of the rays of the bundle. Furthermore, to increase the effective size of the box, the minimum origin component value is used in the case of the example given above, in the value (p max,i -o i ) is replaced with the value (pmax,i -o min,i ), where i e {x, y, z}, where o min,i is the minimum value of the i-th component of the origin of the rays of the bundle.
[0219] For example, for an AllHit test, it is better to produce a miss result (i.e., fail, which indicates that not all rays in the bundle hit the box) than a hit result (i.e., pass, which indicates that all rays in the bundle hit the box). This is because if the AllHit test produces a false hit result (i.e., a hit result when one or more rays of the bundle actually miss the box), this can significantly decrease the efficiency of the intersection test; whereas if the AllHit test produces a false miss result (i.e., a miss result when all rays of the bundle actually hit the box), this can decrease the efficiency of the intersection test less significantly. Thus, the effective size of the box can be reduced such that, in the case of subtracting the origin component value from the minimum plane of the box, the minimum origin component value is used, i.e., in the value (p min,i -o i ) for the case of the example given above, this value can be replaced with the value (p min,i -o min,i ), where i e {x, y, z}, where o min,i is the minimum value of the i-th component of the origin of the rays of the bundle. Furthermore, to reduce the effective size of the box, in the case of subtracting the origin component value from the maximum plane of the box, the maximum origin component value is used, i.e., in the value (p max,i -o i ) for the case of the example given above, this value will be replaced with the value (p max,i -o max,i ), where i e {x, y, z}, where o max,i is the maximum value of the i-th component of the origin of the rays of the bundle.
[0220] Figures 16a to 16c It is shown how the effective size of the box can be increased or decreased based on the difference of the origin values of the rays in the bundle. For ease of illustration, Figure 16a the example shown is a 2D example, but it will also be apparent how the effective size of the box can be increased or decreased in a 3D example. Figure 16a It is shown a box 1602, in which the minimum position vector p min and the maximum position vector p max are shown. In this example, the bundle of rays contains four rays, which have origins at the positions shown by the solid black circles in Figure 16a The axis-aligned bounding box 1604 bounds all the origins. The bounding box 1604 has a maximum position vector o max and a minimum position vector o min as shown in Figure 16a .Figure 16b The figure shows p in the x and y directions. min and o max and o min The distance between them.
[0221] Figure 16b This illustrates, in an example of the AnyHit test, how the effective size of box 1602 can be increased based on the difference in the origin values of the rays in the beam. The ray beam can be considered as having a single origin at position o. The effective size of box 1602 is increased to box 1606, as shown. Figure 16a The dashed line in the diagram shows the minimum position vector of valid frame 1606 at position [p]. min -(o max -o)], and the maximum position vector of the valid frame 1606 is at position [p max -(o min -o)]. The distance to the minimum vector position of the effective bounding box 1606 in the x dimension is given by the following formula: [p min,x -(o max,x -o x )]-o x , and Figure 16a The [p] shown min,x -o max,x The same applies; and the distance in the y-axis to the minimum vector position of the effective bounding box 1606 is given by the following formula: [p min,y -(o max,y -o y )]-o y , and Figure 16c The [p] shown min,y -o max,y The same applies. Similarly, calculations can be performed to determine the distance between the ray beam and the maximum vector position of the effective box 1606. It is understood that, in the AnyHit example, increasing the effective size of box 1602 to box 1606 and using a single origin value is equivalent to treating the ray beam as having different origin values for testing against the original box 1602.
[0222] Figure 16c This illustrates, in an example of the AllHit test, how the effective size of box 1602 can be reduced based on the difference in the origin values of the rays in the beam. Specifically, the effective size of box 1602 is reduced to box 1608, as shown below. Figure 16a The dashed line in the diagram shows the minimum position vector of valid frame 1608 at position [p]. min -(o min -o)], and the maximum position vector of the valid frame 1608 is at position [p max -(o max-o)]. The ray beam can be considered as having a single origin at position o, and its distance in the x-dimensional to the minimum vector position of the effective bounding box 1608 is given by the following formula: [p min,x -(o min,x -o x )]-o x , and Figure 16a The [p] shown min,x -o min,x The same applies; and the distance in the y-axis to the minimum vector position of the effective bounding box 1608 is given by the following formula: [p min,y -(o min,y -o y )]-o y , and Figure 5 The [p] shown min,y -o min,y The same applies. Similarly, calculations can be performed to determine the distance between the ray beam and the maximum vector position of the effective box 1608. It is understood that, in the AllHit example, reducing the effective size of box 1602 to box 1608 and using a single origin value is equivalent to treating the ray beam as having different origin values for testing against the original box 1602.
[0223] Therefore, if the rays in the beam do not all have the same origin, then for each of the identified contour edges, the step S414 of determining whether the vector passes inside or outside the contour edge includes performing a comparison according to the following formula: (p o,i -o i,[min,max ])d j <(p o,j -o j,[min,max] )d i , where p o,i p represents the i-th component of a point on the first plane of the first side of the frame forming the outline edge. o,j It represents the j-th component of a point on the second plane of the second side of the frame forming the outline edge, o i[min,max] It is the minimum or maximum value of the i-th component of the light ray at the origin of the light ray beam, o j[min,max] It is the minimum or maximum value of the j-th component of the light ray at the origin of the light ray beam, and d i and d j These are the i-th and j-th components of the vector that provides the boundary to the light beam.
[0224] As described above and in Figure 6 and Figure 7In the examples shown, the direction vectors of the rays in the beam all have the same sign. In these examples, the outline edges of the box are at opposite edges of the box. However, if one or more of the component values of the direction vectors of the rays in the beam do not all have the same sign, the step of identifying the outline edges (step S410) can identify different edges of the box. For example, Figure 7 A 2D example is shown for testing the intersection of a ray beam 704 with a 2D frame 702. The x-component values of the two boundary vectors 7041 and 7042 of the beam 704 have different signs, but the y-component values of the boundary vectors have the same sign. In some examples, the requirement for grouping rays into a ray beam is that the component values of the boundary vectors have the same sign in each dimension, but in other examples, this requirement is not present. Figure 7 As shown, in this example, the contour points of the 2D box 702 are 7101 and 7102. Both contour points are located on the edge of box 702 closest to the origin of the ray beam 704. Therefore, contour points 7101 and 7102 are not at exactly opposite corners of box 702. For example, an AllHit test performed on the beam 704 relative to box 702 will determine that all rays from beam 704 hit box 702 because vector 7041 passes inside contour point 7101, and because vector 7042 passes inside contour point 7102. Figure 8a It is obvious that if the exact opposite point of box 702 is used as the outline point of the box, then the AllHit test performed on beam 704 relative to box 702 will not determine that all rays of beam 704 hit box 702.
[0225] Figure 8a A 3D example is shown, where the outline edges (due to the viewpoint of the view frame 802) are visible. Figure 8a The numbers 1 to 6 (represented in the original text) are not all exactly opposite pairs. For example, when from... Figure 8b When viewed from the perspective shown, the edges that are exactly opposite to the outline edges 2, 3, 5 and 6 are not the outline edges of box 802. Figure 8b A 3D example is shown where only four contour edges exist due to the viewpoint of viewbox 804 (in Figure 8b (represented as 1 to 4), which is not the exact opposite edge of box 804. It should be noted that box 804 is a 3D box, but from... Figure 8b From the perspective shown, only one side of box 804 is visible, making it difficult to see when viewed from... Figure 9 When viewed from the perspective shown, the edge of this side of frame 804 is the outline edge of 3D frame 804.
[0226] Figure 9Another example ray tracing system 900 is shown for performing intersection tests in the manner described above. The ray tracing system 900 is similar to the ray tracing system 300 in that it includes a scheduler 901, a request queue 903, a memory 905, and a tester module 907, and the tester module 907 includes a test queue 909 and a result processor 913. The tester module 907 further includes a set of one or more first test blocks configured to perform AllHit beam intersection tests and a set of one or more second test blocks configured to perform AnyHit beam intersection tests. The test blocks are organized into pairs of test blocks, each pair of test blocks including: (i) a first test block from the set of one or more first test blocks, and (ii) a second test block from the set of one or more second test blocks. For example, Figure 10 A first pair of test blocks including an AllHit test block 9151 and an AnyHit test block 9152 is shown; and a second pair of test blocks including an AllHit test block 9171 and an AnyHit test block 9172. The result processor 913 is configured to process the intersection test results determined by the test blocks.
[0227] The ray tracing system 900 further includes a beam constructor (e.g., implemented in hardware or software or a combination thereof) configured to receive rays and construct ray beams from the received rays to test for intersection with a bin. Beams can be constructed by grouping rays together based on their similarity. The term “similarity” used here refers to whether rays have similar origins and directions. That is, rays having similar origins and similar directions are “similar” rays. The beam constructor groups similar rays into beams so that beam intersection tests can be performed on the beams. Further, it is noted that the scheduler 901 groups coherent rays and / or beams into groups. Here, the term “coherent” means that the rays and / or beams will access the same memory location to retrieve nodes to test for intersection. The “similar” rays grouped into a beam are also “coherent” rays because these similar rays will access the same memory location for intersection testing. However, “coherent” rays are not necessarily “similar.” In other words, some rays that will access the same memory location to retrieve nodes to test for intersection can not have similar origins and directions. The manner in which the beam constructor 919 groups rays into beams can be controlled by a similarity threshold, e.g., by allowing a new ray to merge with a beam if the real angle of a bounding vector representing the beam remains less than a threshold, and / or as another example, by keeping a bounding box of origins of rays within a beam to be less than a particular size. This size threshold can be relative to the size of the scene. Alternatively, a simpler directional threshold would be that for each of i components, a range of ithcomponent values of direction vectors of rays in a beam have a maximum value. In other words, the value of each of the i components is less than a threshold value. The threshold value can be relative to the size of the scene. max,i -d min,iwith a maximum value. In this example, the direction vectors are normalized so that they are comparable.
[0228] Figure 4 A flowchart showing a method performed by the ray tracing system 900 is shown. In step S1002, the bundle builder 919 receives a ray to test for intersection with one or more bins. The bundle builder 919 can maintain a set of open bundles to which the received ray can be added. The bundle builder 919 can have some local memory to store the open bundles. Steps S1006 to S1016 are performed for each of the received rays. In step S1006, the bundle builder 919 determines a level of similarity of the received ray to each of the open bundles. This can be done by observing, for each of the open bundles, how much the bundle bounds, if any, would increase if the ray were added to the bundle. For example, if the origin of the ray is outside the bounds of the origin of the bundle, the similarity determination can be based on the distance between the origin of the ray and the bounds of the origin of the bundle and whether this distance is less than a threshold value. If the components of the direction vector of the ray are greater than the maximum direction of the bundle or less than the minimum direction of the bundle, the similarity determination can be based on the difference between the direction vector of the ray and the minimum or maximum direction of the bundle and whether this difference is less than a threshold value. These threshold values can be fixed or they can be threshold values based on a percentage increase, e.g., based on a percentage increase of the bounds of the origin of the bundle or based on a percentage increase of the difference between the maximum and minimum direction vectors of the bundle if the ray were added to the bundle. In step S1008, the bundle builder 919 identifies, for the received ray, a best matching open bundle of the set of open bundles based on the determined levels of similarity. For example, in step S1008, the open bundle with the highest level of similarity to the ray can be identified.
[0229] In step S1010, the bundle builder 919 determines whether the level of similarity of the ray to the best matching open bundle is above a threshold level of similarity. In other words, the bundle builder 919 determines whether the ray is similar enough to the best matching open bundle to add the ray to the best matching open bundle. If it is determined in step S1010 that the determined level of similarity of the received ray to the best matching open bundle is above the threshold, the method proceeds to step S1012 in which the received ray is added to the best matching open bundle. If it is determined in step S1010 that the determined level of similarity of the best matching open bundle is below the threshold, the method proceeds to step S1014 in which a new bundle is created, i.e., a new open bundle is created that initially does not include the ray but to which the ray can be added. As part of step S1014, if there is no space to create a new open bundle, an existing bundle can be selected and output from the bundle builder 919 and passed to the scheduler 901 in order to make space to create the new open bundle. Then, in step S1016, the received ray is added to the new bundle.
[0230] In step S1018, the full bundles (i.e. the bundles ready to test intersection with the box) are output from the bundle builder 919 and passed to the scheduler 901.
[0231] The scheduler 901 operates in a similar manner to the scheduler 301 described above. However, the scheduler 901 can form groups comprising pointers to rays and / or bundles of rays. This has no impact on grouping pointers whether they are to individual rays or to bundles of rays. In other words, rays and bundles can be mixed within a group and a group can contain multiple rays and bundles (i.e. pointers to multiple rays and to multiple bundles of rays). The scheduler 901 groups rays and / or bundles of rays that will need to access the same block of memory 905 into groups. In other words, in step S1020, the scheduler 901 forms groups comprising one or both of a ray indication and a bundle of rays indication that will need access to the same memory block to perform an intersection test. For example, rays and / or bundles to be tested against the same box or object can be grouped into a group so that data for the box or object can be fetched from the memory 905 once for intersection testing of all rays and / or bundles in the group. Once the scheduler has grouped rays and / or bundles into a group, the scheduler will issue the group and enqueue the group to the request queue 903 to request node data for the group from the memory 905 (i.e. data describing a box corresponding to an appropriate node of the acceleration structure for which the rays and / or bundles of the group are to be tested for intersection). In step S1022, the node data for the group is then retrieved from the memory 905. In other words, in step S1022, data is fetched from the memory block to perform an intersection test for one or both of the rays and bundles of rays indicated by the indications in the group. In step S1024, the fetched data is passed to the tester module 307 so that the tester module 307 can perform an intersection test as described herein, for example with reference to the flowcharts of Figure 11 、 Figure 12 or Figure 9 .
[0232] In a first example, there can be permanent root bundles. In this example, once a ray has been added to a bundle, the ray does not separate from the bundle and will be grouped together into a different bundle. In other words, in this example, the bundle builder 919 only processes new rays, i.e. primary rays and newly generated secondary rays. In this example, the results output from the result processor 913 can go directly to the scheduler 901 or they can go to the bundle builder 919 which can then simply forward the results to the scheduler 901. Figure 11The output from the result processor 913 is shown with a dashed line as this output can go to the bundle builder 919 or the scheduler 901 in different embodiments. In this example, once a bundle starts to traverse, it can be broken apart (e.g., split into individual rays), but the rays within the bundle cannot be recombined or reconstituted into other bundles. In other words, the rays that make up the bundle: (i) contain new rays that have not previously been contained in the bundle of rays, but (ii) do not contain rays that have previously been contained in the bundle of rays. In this example, since the bundle builder 919 only processes new rays, it only needs to run fast enough to process a relatively small number of rays (e.g., one or two rays) per cycle. Furthermore, there is no need to access the data of the individual rays within the bundle at each iteration (e.g., to start each intersection test at each level of the acceleration structure), but only when the bundle collapses, e.g., when an individual ray splits from the bundle. This allows the data of the bundle’s bounding vectors to be stored separately from the ray data of the individual rays, so the amount of data needed to perform bundle intersection tests is comparable (i.e., similar, e.g., approximately equal) to the amount of data needed to perform ray intersection tests on individual rays.
[0233] In a second example, bundles can be reconstituted. In this example, bundles will be broken apart and deconstructed after each iteration of intersection tests (e.g., after each bundle intersection test). In this example, the tester module 907 will be modified to deconstruct the bundle into individual rays and pass the results of the individual rays to the bundle builder 919. The bundle builder will be responsible for forming bundles as the ray results arrive and outputting the bundles to the scheduler 901. In some examples, the scheduler 901 can receive the results from the result processor 913 and form the bundles. Since the scheduler 901 handles the coherence collection for grouping rays and / or bundles into packets, it is not a significant modification to have the scheduler 901 also form bundles of similar rays (note that similar rays are coherent). In these examples, the rays that make up the bundle contain: new rays that have not previously been contained in the bundle of rays, and rays that have previously been contained in the deconstructed bundle of rays. In these examples, bundles can merge with other bundles or rays during traversal of the acceleration structure, which can make it more beneficial to perform bundle intersection tests (e.g., because the bundle can typically contain a large number of rays, or because the similarity of the rays within the bundle can typically increase (compared to the first example of implementing a permanent root bundle described in the preceding paragraph)). However, in this second example, additional logic (e.g., additional hardware) will be needed to form bundles of many rays per clock (where the number of rays per clock will depend on the number of test blocks in the tester module 907). This second example also requires reading all of the packet’s ray data at each iteration, which is not necessary in the first example described in the preceding paragraph.
[0234] The test blocks described above (which can be configured to perform AllHit or AnyHit tests on ray bundles) are also configured to perform intersection tests on single rays. In other words, these test blocks can be used as individual ray testers, for example, to perform intersection tests on rays relative to a frame. A single ray can be considered as a bundle containing the single ray. For a bundle containing single rays, the boundary vector of the bundle will simply be the direction vector of the single ray, and the maximum and minimum components of the origin of the bundle will simply be the components of the origin of the ray. In this case, both the AllHit and AnyHit tests described above will give the correct intersection test results for the single rays in the bundle. This is useful because ray tracing systems 300 and 900 do not require dedicated single-ray test blocks and dedicated bundle test blocks: the same test blocks can be used to perform both bundle intersection tests and single-ray intersection tests. This reduces the possibility of bottlenecks caused by one type of test block being saturated while another type of test block is idle.
[0235] Tester module 907 includes memory 921 configured to store data describing frames that have been retrieved from memory 905 to perform intersection tests relative to the frames. For example, when testing the intersection of a bundle with respect to a frame, the frame data can be retrieved from memory 905 and stored in local memory 921. If the bundle collapses, i.e., if the rays in the bundle are separated into individual rays, the data for the individual rays can be retrieved from memory 905 (or from some other memory, such as an on-chip memory near the test block for storing ray data (e.g., a portion of local memory 921)), and the intersection with respect to the frame can be tested using the frame data stored in local memory 921. When frame data is retrieved from memory 905, local memory 921 temporarily stores the data so that, for example, when the bundle collapses, the data can be reused without requiring a round trip through memory 905, i.e., without needing to retrieve the frame data from memory 905 again.
[0236] The AllHit and AnyHit tests have been described above, and each of these two types of bundle intersection tests can be performed independently, each offering its own benefits, such as reducing the total number of intersection tests that need to be performed. However, in some examples, both AllHit and AnyHit tests can be performed. For example, Figure 11 A flowchart is shown showing a method for performing an intersection test at the ray tracing system 900.
[0237] In step S1102, the tester module 907 receives a bundle of rays to test for intersection with a box. In step S1104, a first test block (e.g., test block 9151 or 9171) performs a first bundle intersection test (i.e., an AllHit test) to determine whether all rays of the bundle intersect the box. As described above, the AllHit test has two possible outcomes: (i) a determination that all rays of the bundle hit the box, or (ii) an indeterminate determination that all rays of the bundle hit the box. In step S1106, the outcome of the first bundle intersection test is considered. If the first bundle intersection test determines that all rays of the bundle hit the box, then the method proceeds from step S1106 to step S1108. In step S1108, the intersection test result for the bundle with respect to the box is determined to be that all rays of the bundle intersect the box.
[0238] If the first bundle intersection test does not determine that all rays of the bundle hit the box, then the method proceeds from step S1106 to step S1110. In step S1110, a second test block (e.g., test block 9152 or 9172) performs a second bundle intersection test (i.e., an AnyHit test) to determine whether all rays of the bundle miss the box. As described above, the AnyHit test has two possible outcomes: (i) a determination that all rays of the bundle miss the box, or (ii) an indeterminate determination that all rays of the bundle miss the box. In step S1112, the outcome of the second bundle intersection test is considered. If the second bundle intersection test determines that all rays of the bundle miss the box, then the method proceeds from step S1112 to step S1114. In step S1114, the intersection test result for the bundle with respect to the box is determined to be that all rays of the bundle miss the box.
[0239] If all rays of the second intersecting test uncertain bundle miss the frame, the method proceeds from step S1112 to step S1116. Therefore, if all rays of the first intersecting test uncertain bundle intersect the frame, and if all rays of the second intersecting test uncertain bundle miss the frame, the method reaches step S1116. In step S1116, the ray bundle is separated into individual rays. For example, the result processor 913 can separate the ray bundle into individual rays. Then, in step S1118, an intersection test is performed on the individual rays relative to the frame to determine which individual rays intersect the frame. One or more of the test blocks can perform the intersection test on the individual rays without first passing the individual rays back to the bundle builder 919 or scheduler 901. After the intersection test has been performed on the individual rays, the results of the intersection test on the individual rays can be output from the tester module 907 (e.g., from the result processor 913). If an intersection test finds a hit with a single ray, the ray can be processed as if it were a newly received ray, to test the boxes represented by the child nodes of the node representing the newly discovered intersection box. For example, a single ray that has been found to have a hit can be output from the results processor 913 to the bundle builder 919 or scheduler 901, allowing the single ray to be bundled and / or grouped and passed to the request queue 903, so that the ray can be processed as if it were a newly received ray, to test the boxes represented by the child nodes of the node representing the newly discovered intersection box. As described above, the box data can be stored in local memory 921, and the same test blocks (e.g., 9151, 9152, 9171, and 9172) can be used to perform intersection tests on the single rays relative to the boxes.
[0240] exist Figure 12 In the method shown in the flowchart, a second beam intersection test (e.g., an AnyHit test) is conditionally performed based on the result of a first beam intersection test (e.g., an AllHit test). In other words, in this example, in response to the result of the AllHit test not determining that all rays of the beam hit the box, the AnyHit test is performed relative to the box on the beam. This is an example of how the method can be implemented in software, for example, as a block of software code executable on a processing unit, in the tester module 907.
[0241] Figure 12 A flowchart illustrating another method for performing an intersection test at a ray tracing system 900 is shown. This flowchart may be more suitable for implementation in hardware, such as a hardware block in a tester module 907 configured to perform an intersection test (e.g., implemented in a fixed-function circuitry system). Figure 11In the illustrated method, both a first beam intersection test (e.g., an AllHit test) and a second beam intersection test (e.g., an AnyHit test) are performed with respect to the frame for the ray beam unconditionally, i.e., independent of the results of another beam intersection test with respect to the frame. Specifically, the second beam intersection test (e.g., the AnyHit test) is performed regardless of the results of the first beam intersection test (e.g., the AllHit test).
[0242] In step S1202, the tester module 907 receives a ray beam to test for intersection with a frame. After step S1202, steps S1204 and S1210 are performed in parallel. In step S1204, a first test block (e.g., test block 9151 or 9171) performs a first beam intersection test (i.e., an AllHit test) to determine whether all of the rays of the beam intersect the frame. In step S1206, the results of the first beam intersection test are considered. If the first beam intersection test determines that all of the rays of the beam hit the frame, the method proceeds from step S1206 to step S1208. In step S1208, it is determined that the intersection test result for the beam with respect to the frame is that all of the rays of the beam intersect the frame. If the first beam intersection test does not determine that all of the rays of the beam hit the frame, the method proceeds from step S1206 to step S1215.
[0243] In step S1210, a second test block (e.g., test block 9152 or 9172) performs a second beam intersection test (i.e., an AnyHit test) to determine whether all of the rays of the beam miss the frame. In step S1212, the results of the second beam intersection test are considered. If the second beam intersection test determines that all of the rays of the beam miss the frame, the method proceeds from step S1212 to step S1214. In step S1214, it is determined that the intersection test result for the beam with respect to the frame is that all of the rays of the beam miss the frame. If the second beam intersection test does not determine that all of the rays of the beam miss the frame, the method proceeds from step S1212 to step S1215.
[0244] The results from both the first and second test blocks are passed to the result processor 913. In step S1215, the result processor 913 determines whether the results of steps S1206 and S1212 are “No”. In other words, the result processor 913 determines both (i) whether the AllHit test did not determine that all rays of the beam hit the box, and (ii) whether the AnyHit test did not determine that all rays of the beam missed the box. If this is the case, the method proceeds from step S1215 to step S1216. In step S1216, the result processor 913 separates the beam of rays into individual rays. The individual rays are then, in step S1218, subjected to an intersection test against the box to determine which individual rays intersect the box. The individual rays (or a reference to the individual rays, such as a ray ID) can be output from the result processor back to one or more test blocks for performing the intersection test on the individual rays. Alternatively, the individual rays can be output from the result processor 913 and processed as if the rays were newly received rays. For example, the individual rays can be output from the result processor 913 to the beam builder 919 or the scheduler 901 so that the individual rays can be grouped into beams and / or grouped and passed to the request queue 903 so that the rays can be processed as if the rays were newly received rays. As mentioned above, the data for the box can be stored in the local memory 921 and the same test blocks (e.g. 9151, 9152, 9171 and 9172) can be used to perform the intersection test against the box for the individual rays.
[0245] In some examples, the ray data for a ray can be stored in on-chip memory (as part of the local memory 921) and each ray has an identifier (which can be referred to as a “RayID”). When we describe passing “rays” between blocks, in some examples this can be implemented by passing the RayID between blocks so that the actual ray data (e.g. the ray origin and direction etc.) for a ray does not need to be passed between blocks. A test block (e.g. 915 or 917) can read the ray data indicated by the RayID just before performing an intersection on the ray, e.g. by fetching the ray data from local memory. In the example of recreating a beam, the ray data can be streamed from the tester module 907 to the beam builder 919 so that the beam builder has the ray data to create the beam.
[0246] The structure of the group created by the scheduler 901 can be a list of blocks of RayIDs and an indication of the location of the data in memory, e.g. a linked list. The scheduler 901 builds a list of RayIDs for each group it is creating. Each of the beams can have its own RayID, and a pointer to the list of RayIDs for each ray in the beam. If the beam is to be collapsed (i.e. split into individual rays), the result processor 913 can pass the pointers to the individual rays back to the front end of the tester module 907. Essentially, in this case, the result processor 913 has created the group of individual rays a priori. The tester module 907’s test block reads the ray data for the individual rays as normal, just before each intersection test.
[0247] Typically, the group contains a reference to the rays, and the tester module extracts the ray data when it is to be used for an intersection test.
[0248] If, in step S1215, the result processor 913 determines that the result of step S1206 or step S1212 is “yes” (in other words, if the result processor 913 determines that (i) the AllHit test determines that all rays of the beam hit the box, or (ii) the AnyHit test determines that all rays of the beam miss the box), the method performed by the test block ends after step S1215, as the intersection test result for the beam with respect to the box has already been determined. In other words, the AllHit test or the AnyHit test has already determined the intersection test result for the beam with respect to the box, and this result has been output to the result processor 913, so there is no need to split the beam into individual rays to determine the intersection test result for all rays of the beam with respect to the box.
[0249] In Figure 12 and Figure 11 of the two examples shown, if the first beam intersection test (e.g. the AllHit test) does not determine that all rays of the beam intersect the box, the result of performing the second beam intersection test (e.g. the AnyHit test) is used to determine the intersection test result for the beam with respect to the box. The main difference between these two approaches is that, in the approach of Figure 12 , the second beam intersection test is performed conditionally based on the result of the first beam intersection test; whereas in the approach of Figure 12 , the first beam intersection test and the second beam intersection test are performed simultaneously and in parallel. In other words, in the approach of Figure 13a , the second beam intersection test (e.g. the AnyHit test) is performed regardless of the result of the first beam intersection test (e.g. the AllHit test).
[0250] In some other examples not described in detail herein, it is possible to conditionally perform the first ray intersection test (e.g., the AllHit test) based on the result of the second ray intersection test (e.g., the AnyHit test). In these other examples, the AllHit test will not be performed if the AnyHit test determines that all of the rays of the bundle miss the box, and the AllHit test will be performed if the result of the AnyHit test is not a determination that all of the rays of the bundle miss the box.
[0251] As described above, the tester module 907 of the ray tracing system 900 includes pairs of test blocks, where each pair of test blocks includes an AllHit test block and an AnyHit test block. The tester module 907 is configured to pass a bundle of rays and data representing a box to a pair of test blocks (e.g., test blocks 9151 and 9152) such that a first test block 9151 of the pair of test blocks performs a first ray intersection test (e.g., an AllHit test) on the bundle of rays with respect to the box and a second test block 9152 of the pair of test blocks performs a second ray intersection test (e.g., an AnyHit test) on the bundle of rays with respect to the box. In this way, when performing intersection tests on a bundle of rays, the bundle is passed to both test blocks of a pair of test blocks for the intersection tests.
[0252] As described above, the test blocks can also be used to perform intersection tests on individual rays. The tester module 907 is configured to pass a first individual ray and a second individual ray and data representing a box to a pair of test blocks (e.g., test blocks 9151 and 9152) such that a first test block 9151 of the pair of test blocks performs an intersection test on the first individual ray with respect to the box and a second test block 9152 of the pair of test blocks performs an intersection test on the second individual ray with respect to the box. In this way, when performing intersection tests on individual rays, two individual rays can be passed to respective test blocks of a pair of test blocks for the intersection tests. Thus, it can be appreciated that in some examples, a bundle of rays will occupy a pair of test blocks at a time, while a single ray will only occupy one test block at a time.
[0253] Figure 13a An example data structure for storing ray data is shown. In this example, each ray has 64 bytes of data. As Figure 13bAs shown, the ray data for a ray includes the x, y, and z components of the origin of the ray; the x, y, and z components of the direction vector of the ray; x and y components ("PosX" and "PosY") indicating a screen space position associated with the ray, which can be used for writing results; a maximum distance that the ray can travel ("MaxT"); a distance to the nearest hit ("T"); barycentric U and V components of the hit point on the primitive; an ID of the shader on the hit primitive ("HitID"); one or more flags that can be used to implement various per-ray API features such as backface culling; and user data that can be written, e.g., by a shader program.
[0254] The data for a ray bundle is stored in a data structure and includes: origin data for the ray bundle; vector data describing the components of the vectors that provide bounds for the ray bundle; and one or more pointers to ray data for the rays of the ray bundle. For example, Figure 13b A data structure for storing data for a ray bundle is shown. In this example, each ray bundle has 64 bytes of data. In Figure 13b In the example shown, each row represents a value with 32 bits of data. It is convenient for the ray data and the bundle data to have the same size data structure, as this allows the bundle and the rays to be easily packaged together into a packet. As Figure 14 As shown, the data for a ray bundle includes: the minimum and maximum x, y, and z components of the origin of the ray bundle; the minimum and maximum x, y, and z components of the bound vectors of the ray bundle; a maximum distance that the ray bundle can travel ("MaxT"); a distance to the nearest hit ("T"); one or more flags that can be used to implement various per-ray API features such as backface culling; and one or more ray pointers to data for the rays of the bundle. For example, the ray pointer can point to another data packet that contains all of the ray data for the rays that make up the bundle. When the bundle is broken down into individual rays, each bundle will follow this ray pointer once. For example, the result processor 913 can pass this pointer back to the test queue 909 and be handled the same as when a pointer to a list of rays comes from the scheduler path (e.g., from the request queue 903).
[0255] In some examples, the bundle of rays can be split into individual rays if a splitting metric is satisfied. For example, the splitting metric can be based on one or more of: a number of rays in the bundle of rays; a spread of the rays in the bundle of rays; a size of an area defined by the profile edge of the box; whether the rays in the bundle of rays originate from a frame shader or a ray shader; and data provided by the shader that created the rays in the bundle of rays (e.g., information relating to a degree of divergence of the rays). For example, if the number of rays in the bundle is less than a threshold, the bundle can be deconstructed, i.e., split into individual rays. If there are not so many rays in the bundle, then the benefit of performing a bundle intersection test rather than individual ray intersection tests is not so great. For example, if there are only two rays in the bundle, it can be better to split the rays and test them individually rather than performing a bundle intersection test. As another example, if the spread of the rays in the bundle is above a threshold, the rays can be considered to be too divergent and the bundle can be split. In this case, if the spread of the rays in the bundle is too wide, then the rays are less likely to have the same intersection test result, so it is less advantageous to perform a bundle intersection test. The wider the spread of the rays in the bundle, the greater the difference between the maximum and minimum bounding vector components of the bundle.
[0256] Figure 15 A computer system in which the ray tracing systems described herein can be implemented is shown. The computer system includes a CPU 1402, a GPU 1404, a memory 1406, and other devices 1410, such as a display 1412, speakers 1414, and a camera 1416. A ray tracing unit 1408 is implemented on the GPU 1404. The components of the computer system can communicate with each other via a communication bus 1418. The ray tracing unit 1408 can operate with a portion of the memory 1406 to implement the ray tracing system 300 or the ray tracing system 900 described above. In some examples, the ray tracing system can be implemented separately from the GPU 1404.
[0257] The ray tracing systems 300 and 900 are shown as including a number of functional blocks. This is merely illustrative and is not intended to limit a strict partitioning between the different logical elements of such entities. Each functional block can be provided in any suitable manner. It will be appreciated that the intermediate values described herein as formed by the ray tracing system need not be physically generated by the ray tracing system at any point in time, and can represent merely logical values that are convenient to describe the processing performed by the ray tracing system between its inputs and outputs.
[0258] The ray tracing system described herein can be embodied in hardware on an integrated circuit. The ray tracing system described herein can be configured to perform any of the methods described herein. Generally, any of the functions, methods, techniques, or components described above can be implemented in software, firmware, hardware (e.g., a fixed logic circuit system), or any combination thereof. The terms “module,” “function,” “component,” “element,” “cell,” “block,” and “logic” are used herein to generally denote software, firmware, hardware, or any combination thereof. In the case of a software implementation, a module, function, component, element, cell, block, or logic represents program code that, when executed on a processor, performs a specified task. The algorithms and methods described herein can be executed by one or more processors executing code that causes the processor to execute 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 techniques to store instructions or other data and can be accessed by a machine.
[0259] As used herein, the terms computer program code and computer-readable instructions refer to any kind of executable code for a processor, comprising code expressed in machine language, interpreted language, or scripting language. Executable code includes binary code, machine code, bytecode, code defining integrated circuits (e.g., hardware description languages or netlists), and code expressed in programming languages such as C, Java, or OpenCL. 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, causes the processor of a computer system that supports the executable code to perform tasks specified by said code.
[0260] A processor, computer, or computer system can be any kind of device, machine, or special-purpose circuit, or a collection or part thereof, that has the processing power to execute instructions. A processor can be any kind of general-purpose or special-purpose processor, such as a CPU, GPU, system-on-a-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.
[0261] The present application also intends to encompass software, such as a hardware description language (HDL) software, defining configurations of hardware as described herein, for designing integrated circuits or for configuring programmable chips to perform desired functions. That is, a computer readable storage medium can be provided having encoded thereon computer readable program code in the form of integrated circuit definition data sets that, when processed (i.e., run) in an integrated circuit manufacturing system, configure the system to manufacture a ray tracing system configured to perform any of the methods described herein, or to manufacture a ray tracing system comprising any of the apparatus described herein. The integrated circuit definition data sets can be, for example, integrated circuit descriptions.
[0262] Thus, a method of manufacturing a ray tracing system as described herein at an integrated circuit manufacturing system can be provided. Furthermore, an integrated circuit definition data set can be provided that, when processed in an integrated circuit manufacturing system, causes a method of manufacturing a ray tracing system to be performed.
[0263] The integrated circuit definition data sets can be in the form of computer code, for example as a netlist, code for configuring programmable chips, as a hardware description language defining hardware suitable for manufacture at any level of integration, 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 of hardware logically defining hardware suitable for manufacture in integrated circuits, such as RTL, can be processed on a computer system configured for generating a manufacturing definition of an integrated circuit in the context of a software environment comprising definitions of circuit elements and rules for combining these elements to generate a manufacturing definition of an integrated circuit defined by the representation. As is common for software executed at a computer system in order to define a machine, one or more intermediate user steps (e.g., providing commands, variables, etc.) can be required in order to configure the computer system to generate a manufacturing definition of an integrated circuit, to execute code defining an integrated circuit in order to generate a manufacturing definition of the integrated circuit.
[0264] An example of processing an integrated circuit definition data set at an integrated circuit manufacturing system in order to configure the system to manufacture a ray tracing system will now be described with respect to Figure 15
[0265] Figure 15 An example of an integrated circuit (IC) fabrication system 1502 is shown, which is configured to fabricate a ray tracing system as described in any of the examples herein. In particular, the IC fabrication system 1502 comprises a layout processing system 1504 and an integrated circuit generation system 1506. The IC fabrication system 1502 is configured to receive an IC definition data set (e.g. defining a ray tracing system as described in any of the examples herein), process the IC definition data set, and generate an IC (e.g. containing a ray tracing system as described in any of the examples herein) from the IC definition data set. The processing of the IC definition data set configures the IC fabrication system 1502 to fabricate an integrated circuit containing a ray tracing system as described in any of the examples herein.
[0266] The layout processing system 1504 is configured to receive and process the IC definition data set to determine a circuit layout. Methods of determining a circuit layout from an IC definition data set are known in the art and can involve, for example, synthesizing RTL code to determine a gate level representation of the circuit to be generated, e.g. in terms of logic components (e.g. NAND, NOR, AND, OR, MUX and FLIP-FLOP components). By determining the position information of the logic components, a circuit layout can be determined from the gate level representation of the circuit. This can be done automatically or with user involvement in order to optimize the circuit layout. When the layout processing system 1504 has determined the circuit layout, it can output a circuit layout definition to the IC generation system 1506. The circuit layout definition can be, for example, a circuit layout description.
[0267] The IC generation system 1506 generates an IC from the circuit layout definition, as is known in the art. For example, the IC generation system 1506 can implement semiconductor device fabrication processes that generate an IC, which can involve a multi-step sequence of photolithographic and chemical processing steps during which an electronic circuit is gradually formed on a wafer made of semiconductor material. The circuit layout definition can be in the form of a mask, which can be used in a photolithographic process to generate an IC according to the circuit definition. Alternatively, the circuit layout definition provided to the IC generation system 1506 can be in the form of computer readable code, which can be used by the IC generation system 1506 to form suitable masks for generating an IC.
[0268] The different processes performed by the IC fabrication system 1502 can all be performed at one location, e.g., by one party. Alternatively, the IC fabrication system 1502 can be a distributed system, such that some processes can be performed at different locations, and can be performed by different parties. For example, some of the following stages can be performed at different locations and / or by different parties: (i) synthesizing RTL code representing the IC definition data set to form a gate level representation of the circuit to be generated; (ii) generating a circuit layout based on the gate level representation; (iii) forming masks from the circuit layout; and (iv) fabricating the integrated circuit using the masks.
[0269] In other examples, processing of an integrated circuit definition data set at an integrated circuit fabrication system can configure the system to fabricate a ray tracing system without processing the IC definition data set to determine a circuit layout. For example, the integrated circuit definition data set can define a configuration of a reconfigurable processor, e.g., an FPGA, and processing of the data set can configure the IC fabrication system to generate the reconfigurable processor with the defined configuration, e.g., by loading configuration data to the FPGA.
[0270] In some embodiments, when processed in an integrated circuit fabrication system, an integrated circuit fabrication definition data set can cause the integrated circuit fabrication system to generate an apparatus as described herein. For example, by configuring an integrated circuit fabrication system with an integrated circuit fabrication definition data set in the manner described above with respect to Figure 15 An apparatus as described herein can be fabricated by configuring an integrated circuit fabrication system with an integrated circuit fabrication definition data set in the manner described above with respect to
[0271] In some examples, an integrated circuit definition data set can contain, or be combined with, software that is to run on the hardware defined at the data set. For example, the integrated circuit definition data set can define a hardware system, and the software can be configured to run on the hardware system. In the example shown, the IC generation system can be further configured by the integrated circuit definition data set to load firmware onto an integrated circuit, or otherwise provide program code for use with an integrated circuit, according to program code defined at the integrated circuit definition data set when the integrated circuit is fabricated.
[0272] Compared to known implementations, implementations of the concepts set forth in this application in apparatuses, devices, modules, and / or systems (and in methods implemented herein) can result in performance improvements. Performance improvements can include one or more of improved computational performance, reduced latency, increased throughput, and / or reduced power consumption. During fabrication of such apparatuses, devices, modules, and systems (e.g., in integrated circuits), trade-offs can be made between performance improvements and physical implementations, improving the fabrication process. For example, trade-offs can be made between performance improvements and layout area, matching the performance of known implementations but using less silicon. For example, this can be done by reusing functional blocks in serial fashion or sharing functional blocks among elements of the apparatuses, devices, modules, and / or systems. Conversely, concepts set forth in this application that result in improvements in physical implementations of apparatuses, devices, modules, and systems, such as reduced silicon area, can be traded off for performance improvements. For example, this can be done by fabricating multiple instances of a module within a predefined area budget.
[0273] Applicant hereby expressly disclaims any right, title, and / or interest in any of the applications, teachings, or suggestions described herein that are not recited in the claims. The applicant hereby grants permission to make electronic copies of the claims at any time, for any reason. In light of the forgoing description, those skilled in the art will appreciate that various modifications can be made to the application disclosed herein without departing from the scope thereof.
Claims
1. A ray tracing system, comprising: A tester module configured to receive a beam of light intersecting with a frame to be tested, wherein the tester module includes: A first test block is configured to perform a first beam intersection test to determine whether all rays of the light beam intersect the frame, wherein if the first beam intersection test determines that all rays of the light beam intersect the frame, then the intersection test result of the light beam relative to the frame is that all rays of the light beam intersect the frame; and A second test block is configured to perform a second beam intersection test to determine whether all rays of the light beam miss the frame, wherein if the second beam intersection test determines that all rays of the light beam miss the frame, then the intersection test result of the light beam relative to the frame is that all rays of the light beam miss the frame, and The tester module is configured to work in the following situations: First, in a beam intersection test, it is uncertain whether all rays of the beam intersect the frame; second, in a beam intersection test, it is uncertain whether all rays of the beam miss the frame. Separating the light beam into individual light rays; and An intersection test is performed on the individual rays relative to the frame to determine which of the individual rays intersect with the frame.
2. The ray tracing system of claim 1, wherein the second test block is configured to perform the second beam intersection test, regardless of the intersection test result of the first beam intersection test performed by the first test block.
3. The ray tracing system of claim 1, wherein the tester module is configured to cause the first test block to perform a first beam intersection test on the ray beam relative to the frame, while causing the second test block to perform a second beam intersection test on the ray beam relative to the frame.
4. The ray tracing system of claim 1, wherein the second test block is configured to perform a second beam intersection test on the ray beam relative to the frame in response to an intersection test result performed by the first test block relative to the frame on the ray beam, wherein the first beam intersection test does not determine that all rays of the ray beam intersect with the frame.
5. The ray tracing system of claim 1, wherein the tester module is configured to use one or both of the first test block and the second test block to perform the intersection test on the individual ray relative to the frame.
6. The ray tracing system according to claim 1, wherein the tester module comprises: A set of one or more first test blocks, wherein each of the one or more first test blocks is configured to perform a first beam intersection test to determine whether all rays of the beam intersect the frame; as well as A set of one or more second test blocks, wherein each of the one or more second test blocks is configured to perform a second beam intersection test to determine whether all rays of the beam miss the frame. The test blocks are organized into multiple pairs of test blocks, each pair of test blocks including: (i) a first test block from the set of one or more first test blocks, and (ii) a second test block from the set of one or more second test blocks.
7. The ray tracing system of claim 6, wherein the tester module is configured to pass data of a ray beam and a representation frame to a pair of test blocks, such that the first test block of the pair of test blocks performs a first beam intersection test on the ray beam relative to the frame, and the second test block of the pair of test blocks performs a second beam intersection test on the ray beam relative to the frame.
8. The ray tracing system of claim 6, wherein the tester module is configured to pass data of a first individual ray and a second individual ray and a representation box to a pair of test blocks, such that the first test block of the pair of test blocks performs an intersection test on the first individual ray relative to the box, and the second test block of the pair of test blocks performs an intersection test on the second individual ray relative to the box.
9. The ray tracing system of claim 1, further comprising a beambuilder, the beambuilder being configured to: Receive light; and The received light rays are grouped together based on their similarity, thereby constructing a beam of light that intersects with the frame to be tested.
10. The ray tracing system of claim 9, wherein the beam builder is configured to: Maintain a set of open light beams into which new light can be added; and For each of the received light rays: Determine the similarity level between the received light and each of the set of open light beams; Based on a determined similarity level, the best-matching open ray beam in the set of open ray beams is identified for the received light; and If the determined similarity level of the best-matching open ray beam is higher than a threshold, then the received ray is added to the best-matching open ray beam.
11. The ray tracing system of claim 10, wherein the beam builder is further configured for each of the received rays: If the determined similarity level of the best-matching open ray beam is lower than the threshold, a new ray beam is created and the received ray is added to the new ray beam.
12. The ray tracing system of claim 9, wherein the received rays grouped together to construct a ray bundle: (i) include new rays not previously included in the ray bundle, but (ii) do not include rays previously included in the ray bundle.
13. The ray tracing system of claim 9, wherein the received rays grouped together to construct a ray beam comprise: New rays that were not previously included in the ray beam, and The light that was previously contained in the already deconstructed beam of light.
14. The ray tracing system of claim 1, further comprising a scheduler configured to: Forming groups, said groups comprising one or both ray indicators and ray beam indicators, said rays and ray beams requiring access to the same memory block to perform an intersection test; and Data is extracted from the memory block and passed to the tester module to perform an intersection test on one or both of the rays and ray bundles indicated by the indication in the group.
15. A computer-implemented method for performing an intersection test in a ray tracing system, the method comprising: Receive the light beam that intersects with the frame to be tested; Perform a first beam intersection test to determine whether all rays of the beam intersect the frame, wherein if the first beam intersection test determines that all rays of the beam intersect the frame, then the beam intersection test result relative to the frame is that all rays of the beam intersect the frame. as well as If the first beam intersection test is uncertain whether all rays of the light beam intersect the frame, then the result of a second beam intersection test is used to determine the intersection test result of the light beam relative to the frame. The second beam intersection test determines whether all rays of the light beam miss the frame. If the intersection test result of the second beam intersection test indicates that all rays of the beam miss the frame, then the intersection test result of the beam relative to the frame is that all rays of the beam miss the frame. If the first beam intersection test is uncertain that all rays of the beam intersect the frame, and if the result of the second beam intersection test does not indicate that all rays of the beam miss the frame, then the method further includes: The light beam is separated into individual light rays; as well as An intersection test is performed on the individual rays relative to the frame to determine which of the individual rays intersect with the frame.
16. The method of claim 15, wherein there are only two possible outcomes of the first beam intersection test: (i) the first beam intersection test determines that all rays of the beam intersect the frame, or (ii) the first beam intersection test does not determine that all rays of the beam intersect the frame.
17. The method of claim 15, wherein there are only two possible outcomes of the second beam intersection test: (i) the second beam intersection test determines that all rays of the beam miss the frame, or (ii) the second beam intersection test does not determine that all rays of the beam miss the frame.
18. The method according to any one of claims 15 to 17, wherein the second beam intersection test is performed without regard to the intersection test result of the first beam intersection test.
19. The method of claim 15, wherein performing the first beam intersection test on the light beam relative to the frame comprises: The outline edge of the frame is identified from the perspective of the light beam; For each of the outline edges of the identifier: Obtain the component of the vector that provides an outer boundary to the light beam relative to the outline edge of the identifier, such that the vector is at least as likely as any one of the rays of the light beam to pass outside the outline edge of the identifier; and Determine whether the vector passes through the inside or outside of the contour edge; and Using the results of determining whether the vector passes inside or outside the contour edge for each of the identified edges, the intersection test result of the ray beam relative to the box is determined. If, for each of the outline edges of the sign, it is determined that the vector passes through the interior of the corresponding outline edge of the sign, then the intersection test result of the light beam relative to the frame is that all the light rays in the light beam intersect the frame; and If, for one or more of the outline edges of the identifier, the vector is determined to pass outside the outline edge of the corresponding identifier, then the intersection test result of the ray beam relative to the frame is not that all rays in the ray beam intersect the frame.
20. The method of claim 15, wherein performing the second beam intersection test on the light beam relative to the frame comprises: The outline edge of the frame is identified from the perspective of the light beam; For each of the outline edges of the identifier: Obtain the component of a vector that provides an inner boundary to the light beam relative to the outline edge of the identifier, such that the vector is at least as likely as any one of the rays of the light beam to pass inside the outline edge of the identifier; and Determine whether the vector passes through the inside or outside of the contour edge; and Using the results of determining whether the vector passes inside or outside the contour edge for each of the identified edges, the intersection test result of the ray beam relative to the box is determined. If, for each of the outline edges of the marker, the vector is determined to pass inside the corresponding marker's outline edge, then the intersection test result of the ray beam relative to the box is not that all rays in the ray beam miss the box; and If, for one or more of the outline edges of the identifier, the vector is determined to pass outside the outline edge of the corresponding identifier, then the intersection test result of the ray beam relative to the frame is that all rays in the ray beam miss the frame.
21. A computer-readable storage medium having stored thereon computer program code for performing the method according to any one of claims 15 to 20.
22. A computer-readable storage medium storing an integrated circuit definition dataset thereon, which, when processed in an integrated circuit manufacturing system, configures the integrated circuit manufacturing system to manufacture a ray tracing system according to any one of claims 1 to 14.
Citation Information
Patent Citations
Intersection testing in ray tracing systems
CN114119841A