Light ray tracing method and device, graphics processor and electronic device

CN122089921BActive Publication Date: 2026-11-03MOORE THREADS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610554034.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-24
Publication Date
2026-11-03
Estimated Expiration
2046-04-24

AI Technical Summary

Technical Problem

During ray tracing, when encountering transparent primitives and procedural primitives, it is necessary to wait for the computing unit to return the results, which leads to a decrease in GPU performance.

Method used

By dynamically configuring and updating the identifier, the intersection test between the ray and the object is controlled, enabling parallel processing of ray updates and intersection tests, thus avoiding waiting for the ray length to be updated.

Benefits of technology

It reduces congestion during ray tracing, shortens traversal time, improves GPU performance and resource utilization, and achieves a balance between performance, power consumption, and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122089921B_ABST
    Figure CN122089921B_ABST
Patent Text Reader

Abstract

The application provides a light ray tracing method and device, a graphics processor and an electronic device. The light ray tracing method comprises the following steps: determining an intersection test result of a light ray and a first object, the first object being a primitive of a first node in a hierarchical bounding volume; in a case where the intersection test result represents that the first object is a preset primitive, controlling an intersection test of the light ray and a second object based on an update identifier, the update identifier representing whether to wait for length update of the light ray, and the update identifier being dynamically configured, the second object being a primitive in the first node or a second node in the hierarchical bounding volume.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of graphics processing technology, and in particular to a ray tracing method and apparatus, a graphics processor, and an electronic device. Background Technology

[0002] The Graphics Processing Unit (GPU) primarily handles complex geometric calculations and rendering tasks. During rendering, the GPU typically employs Ray Tracing (RT) to render the scene. RT is a computer graphics technique that generates realistic images by simulating the propagation path of light rays in a 3D scene. Its core principles include ray emission, intersection detection, recursive tracing, and lighting calculation, enabling it to accurately represent reflection, refraction, and global illumination effects.

[0003] In related technologies, during the RT process, when light encounters special primitives (such as transparent primitives, procedural primitives, etc.), the intersection and update need to be handed over to the computing unit, and the subsequent intersection test can only continue after the computing unit returns the result. The waiting time is long, which greatly reduces the performance of the GPU. Summary of the Invention

[0004] This application provides a ray tracing method and apparatus, a graphics processor, and an electronic device.

[0005] The technical solution of this application embodiment is implemented as follows: This application provides a ray tracing method, including: Determine the intersection test result between the ray and the first object, which is a primitive of the first node in the hierarchical bounding volume; When the intersection test result indicates that the first object is a preset primitive, the intersection test between the ray and the second object is controlled based on the update identifier. The update identifier indicates whether to wait for the length update of the ray. The update identifier is dynamically configured. The second object is a primitive in the first node or a second node in the hierarchical bounding volume.

[0006] This application provides a ray tracing device, including a configuration unit and a processing unit, wherein: A configuration unit is used to store update flags; wherein, the update flag indicates whether to wait for an update of the light length, and the update flag is dynamically configured; The processing unit is used to obtain a first object from the storage unit, wherein the first object is a primitive of a first node in a hierarchical bounding volume; determine the intersection test result of the ray and the first object; and, if the intersection test result indicates that the first object is a preset primitive, obtain an update identifier from the configuration unit and control the intersection test of the ray and the second object based on the update identifier, wherein the second object is a primitive of the first node or a second node in a hierarchical bounding volume.

[0007] This application provides a graphics processor that includes the ray tracing device described above.

[0008] This application provides an electronic device including the aforementioned graphics processor.

[0009] The embodiments of this application have the following beneficial effects: On the one hand, during ray tracing, when encountering pre-defined primitives such as transparent primitives and procedural primitives, subsequent intersection tests are controlled based on the update flag (i.e., whether to wait for ray updates). Compared to related solutions that can only wait for ray updates, this application not only achieves non-waiting for ray updates, effectively decoupling the subsequent intersection tests from the ray update process, allowing them to run in parallel, but also eliminates the need for long waiting times. This significantly reduces blocking during ray tracing, shortens traversal time, and is also compatible with waiting for ray updates. This reduces the possibility of increased resource consumption when ray lengths become shorter and sufficient to skip some nodes, thus maximizing performance while improving flexibility. On the other hand, by dynamically configuring the update flag, higher flexibility and controllability are given to the update flag, thereby achieving an optimal balance between performance, power consumption, and resource utilization. Attached Figure Description

[0010] Figure 1 A schematic diagram of the implementation process of a ray tracing method provided in this application embodiment. Figure 1 ; Figure 2 This is a schematic diagram of the first component structure of a ray tracing device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the second component structure of a ray tracing device provided in an embodiment of this application; Figure 4 A schematic diagram of a graphic element provided in an embodiment of this application; Figure 5 A schematic diagram of the implementation process of a ray tracing method provided in this application embodiment. Figure 2 .

[0011] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0014] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0015] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0016] The technical solutions in the embodiments of this application will now be clearly and completely described with reference to the accompanying drawings.

[0017] Figure 1 A schematic diagram of the implementation process of a ray tracing method provided in this application embodiment. Figure 1 ,like Figure 1 As shown, the ray tracing method includes steps S11 and S12, wherein: Step S11: Determine the intersection test result between the ray and the first object, where the first object is a primitive of the first node in the hierarchical bounding volume; Step S12: If the intersection test result indicates that the first object is a preset primitive, control the intersection test between the ray and the second object based on the update identifier. The update identifier indicates whether to wait for the length update of the ray. The update identifier is dynamically configured. The second object is a primitive in the first node or a second node in the hierarchical bounding volume.

[0018] Here, the Bounding Volume Hierarchy (BVH) is a common data structure in rendering. A BVH, based on a tree structure, contains different types of nodes, such as box nodes and primitive nodes. Box nodes are typically internal nodes used to store bounding boxes; therefore, they are non-leaf nodes. A box node usually includes intermediate nodes and a root node, which are nodes other than the root and leaf nodes. Primitive nodes, on the other hand, are leaf nodes that store the basic graphics (i.e., primitives) of the scene. The scene refers to the rendered virtual 3D environment itself. Primitives can include, but are not limited to, triangles, polygons, points, and line segments. Box nodes contain at least one bounding volume, and leaf nodes contain at least one primitive. Each bounding volume tightly surrounds the primitive in the leaf node, and these bounding volumes are recursively combined into larger bounding volumes, ultimately forming a tree structure. The top of the tree (i.e., the root node) contains only one bounding volume.

[0019] BVH traversal is typically performed in depth-first order, testing whether the ray intersects with box nodes and primitive nodes. In implementation, it first checks if the ray intersects with the bounding box of the root node. If not, the ray doesn't need further BVH tree checks; if it does, it checks if the ray intersects with the root node's child nodes (i.e., intermediate nodes). By recursively checking each intermediate node, the ray will only continue traversing those intermediate nodes that intersect with it, until it reaches a leaf node where the intersection test between the ray and the actual primitive is performed.

[0020] The first node can be a leaf node. The first node can include at least one primitive. Primitives can include, but are not limited to, transparent primitives, opaque primitives, and procedural primitives. Opaque primitives are completely opaque graphic elements. Transparent primitives are primitives with partially or completely transparent areas. Procedural primitives are not predefined geometric data, but rather graphic elements dynamically generated at runtime through code, such as circles and rectangles defined by functions.

[0021] The first object can be any primitive in the first node. The first object can be a preset primitive or any other primitive besides the preset primitive.

[0022] Typically, a ray-node intersection test includes testing the intersection of the ray with all objects within the node. A ray-object intersection test is used to determine the result of the ray-object intersection test.

[0023] The results of the intersection test between a ray and an object can include, but are not limited to, intersection information and object information. In practice, when performing an intersection test between a ray and a box node, the object can be a bounding box; when performing an intersection test between a ray and a leaf node, the object can be a primitive.

[0024] Intersection information indicates whether a ray intersects with an object. Intersection information can include, but is not limited to, intersection, non-intersection, and pending. Intersection means that the ray and the object have a point of intersection. In implementation, if intersection information includes intersection, it may also include the point of intersection. Non-intersection means that the ray and the object do not have a point of intersection. Pending means that the ray and the object may or may not intersect, requiring further determination. In implementation, when the object is found to be a preset primitive, the intersection information can be pending. Preset primitives can be primitives whose intersection status cannot be determined (i.e., the intersection information is pending), such as transparent primitives and procedural primitives.

[0025] Information about an object may include, but is not limited to, its attributes, storage location, primitive index, and vertex data. Object attributes may include, but are not limited to, position, size, color, transparency, and dynamic parameters (such as time, lifecycle, and functions). The object's storage location refers to the primitive's location in cache or memory. The primitive index defines the connection relationships between the object's vertices. The primitive's vertex data can be the vertex positions of the primitive. It is understood that for most primitives, the index and vertex data are static, but for procedural primitives, the index and vertex data are dynamically generated.

[0026] The intersection test results for different objects can include the same or different information. For example, the intersection test results for all objects include both intersection information and object information. Another example is that the intersection test results for a preset primitive include both intersection information and primitive information, while the intersection test results for other objects only include the intersection information.

[0027] The intersection test result between a ray and a first object may include intersection information, or intersection information and primitive information. In some embodiments, if the first object is not a preset primitive, the intersection test result between the ray and the first object may include intersection information. In some embodiments, if the first object is a preset primitive, the intersection test result between the ray and the first object may include intersection information and information about the first object. In practice, the intersection test result can be parsed to determine whether the first object is a preset primitive. For example, if the intersection information in the intersection test result is pending, the first object can be determined to be a preset primitive. As another example, if the transparency of the primitive in the intersection test result is 0 or contains dynamic parameters, the first object can be determined to be a preset primitive.

[0028] When the intersection test result indicates that the first object is a preset primitive, under normal circumstances, since it is impossible to determine whether the ray intersects with the first object, it is necessary to wait for the calculation unit to determine whether there is an intersection and update the length rayT of the ray (i.e., the intersection and update process) before proceeding with the subsequent intersection test. However, this solution can choose to wait for or not wait for the intersection and update process by updating the identifier, so as to maximize performance and reduce energy consumption.

[0029] Update identifiers can include, but are not limited to, a first update identifier and a second update identifier. The first update identifier indicates that the light length update is not pending, while the second update identifier indicates that the light length update is pending. Update identifiers can be any suitable representation; for example, "1" and "0" can represent the first and second update identifiers, respectively. Alternatively, "T" and "F" can represent the first and second update identifiers, respectively.

[0030] The update identifier can be configured in any suitable manner. In some implementations, the update identifier can be configured based on configuration information generated by a trained prediction model before ray tracing is performed. This prediction model can be any suitable neural network model capable of performing this function. In some implementations, the update identifier can be configured according to the use case. The use case refers to the specific scenario (or application) in which RT is applied. It is understood that different use cases may correspond to the same or different update identifiers. In some implementations, the update identifier can be pre-defined based on experience.

[0031] The second object is different from the first object. The second object can be a primitive within the first node, or it can be a second node itself. The second node can be a box node in the BVH tree, or it can be a leaf node. The second node is different from the first node.

[0032] In some implementations, when the update identifier is the first update identifier, the intersection test between the ray and the second object can be performed directly (i.e., the subsequent intersection test). In other words, the subsequent intersection test, the intersection with the first object, and the update process can be parallelized, rather than processed serially. Alternatively, the subsequent intersection test can be controlled based on the current traversal result of the BVH. The traversal result of the BVH indicates whether to continue traversing the BVH.

[0033] In some implementations, when the update identifier is the second update identifier, subsequent intersection tests can be blocked first; after the new rayT is received, subsequent intersection tests can be performed, or the subsequent intersection tests can be controlled according to the current traversal result of BVH.

[0034] In this embodiment, on the one hand, during ray tracing, when encountering preset primitives such as transparent primitives and procedural primitives, subsequent intersection tests are controlled based on the update flag (i.e., whether to wait for ray updates). Compared to related solutions that can only wait for ray updates, this application not only achieves non-waiting for ray updates, effectively decoupling the subsequent intersection tests from the ray update process, allowing them to run in parallel, but also eliminates the need for long waiting times, significantly reducing blocking during ray tracing and shortening traversal time. Furthermore, it is compatible with waiting for ray updates, reducing the potential resource consumption caused by having to perform subsequent intersection tests prematurely when the ray length is small enough to skip some nodes. This maximizes performance while improving flexibility. On the other hand, by dynamically configuring the update flag, higher flexibility and controllability are given to the update flag, thereby achieving an optimal balance between performance, power consumption, and resource utilization.

[0035] In some implementations, the ray tracing method further includes: configuration update identifiers based on configuration information generated from the trained prediction model.

[0036] Here, the prediction model can be any suitable neural network model capable of performing this function. Before inference, the prediction model can be trained or fine-tuned using a sample set to obtain the trained prediction model.

[0037] In some implementations, the configuration information can be obtained by inputting the relevant information of the current use case into the prediction model. The use case refers to the specific industry or application in which the rendering (RT) is applied. The relevant information can include, but is not limited to, any suitable information such as images, scenes (i.e., the rendered virtual 3D environment itself), names, and keywords. For example, the configuration information can be obtained by inputting the workload data of at least one frame of image during runtime into the prediction model. This workload data can include, but is not limited to, the number of bounding box tests, the number of primitive intersection tests, the number of ray emissions, the BVH construction time, and the hit rate of various levels of cache within the GPU. Alternatively, the configuration information can be obtained by inputting a portion of the scene into the prediction model.

[0038] The configuration information can be any suitable information that indicates the update identifier. For example, the configuration information can be the identifier assigned to the update identifier.

[0039] The method for determining this update identifier can be any suitable method.

[0040] In some implementations, configuration information can be directly used as an update identifier.

[0041] In some implementations, the configuration information can be converted into the corresponding target identifier based on the conversion relationship between the configuration information and the identifier, and then the updated identifier can be configured as the target identifier.

[0042] In some implementations, a correspondence between each configuration information and each update identifier can be established in advance. Based on this correspondence, the update identifier corresponding to the configuration information can be obtained.

[0043] In some implementations, the update identifier can be determined based on configuration information and identification information determined by the current usage scenario. For example, if the configuration information and identification information match (e.g., they are the same, or the similarity exceeds a threshold), the configuration information is used as the update identifier; if the configuration information and identification information do not match, either the configuration information or the identification information can be used as the update identifier, or the update identifier can be further determined based on other information.

[0044] During implementation, once the update flag is determined, it can be updated to a pre-defined register, cache, or shared memory.

[0045] In this embodiment, the update identifier is automatically configured based on the information recommended by the trained machine learning model. Compared with manual customization, this not only adapts to different operating environments, load changes, and business needs, but also reduces intervention costs and improves stability and reliability.

[0046] In some implementations, the ray tracing method further includes configuring an update identifier based on the use case corresponding to the hierarchical bounding volume.

[0047] Here, the use case refers to the industry or application corresponding to the BVH in RT. Different use cases can correspond to the same or different update identifiers. For example, the update identifier for use case A and use case C can be the first update identifier, while the update identifier for use case B can be the second update identifier.

[0048] The method for determining this update identifier can be any suitable method.

[0049] In some implementations, a correspondence between each use case and each update identifier can be established in advance. Based on this correspondence, the update identifier corresponding to the use case can be obtained.

[0050] In some implementations, the update identifier can be determined based on whether the usage scenario is a preset usage scenario. A preset usage scenario is a pre-defined usage scenario. There can be at least one preset usage scenario. It is understood that the update identifier under a preset usage scenario is pre-defined. For example, if a preset usage scenario is a pre-defined whitelist, then the update identifier under that preset usage scenario can be the first update identifier. Alternatively, if a preset usage scenario is a pre-defined blacklist, then the update identifier under that preset usage scenario can be the second update identifier. In practice, if the usage scenario is a preset usage scenario, then the update identifier under the preset usage scenario is used as the update identifier; if the usage scenario is not a preset usage scenario, then other update identifiers (i.e., update identifiers not under preset usage scenarios) are used as the update identifier.

[0051] During implementation, once the update flag is determined, it can be updated to a pre-defined register, cache, or shared memory.

[0052] In this application embodiment, the update identifier is dynamically configured according to the usage scenario, which not only improves the flexibility of configuration, but also simplifies the configuration and reduces the resource consumption caused by misconfiguration.

[0053] In some implementations, an update identifier is configured based on the usage scenario corresponding to the hierarchical enclosing body, including: when the usage scenario corresponding to the hierarchical enclosing body is a preset usage scenario, a first update identifier is used as the update identifier; when the usage scenario corresponding to the hierarchical enclosing body is another usage scenario, a second update identifier is used as the update identifier.

[0054] Here, the number of preset use cases can be at least one. In this embodiment, the preset use cases can be a pre-set whitelist. During implementation, the use case can be compared with each use case in the whitelist to determine whether the use case is a preset use case. In some implementations, several preset use cases can be pre-set according to any suitable method such as experience, offline testing, reinforcement learning, etc. These preset use cases need to set the update flag to the first update flag, that is, in the RT process of the preset use case, when the preset primitive is encountered, it is not necessary to wait for the intersection and update process of the preset primitive, but can directly perform the subsequent intersection test. Offline testing can be performed under the same use case to test the first update flag and the second update flag to determine whether the use case can be a preset use case. Reinforcement learning is a machine learning method whose core idea is to allow the agent to learn the optimal policy through trial and error in the interaction with the environment to maximize the long-term cumulative reward. During implementation, the preset use cases are configurable.

[0055] Other use cases are those other than the default use cases. In other use cases, the update flag needs to be set to the second update flag. That is, in the RT process of other use cases, when encountering the default primitive, it is necessary to wait for the intersection and update process of the default primitive.

[0056] In this application embodiment, the update identifier is configured according to whether it is a preset use scenario, which improves the flexibility, effectiveness and security of the update identifier and makes the configuration of the update identifier clearer and more controllable.

[0057] In some implementations, the "intersection test between the control ray and the second object based on the updated identifier" in step S12 includes step S121, wherein: Step S121: When the update identifier is the first update identifier, control the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume; wherein, the first update identifier indicates that the length of the ray is not waiting for an update, and the current traversal result indicates whether to continue traversing the hierarchical bounding volume.

[0058] Here, the traversal results can include, but are not limited to, the first traversal result, the second traversal result, etc. The first traversal result indicates that the BVH traversal continues. The second traversal result indicates that the traversal ends. In implementation, traversal will cease when a preset termination condition is met (i.e., the traversal ends). The termination condition can be any suitable condition for ending the traversal. For example, the termination condition could be reaching a preset maximum recursion depth. Another example is finding a specific object. Yet another example is traversing the entire BVH.

[0059] The traversal result can be determined in any suitable way. In some implementations, the traversal result can be determined based on the intersection test result of the first object. In some implementations, the traversal result can be determined by judging whether a preset termination condition is met.

[0060] Different traversal results can correspond to different control methods (i.e., the intersection test between light and object).

[0061] In some implementations, a correspondence between each traversal result and each control method can be pre-established. Based on this correspondence, the control method corresponding to the current traversal result can be obtained. For example, this correspondence includes a first traversal result corresponding to a first control method, a second traversal result corresponding to a second control method, where the first control method is to perform an intersection test between light and the object, and the second control method is not to perform an intersection test between light and the object.

[0062] In some implementations, if the current traversal result is the first traversal result, the intersection test between the ray and the second object is performed directly; if the current traversal result is the second traversal result, then the BVH traversal is not required, and the intersection test between the ray and the second object is not performed.

[0063] In this embodiment, without waiting for light updates, the current traversal results can be used to further control whether to perform subsequent intersection tests, so as to ensure the accuracy and effectiveness of the intersection tests and thereby reduce resource consumption.

[0064] In some implementations, the step S121 of "controlling the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume" includes step S1211, wherein: Step S1211: If the current traversal result represents the continuation of traversing the bounding volume, perform an intersection test between the ray and the second object.

[0065] Here, the current traversal result indicates that when continuing to traverse the BVH, the intersection test between the ray and the second object can be performed directly. It is understandable that the second object needs to be determined before performing subsequent intersection tests. The second object and the first object can be different primitives within the same leaf node, or they can be primitives within a box node or another leaf node.

[0066] The intersection test of the second object is similar to that of the first object; the intersection test of the second object is used to determine whether the second object intersects with the light ray. For implementation, please refer to the specific implementation method of step S11 described above.

[0067] The second object can be a preset primitive or not. During implementation, when the second object is a preset primitive, the same processing procedure as when the first object is a preset primitive is repeated; when the second object is not a preset primitive, it is determined whether the second object intersects with the ray. If the second object is an opaque primitive and intersects with the ray, the final result can be updated based on the intersection point (i.e., the primitive hit point closest to the camera), and intersection tests of subsequent objects can be performed.

[0068] In this embodiment, subsequent intersection tests are performed directly when traversal needs to continue without waiting for ray updates, thus achieving parallel execution of ray updates and subsequent intersection tests. This achieves the goal of executing subsequent intersection tests in advance, thereby shortening traversal time and improving performance.

[0069] In some implementations, the "intersection test between the control ray and the second object based on the updated identifier" in step S12 includes steps S122 and S123, wherein: Step S122: When the update identifier is the second update identifier, block the intersection test between the ray and the second object; wherein, the second update identifier represents the length update of the ray to be waited for. Step S123: Upon receiving the updated length of the ray, control the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume.

[0070] Here, when the update flag is the second update flag, it's necessary to wait for the intersection and update process of the first object. Therefore, subsequent intersection tests can be blocked until the updated length is received. Blocking means temporarily suspending subsequent intersection tests when the update flag is the second update flag. This blocking mechanism ensures the stability of intersection tests and avoids resource conflicts.

[0071] The current traversal result can be either the first traversal result or the second traversal result. In implementation, the intersection test process of the second object can be found in the specific implementation of the aforementioned step S1211.

[0072] In this embodiment, on the one hand, while waiting for the light rays to be updated, subsequent intersection tests are blocked. This avoids resource consumption caused by prematurely executing subsequent intersection tests when the light ray length becomes shorter and sufficient to skip some nodes. On the other hand, after receiving the new light ray length, further control is exercised based on the traversal results to determine whether to perform subsequent intersection tests between light rays and objects, ensuring the accuracy and effectiveness of the intersection tests and thus reducing resource consumption.

[0073] In some implementations, the ray tracing method further includes determining the current traversal result of the hierarchical bounding volume based on the intersection test results.

[0074] Here, the intersection test results may include, but are not limited to, intersection information, primitive information, etc.

[0075] The result of this traversal can be determined in any suitable way.

[0076] In some implementations, a correspondence between each intersection test result and each traversal result can be established in advance. Based on this correspondence, the current traversal result that matches the intersection test result can be obtained.

[0077] In some implementations, the intersection test results can be parsed to determine whether a preset termination condition is met, thereby determining the current traversal result. For example, the intersection information and object information can be parsed. If the object is a preset target object and intersects with the light ray, the second traversal result can be used as the current traversal result; if the object is not a preset target object and / or the object does not intersect with the light ray, the first traversal result can be used as the current traversal result.

[0078] In this embodiment, the intersection test results of the objects are used to quickly determine whether to continue traversing, so as to ensure the validity of subsequent traversals, thereby improving traversal efficiency and reducing invalid calculations.

[0079] In some implementations, when the first object is a preset primitive, the ray tracing method further includes: transmitting the intersection test results to the computing unit so that the computing unit updates the length of the ray based on the intersection test results.

[0080] Here, the computing unit can be any suitable hardware unit or a hardware-software hybrid unit capable of implementing this function. This computing unit is a core component in RT specifically designed for processing preset primitives. Its main responsibility is to perform the intersection and update process based on the intersection test results of the first object, i.e., determining whether the first object intersects with the ray and updating rayT. In implementation, the computing unit can determine whether the ray intersects with the first object based on the first object's information and the current rayT. If they intersect, the rayT is updated based on the intersection point (i.e., the distance between the ray's origin and the intersection point is added to the current rayT); if they do not intersect, the current rayT is used as the new rayT.

[0081] In some implementations, the computing unit and the device performing the ray tracing method can communicate. In practice, the device performing the ray tracing method can transmit intersection test results to the computing unit via direct transmission, indirect transmission, shared memory, broadcasting, or other methods. For example, if the computing unit and the device communicate directly, the device can send the intersection test results to the computing unit. In practice, the computing unit can be located inside or outside the device.

[0082] In the embodiments of this application, when a specific primitive is encountered, the light is updated by a dedicated computing unit based on the intersection test results of the object, which significantly improves the update efficiency and reduces resource contention, thereby improving the overall efficiency and energy efficiency of ray tracing.

[0083] Based on the above embodiments, this application also provides a ray tracing device, which can be located within a GPU. Figure 2 This is a schematic diagram of the first component structure of a ray tracing device provided in an embodiment of this application, as shown below. Figure 2 As shown, the ray tracing device 20 includes a configuration unit 21 and a processing unit 22, wherein: Configuration unit 21 is used to store update flags; wherein, the update flag indicates whether to wait for the length of the light to be updated, and the update flag is dynamically configured; Processing unit 22 is used to obtain a first object from the storage unit, the first object being a primitive of a first node in a hierarchical bounding volume; determine the intersection test result of the ray and the first object; if the intersection test result indicates that the first object is a preset primitive, obtain an update identifier from the configuration unit, and control the intersection test of the ray and the second object based on the update identifier, the second object being a primitive of the first node or a second node in a hierarchical bounding volume.

[0084] Here, the configuration unit can be any suitable hardware unit capable of implementing this function, such as a register or flip-flop. The role of the configuration unit is to pre-configure the update flag before performing the response time (RT), thereby reducing subsequent waiting time and ensuring the orderliness and correctness of intersection tests for each object.

[0085] The processing unit can be any suitable hardware or hardware / software combination unit capable of implementing this function. It is the core component in RT used for intersection testing of controlled objects. In RT, the processing unit is mainly responsible for receiving intersection test requests from upstream and performing subsequent intersection tests based on these requests.

[0086] The storage unit can be any suitable unit capable of storing the nodes in BVH, such as a memory or cache. In implementation, the storage unit can communicate with the processing unit to retrieve objects from the storage unit. In some embodiments, the processing unit can first determine the address of an object and send that address to the storage unit; the storage unit then retrieves the object based on its address and returns it to the processing unit. In some embodiments, the storage unit can be located within or outside the ray tracing device. In implementation, the storage unit can be located in on-chip memory on the GPU or in external memory outside the GPU.

[0087] The first node can be a leaf node. The first node can include at least one primitive. Primitives can include, but are not limited to, transparent primitives, opaque primitives, procedural primitives, etc.

[0088] The first object can be a preset primitive or a primitive other than a preset primitive.

[0089] The intersection test result between the ray and the first object may include, but is not limited to, intersection information, primitive information, etc. The specific implementation of step S11 above can be referred to by the processing unit in determining the intersection test result of the first object.

[0090] Preset primitives can be primitives whose intersection is uncertain (i.e., intersection information is pending), such as transparent primitives and procedural primitives.

[0091] The update identifier may include, but is not limited to, a first update identifier, a second update identifier, etc. The configuration process of this update identifier can refer to the foregoing method embodiments.

[0092] The second object is different from the first object. The specific implementation of step S12 above can be found for how the processing unit controls the intersection test of the second object.

[0093] In some implementations, the processing unit may include, but is not limited to, a traversal unit and an intersection testing unit, which manage and optimize the intersection testing of objects. The traversal unit can be any suitable hardware or hardware / software combination unit capable of implementing this function; it is responsible for the traversal control of the BVH (Browser Volume Hierarchy), improving resource utilization while reducing traversal time. The intersection testing unit can also be any suitable hardware or hardware / software combination unit capable of implementing this function; it is primarily responsible for the intersection testing of boxes and primitives. In implementation, the intersection testing unit is used to retrieve a first object from the storage unit; determine the intersection test result between the ray and the first object; and, if the intersection test result indicates that the first object is a preset primitive, retrieve an update identifier from the configuration unit. The traversal unit is used to control the intersection testing of the ray and a second object based on the update identifier.

[0094] In this embodiment, on the one hand, during ray tracing, when encountering preset primitives such as transparent primitives and procedural primitives, the processing unit controls subsequent intersection tests based on the update flag (i.e., whether to wait for ray updates). Compared to related solutions that can only wait for ray updates, this application not only achieves non-waiting for ray updates, effectively decoupling the subsequent intersection tests from the ray update process, allowing subsequent intersection tests and ray updates to run in parallel, but also eliminates the need for long waiting times, greatly reducing blocking phenomena during ray tracing and shortening traversal time. Furthermore, it is compatible with waiting for ray updates, reducing the possibility of increased resource consumption due to the need to execute subsequent intersection tests prematurely when the ray length is small enough to skip some nodes. This maximizes performance while improving flexibility. On the other hand, by dynamically configuring the update flag, higher flexibility and controllability are given to the update flag, thereby achieving an optimal balance between performance, power consumption, and resource utilization.

[0095] In some embodiments, the processing unit 22 is further configured to send the intersection test result to a preset calculation unit when the intersection test result indicates that the first object is a preset primitive; the calculation unit is configured to determine the intersection result between the ray and the first object based on the intersection test result; update the length of the ray based on the intersection result between the ray and the first object to obtain the updated length; and send the updated length to the processing unit; the processing unit is further configured to control the intersection test between the ray and a third object based on the updated length.

[0096] Here, the computation unit communicates with the processing unit. This computation unit is a core component in RT dedicated to processing preset primitives, and it can reside within the GPU. Its primary function is to perform intersection and update processes. In implementation, this computation unit can be located within or outside the ray tracing apparatus.

[0097] The intersection test results of the first object may include, but are not limited to, intersection information, object information, etc.

[0098] The intersection result characterizes whether a ray intersects with an object. This intersection result can include, but is not limited to, intersection or non-intersection. In this embodiment, the intersection result between the ray and the first object can be further determined based on the information of the first object. For example, if the information of the first object indicates that the first object is a procedural primitive, then the intersection result can be solved jointly based on the expression of the procedural primitive and the equation corresponding to the ray. As another example, if the information of the first object indicates that the first object is a transparent primitive, then the intersection result is determined based on the equation corresponding to the ray, as well as the index and vertex position of the transparent primitive.

[0099] The update of rayT can include: if the intersection result is intersecting, then update rayT according to the intersection point; if the intersection result is not intersecting, then use the original rayT as the new rayT (i.e., the updated rayT).

[0100] The third object can be the same as or different from the second object. The third object can be a primitive in the first node, or a primitive in a box node or another leaf node. In implementation, the intersection test of the third object can refer to the intersection test of the first or second object mentioned above. It is understood that in this application, the intersection test process of each bounding volume is the same, and the intersection test process of each primitive is the same.

[0101] In this embodiment, when encountering specific primitives, a dedicated computing unit performs intersection calculations and updates based on the object's intersection test results, significantly improving computational efficiency and reducing resource contention, thereby improving the overall efficiency and energy efficiency of ray tracing. Subsequent ray and object intersection tests are performed based on the new ray length to ensure the accuracy and effectiveness of the intersection tests.

[0102] In some implementations, the processing unit 22 includes a traversal unit and an intersection testing unit. The traversal unit is used to determine the address of the first node and send the address of the first node to the storage unit. The storage unit is used to send the first node to the intersection testing unit based on the address of the first node. The intersection testing unit is used to determine the intersection test result between the ray and the first object. If the intersection test result indicates that the first object is a preset primitive, an update identifier is obtained and sent to the traversal unit. The traversal unit is used to control the intersection test between the ray and the second object based on the update identifier.

[0103] Here, the traversal unit communicates with the storage unit at least once.

[0104] The address of a node can be determined in any suitable way. In some implementations, the address of a node can be determined based on its hierarchical information (i.e., its position in the BVH), index, pointer, etc. In practice, the address of each node mainly depends on its storage method in memory and the construction process. For example, if all nodes in the BVH are stored in a contiguous array, the address of a node can be directly calculated based on its index in the array; this storage method facilitates caching and memory optimization. Another example is when using dynamic memory, where each node points to its child nodes via pointers, and the address of the node is its physical address in memory; this result offers greater flexibility during construction and traversal. Yet another example is that the node structure can contain pointers to parent and sibling nodes; these pointers can then be used to determine the address of a node during traversal.

[0105] In some implementations, a data transfer relationship exists between the traversal unit and the computation unit. After receiving the ray or updated rayT sent by the computation unit, the traversal unit forwards the ray or updated rayT to the intersection test module for subsequent intersection testing. This separate design helps decouple the ray update and intersection test logic, improving overall tracking efficiency.

[0106] After receiving the address of a node, the storage unit reads the node's content based on that address and sends at least a portion of the node's content to the intersection test unit. The node's content may include, but is not limited to, information about each bounding volume and each primitive. In some embodiments, the storage unit may send the entire node's content to the intersection test unit, or it may send it in batches.

[0107] The intersection testing unit communicates with at least the storage unit, the traversal unit, and the configuration unit. In implementation, when the intersection testing unit receives the first object, it can immediately or sequentially perform the intersection test on the first object. The process by which the intersection testing unit determines the intersection test result of the first object can be found in the specific implementation of step S11 above. When the intersection testing unit finds that the first object is a preset primitive, it reads the update flag from the configuration unit and synchronizes the update flag to the traversal unit. In implementation, generally, regardless of whether the first object is a preset primitive, the intersection testing unit needs to send the intersection test result to the traversal unit. The traversal unit controls the intersection test of the second object, as can be found in the specific implementation of step S12 above.

[0108] In this embodiment, the processing unit is subdivided into a traversal unit and an intersection test unit. The traversal unit determines the node address and initiates the acquisition of node data. Then, the intersection test unit is responsible for performing the intersection test between the node and the ray. Finally, the traversal unit controls the subsequent intersection test. Through the collaborative work of these two units, the continuity and efficiency of the entire processing flow are ensured, thereby achieving efficient automated ray tracing.

[0109] In some implementations, the intersection testing unit is further configured to send the intersection testing result to the traversal unit; the traversal unit is further configured to determine the current traversal result of the hierarchical bounding volume based on the intersection testing result; and control the intersection testing of the ray with the second object based on the current traversal result of the hierarchical bounding volume and the update identifier.

[0110] Here, the intersection test unit and the traversal unit are both sub-modules of the processing unit. The intersection test unit is responsible for handling the intersection test between the object and the ray, and the traversal unit is responsible for the traversal control of BVH.

[0111] Update identifiers may include, but are not limited to, first update identifiers, second update identifiers, etc.

[0112] The traversal results may include, but are not limited to, the first traversal result, the second traversal result, etc. The process by which this traversal unit determines the current traversal result can be found in the aforementioned method embodiments.

[0113] In some implementations, when the update identifier is the first update identifier, the intersection test between the ray and the second object can be controlled based on the current traversal result; when the update identifier is the second update identifier, the intersection test between the ray and the second object can be blocked first, and after receiving a new rayT, the intersection test between the ray and the second object can be controlled based on the current traversal result. In implementation, controlling the intersection test of the second object based on the current traversal result can be found in the aforementioned method embodiments.

[0114] In some implementations, when the current traversal result is the first traversal result, the intersection test between the ray and the second object can be controlled based on the update flag. For example, if the update flag is the first update flag, the intersection test between the ray and the second object is performed; if the update flag is the second update flag, the intersection test between the ray and the second object can be blocked first, and then performed after a new rayT is received.

[0115] In some implementations, ray tracing is stopped if the current traversal result is the second traversal result; that is, intersection testing between the ray and the second object is not performed.

[0116] In this embodiment, on the one hand, the traversal unit quickly determines whether to continue traversing based on the intersection test result of the first object to ensure the validity of subsequent traversals, thereby improving traversal efficiency and reducing invalid calculations. On the other hand, the traversal unit controls whether to perform subsequent intersection tests based on the traversal results and update flags to ensure the accuracy and validity of the intersection tests.

[0117] In some implementations, the processing unit 22 is configured to control the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding body when the update identifier is a first update identifier; wherein the first update identifier indicates that the ray length update is not waited for, and the current traversal result indicates whether to continue traversing the hierarchical bounding body.

[0118] In some implementations, the processing unit 22 is configured to perform an intersection test between the ray and the second object, provided that the current traversal result characterizes a continued traversal of the bounding volume of the hierarchy.

[0119] In some implementations, the processing unit 22 is used to determine the current traversal result of the hierarchical bounding volume based on the intersection test results.

[0120] In some implementations, the processing unit 22 is configured to block the intersection test between the ray and the second object when the update identifier is a second update identifier; wherein the second update identifier represents waiting for the length update of the ray; and upon receiving the updated length of the ray, control the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume.

[0121] In some implementations, the processing unit 22 is used to configure an update identifier based on the configuration information generated by the trained prediction model; or, based on the usage scenario corresponding to the hierarchical enclosing volume.

[0122] In some implementations, the processing unit 22 is configured to use the first update identifier as the update identifier when the usage scenario corresponding to the hierarchical enclosing body is a preset usage scenario; and to use the second update identifier as the update identifier when the usage scenario corresponding to the hierarchical enclosing body is another usage scenario.

[0123] The description of the above device embodiments is similar to that of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0124] The technical solution of this application is described in detail below.

[0125] Ray tracing is a graphics rendering technique that differs from traditional rasterization rendering. Ray tracing simulates the propagation of light rays in a scene, including their intersection, reflection, refraction, and occlusion, ultimately determining the color of each pixel. This method can simulate the physical properties of lighting in the real world, resulting in more realistic visual effects. Its basic process includes: 1. Light rays are emitted from the camera position and enter the scene; 2. Determine whether the light ray intersects with geometric primitives in the scene; 3. Find the pixel hit point closest to the camera; 4. Calculate the color of the hit point; 5. Generate secondary rays as needed, for example: a. Shadow rays: Point the light from the intersection of rays towards the light source and see if the light is blocked to determine if you are in a shadow; b. Reflected rays: If the surface is smooth (such as a mirror), reflected rays will be generated and continue to track, even tracking content outside the scene; c. Refracted light rays: If an object is transparent (such as glass or liquid), it will generate refracted light rays that pass through the object; 6. Perform recursive operations on the above steps as needed; 7. Summarize all the tracked light information and calculate the final color of the pixel.

[0126] In practice, primitives are organized into spatial data structures to accelerate the efficiency of intersection calculation.

[0127] Hierarchical bounding volumes are a commonly used data structure. They are based on a tree structure and contain different types of nodes, including but not limited to internal / box nodes and leaf / primitive nodes.

[0128] BVH traversal is a depth-first tree traversal that proceeds by testing whether a ray intersects with intermediate box nodes and leaf primitive nodes.

[0129] During the process of light rays intersecting with primitives, they may encounter primitives with different properties, such as transparent (non-opaque) primitives, opaque (opaque) primitives, and procedural primitives.

[0130] Transparent primitives and procedural primitives need to wait for the program (corresponding to the aforementioned calculation unit) to calculate whether the ray intersects with it and update the length of the ray ray T. During the program calculation process, subsequent ray-primitive intersection tests will wait for the update of ray T before continuing the intersection test until the final nearest primitive intersection point is found.

[0131] The drawback of this approach is that when the ray tracing intersection module (corresponding to the aforementioned intersection test unit) encounters transparent or procedural primitives, it needs to hand over the intersection calculation to the program calculation unit (corresponding to the aforementioned calculation unit) and wait for the calculation result to be updated before continuing to find intersections for the next primitive, which takes a relatively long time. If the intersection result is non-intersecting or has little impact on the ray length (rayT), then it is still necessary to continue finding intersections and cannot skip subsequent traversal nodes, thus affecting performance.

[0132] The technical solution of this application can skip the wait for rayT update, allowing the system (corresponding to the aforementioned ray tracing device) to continue the intersection traversal of subsequent boxes and primitives.

[0133] like Figure 3 As shown, the device provided in this application mainly includes a program execution module 31 (corresponding to the aforementioned computing unit), a hierarchical bounding volume traversal module 32 (corresponding to the aforementioned traversal unit), an accelerated data structure 33 (corresponding to the aforementioned storage unit), a configuration register control module 34 (corresponding to the aforementioned configuration unit), and an intersection test module 35 (corresponding to the aforementioned intersection test unit).

[0134] The intersection test module 35 includes a primitive intersection test module 351 and a box intersection test module 352. The primitive intersection test module 351 includes an opaque primitive processing module 3511 and a transparent / procedural primitive processing module 3512.

[0135] Program execution module 31: responsible for sending light into the layer bounding volume traversal module 32 and executing software-defined programs, including but not limited to processing opaque primitives and procedural primitives; Hierarchical bounding volume traversal module 32: responsible for traversal control; Accelerating Data Structure 33: Storing hierarchical bounding volume data, including but not limited to intermediate box nodes and leaf primitive nodes; Configuration register control module 34: used to configure whether the opaque primitive test can be performed without waiting for the program execution module 31 to update the ray length rayT when encountering transparent primitives or procedural primitives. Its name is defined as rayT update skip enable register. Intersection Testing Module 35: Responsible for intersection testing of boxes and primitives; Box intersection test module 352: Responsible for box intersection testing; Primitive Intersection Test Module 351: Responsible for primitive intersection testing; Opaque primitive processing module 3511: Responsible for processing opaque primitives; Transparent / Procedural Primitive Processing Module 3512: Responsible for transparent and procedural primitive processing; The processing flow of this device is as follows: The program execution module sends the light rays to the hierarchical bounding volume traversal module, which calculates the address of the accelerated data structure to access the accelerated data structure. The accelerated data structure sends the node data to the intersection test module. The intersection test module returns the box or primitive intersection test result to the hierarchical bounding volume traversal module. The hierarchical bounding volume traversal module determines whether to continue traversing based on the intersection test result, or returns the data if all traversals have been completed.

[0136] If the hierarchical bounding volume traversal module finds that the current processing object is a procedural primitive, it sends it along with the current ray length rayT of the system to the program execution module for calculation. The program execution module then sends the result (i.e., the new ray length) back to the traversal control (i.e., the hierarchical bounding volume traversal module) and the intersection test module.

[0137] If the intersection test module finds that the current processing object is a transparent primitive, it sends the test result (i.e., the primitive's attributes) to the program execution module through the hierarchy bounding volume traversal module for calculation, and the result (i.e., the new ray length) is sent back to the intersection test module.

[0138] Whether the intersection test module and the traversal system (i.e., the hierarchy bounding volume traversal module) wait for an update of rayT while the program execution module is processing transparent or procedural primitives can be determined by the value of the "rayT update skip enable register". Figure 4 As shown: 1) Enable When enabled, the intersection testing module and traversal system continue execution. If a transparent or procedural primitive is encountered, the processing steps described above for the program execution module are repeated. If an opaque primitive is encountered and intersects with the current ray, the primitive intersection testing module updates the intersection test result to the latest primitive. This process continues until the traversal is complete. The program execution module and intersection testing module will find zero, one, or more intersection results for transparent or procedural primitives, as well as zero or one intersection test result for opaque primitives. Finally, the program execution module's program flow calculates the final result (i.e., the primitive that most recently intersects with the ray).

[0139] The advantage of enabling this feature is that intersection and traversal can continue to be executed. If the rayT returned by the program execution module is not updated or is not updated enough, causing some nodes of the remaining level bounding volume tree to be skipped, then continuing to execute can be done in advance, shortening the traversal time and improving performance.

[0140] Disadvantages of enabling this feature: If the rayT returned by the program execution module becomes small enough to skip some nodes of the hierarchical bounding volume tree, then the part that continues to be executed is redundant, increasing system energy consumption and reducing performance.

[0141] 2) Prohibited In the prohibited state, the intersection testing module and traversal system are suspended until the program execution module updates the latest rayT and resumes operation. Finally, it finds the intersection results of zero, one or more transparent or procedural primitives, as well as the intersection results of zero or one opaque primitive. The final result is then calculated by the program flow of the program execution module.

[0142] Advantages of prohibition: Compared to the disadvantages of enabling, prohibition avoids the need for continued execution.

[0143] Disadvantages of prohibiting it: Compared to the advantages of enabling it, it loses the performance improvement brought by early execution.

[0144] like Figure 5 As shown, the ray tracing method includes steps S51 to S512, wherein: Step S51: Light generation; Step S52: Capture the hierarchical bounding volume nodes; Step S53: Traverse intermediate nodes; Step S54: Traverse the leaf nodes; Step S55: Determine whether the graphic element is a programmed graphic element or a transparent graphic element. If yes, proceed to step S56; otherwise, proceed to step S58. Step S56: Program execution; Step S57: Determine whether the rayT update skip enable register is enabled. If yes, proceed to step S58; otherwise, proceed to step S510. Step S58: Continue to find the intersection traversal; Step S59: Determine whether the hierarchical enclosing volume has been traversed. If yes, proceed to step S512; otherwise, proceed to step S52. Step S510: Wait for rayT to update; Step S511: Determine whether rayT has been updated. If yes, proceed to step S58; otherwise, proceed to step S510. Step S512: After the traversal ends, return the final result.

[0145] As previously discussed, enabling or disabling "ray update skip enable register" can have both benefits and drawbacks, depending on the physical location of the ray and the acceleration structure (i.e., the location of each primitive the ray passes through). The specific implementation requires software configuration based on the specific workload. 1. Based on the analysis and operation of the workload (i.e., whether it is whitelisted), the configuration is directly handled by the software driver (i.e., the software that drives the registers); 2. Through a reinforcement learning system (i.e., training a neural network model), configuration can be made directly via a software driver or in real time based on overall performance feedback.

[0146] The effect of this solution is that the system can effectively configure whether the intersection of the ray and the accelerated data structure node needs to wait for the update of the ray length rayT according to the actual situation, thereby maximizing system performance and reducing energy consumption.

[0147] The advantage of this solution is that the "rayT update skip enable register" can be flexibly configured. It can be configured by software based on workload analysis or by automatic control after machine learning, so as to achieve the effect of higher performance and lower power consumption as the more it runs.

[0148] It should be noted that, in the embodiments of this application, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of software products. These software products are stored in a storage medium and include several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0149] This application provides a graphics processor including any of the aforementioned ray tracing devices. In some embodiments, the graphics processor may further include the aforementioned computing unit and / or storage unit.

[0150] This application provides an electronic device including the aforementioned graphics processor. The electronic device can be various types of terminals such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), or it can be implemented as a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0151] It should be noted that the descriptions of the processor and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the processor and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0152] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0153] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0155] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0156] In addition, each functional unit in the embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0157] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0158] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.

[0159] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A ray tracing method, characterized in that, include: Determine the intersection test result between the ray and the first object, where the first object is a primitive of the first node in the hierarchical bounding volume; When the intersection test result indicates that the first object is a preset primitive, the intersection test between the ray and the second object is controlled based on the update flag. The update flag indicates whether to wait for the length update of the ray. The update flag is dynamically configured. The update flag is either a first update flag or a second update flag. The first update flag indicates that the length update of the ray is not waited for, and the second update flag indicates that the length update of the ray is waited for. The second object is a primitive in the first node or a second node in the hierarchical bounding body. The preset primitive is a transparent primitive or a procedural primitive.

2. The ray tracing method according to claim 1, characterized in that, The intersection test between the ray and the second object based on the updated identifier includes: When the update identifier is the first update identifier, the intersection test between the ray and the second object is controlled based on the current traversal result of the hierarchical bounding volume; wherein, the current traversal result indicates whether to continue traversing the hierarchical bounding volume.

3. The ray tracing method according to claim 2, characterized in that, The step of controlling the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume includes: If the current traversal result indicates that the hierarchical bounding volume continues to be traversed, an intersection test is performed between the ray and the second object.

4. The ray tracing method according to claim 2, characterized in that, The ray tracing method also includes: Based on the intersection test results, the current traversal result of the hierarchical bounding volume is determined.

5. The ray tracing method according to claim 1, characterized in that, The intersection test between the ray and the second object based on the updated identifier includes: If the update identifier is the second update identifier, then the intersection test between the light ray and the second object is blocked; Upon receiving the updated length of the ray, the intersection test between the ray and the second object is controlled based on the current traversal result of the hierarchical bounding volume.

6. The ray tracing method according to claim 1, characterized in that, The ray tracing method also includes: Configure the update identifier based on the configuration information generated by the trained prediction model; or, Configure the update identifier based on the usage scenario corresponding to the hierarchical enclosing body.

7. The ray tracing method according to claim 6, characterized in that, The configuration of the update identifier based on the usage scenario corresponding to the hierarchical enclosing volume includes: When the usage scenario corresponding to the hierarchical enclosing body is a preset usage scenario, the first update identifier is used as the update identifier; If the usage scenario corresponding to the hierarchical enclosing body is a usage scenario other than the preset usage scenario, the second update identifier shall be used as the update identifier.

8. The ray tracing method according to any one of claims 1 to 7, characterized in that, When the first object is the preset primitive, the ray tracing method further includes: The intersection test results are transmitted to the calculation unit so that the calculation unit updates the length of the light ray based on the intersection test results.

9. A ray tracing device, characterized in that, It includes a configuration unit and a processing unit, wherein: A configuration unit is used to store an update identifier; wherein the update identifier indicates whether to wait for an update of the light length, and the update identifier is dynamically configured; A processing unit is configured to: retrieve a first object from a storage unit, wherein the first object is a primitive of a first node in a hierarchical bounding volume; determine the intersection test result of the ray and the first object; and, if the intersection test result indicates that the first object is a preset primitive, retrieve the update identifier from the configuration unit, and control the intersection test of the ray and a second object based on the update identifier, wherein the second object is a primitive of the first node or a second node in the hierarchical bounding volume, the preset primitive is a transparent primitive or a procedural primitive, and the update identifier is a first update identifier or a second update identifier, wherein the first update identifier indicates that the length of the ray is not being waited for, and the second update identifier indicates that the length of the ray is being waited for.

10. The ray tracing device according to claim 9, characterized in that, The processing unit includes a traversal unit and an intersection testing unit, wherein: The traversal unit is used to determine the address of the first node and send the address of the first node to the storage unit. The storage unit is used to send the first node to the intersection test unit based on the address of the first node; The intersection test unit is used to determine the intersection test result between the ray and the first object; when the intersection test result indicates that the first object is the preset primitive, the update identifier is obtained and the update identifier is sent to the traversal unit; The traversal unit is used to control the intersection test between the ray and the second object based on the update identifier.

11. The ray tracing device according to claim 10, characterized in that, The intersection test unit is also used to send the intersection test result to the traversal unit; The traversal unit is further configured to determine the current traversal result of the hierarchical bounding volume based on the intersection test result; and to control the intersection test between the ray and the second object based on the current traversal result of the hierarchical bounding volume and the update identifier.

12. The ray tracing device according to any one of claims 9 to 11, characterized in that, The processing unit is further configured to send the intersection test result to a preset calculation unit when the intersection test result indicates that the first object is the preset primitive; The calculation unit is used to determine the intersection result between the ray and the first object based on the intersection test result; Based on the intersection result of the ray and the first object, the length of the ray is updated to obtain the updated length; the updated length is then sent to the processing unit. The processing unit is also used to control the intersection test between the light ray and the third object based on the updated length.

13. A graphics processor, characterized in that, The ray tracing device includes any one of claims 9 to 12.

14. An electronic device, characterized in that, Includes the graphics processor as described in claim 13.

Citation Information

Patent Citations

  • Query-specific behavioral modification of tree traversal

    US20200051315A1