Ray beam tracking methods, equipment and storage media
By dividing and subdividing the target scene into regions and selecting the objects to be rendered, the problem of high computational complexity in ray tracing is solved, and the speed of ray tracing and image rendering is improved.
Patent Information
- Application Number
- CN202411822123.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2044-12-11
AI Technical Summary
Existing ray tracing technology has high computational complexity, resulting in poor ray tracing speed and image rendering speed.
By dividing the target scene into regions, the intersection test between the ray beam to be tracked and the target region is first performed to filter out the intersecting target regions. Then, the target sub-regions are further subdivided and intersection tests are performed. Only the intersecting objects to be rendered are rendered, reducing computational complexity.
It improves the speed of ray tracing and image rendering, while reducing computational complexity.
Smart Images

Figure CN119888050B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ray tracing technology, and in particular to a ray beam tracing method, device and storage medium. Background Technology
[0002] Currently, ray tracing is widely used as a rendering technique in various scenarios, such as image rendering, video rendering, and game scene rendering, to generate realistic images and provide users with visual effects similar to the real environment. However, in related technologies, due to the high computational complexity required for ray tracing, the tracing rate of rays is often poor, resulting in a poor rendering rate for the image. Summary of the Invention
[0003] The main objective of this application is to provide a ray tracing method, device, and storage medium, which aims to reduce the computational complexity of ray tracing, increase the ray tracing rate, and thus improve the image rendering rate.
[0004] In a first aspect, this application provides a ray beam tracing method, the ray beam tracing method comprising:
[0005] Obtain the ray beam to be tracked corresponding to the target scene;
[0006] An intersection test is performed between the ray beam to be tracked and the target region in the target scene to obtain a first test result; the size of the target region is smaller than the size of the target scene.
[0007] When the first test result indicates that the ray beam to be tracked intersects with the target region, an intersection test is performed on the ray beam to be tracked and the target sub-region in the target region to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes the object to be rendered;
[0008] When the second test result indicates that the ray beam to be tracked intersects with the target sub-region, an intersection test is performed on the ray beam to be tracked and the object to be rendered in the target sub-region to obtain a third test result;
[0009] When the third test result indicates that the ray beam to be tracked intersects with the object to be rendered, the object to be rendered is rendered according to the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered.
[0010] Secondly, this application also provides a computer device, which includes a memory and a processor;
[0011] The memory is used to store computer programs;
[0012] The processor is configured to execute the computer program and, in executing the computer program, implement the steps of the ray beam tracing method as described above.
[0013] Thirdly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the ray beam tracing method described above.
[0014] This application provides a ray tracing method, device, and storage medium. The ray tracing method includes: acquiring a ray beam to be traced corresponding to a target scene; performing an intersection test between the ray beam to be traced and a target region in the target scene to obtain a first test result; the size of the target region is smaller than the size of the target scene; when the first test result indicates that the ray beam to be traced intersects with the target region, performing an intersection test between the ray beam to be traced and a target sub-region in the target region to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes an object to be rendered; when the second test result indicates that the ray beam to be traced intersects with the target sub-region, performing an intersection test between the ray beam to be traced and the object to be rendered in the target sub-region to obtain a third test result; when the third test result indicates that the ray beam to be traced intersects with the object to be rendered, rendering the object to be rendered based on the lighting information of the ray beam to be traced and the object attributes of the object to be rendered.
[0015] For example, during the tracing of a ray, the computer device can divide the target scene into multiple target regions. The computer device can then perform intersection tests between the ray to be traced and each of these target regions to select the target region that intersects with the ray. The computer device can further divide the target region into sub-regions. The computer device can then perform intersection tests between the ray to be traced and each of these sub-regions to select the target sub-region that intersects with the ray. Since the target sub-region includes the object to be rendered, the computer device can perform an intersection test between the ray and the object to be rendered within the target sub-region that intersects with the ray. Once it is determined that the ray intersects with the object, the computer device can combine the lighting information of the ray with the object to be rendered for rendering. Based on this, the computer device does not need to divide the target area into target sub-regions that do not intersect with the ray beam to be tracked, nor does it need to perform intersection tests on the objects to be rendered in the target sub-regions that do not intersect with the ray beam to be tracked. This reduces the computational complexity of ray beam tracing and increases the tracing rate of the ray beam to be tracked, thereby improving the rendering rate of the image. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic flowchart of a beam tracing method provided in an embodiment of this application;
[0018] Figure 2 This is a schematic block diagram of a target scenario according to an embodiment of this application;
[0019] Figure 3 This is a schematic block diagram of the target area involved in an embodiment of this application;
[0020] Figure 4 This is a schematic block diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the described order. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0023] This application provides a ray beam tracing method, device, and storage medium. The ray beam tracing method can be applied to computer devices, such as mobile phones, tablets, laptops, and desktop computers. It can also be applied to servers, which can be standalone servers or cloud servers 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.
[0024] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0025] Please see Figure 1 , Figure 1 This is a flowchart illustrating a ray tracing method provided in an embodiment of this application. It should be noted that the ray tracing method provided in this embodiment can be used in a computer device, and of course, it can also be used in a server. For example, the server can obtain the ray beam to be traced corresponding to the target scene from the computer device, and perform corresponding processing on the ray beam to be traced according to the ray tracing method to obtain a third test result corresponding to the ray beam to be traced. For example, when the third test result indicates that the ray beam to be traced intersects with the object to be rendered, the server can, for example, send the lighting information of the ray beam to be traced and the object attributes of the object to be rendered to the computer device, so that the computer device can render the object to be rendered; however, this is not limited to this, and no limitation is made here.
[0026] In practice, computer devices include, but are not limited to, any of the following: mobile phones, tablets, laptops, and desktop computers; servers can be standalone servers, server clusters, or cloud servers that provide cloud computing services.
[0027] like Figure 1 As shown, the beam tracking method includes steps S101 to S105.
[0028] Step S101: Obtain the ray beam to be tracked corresponding to the target scene.
[0029] In some implementations, the target scene can be pre-set or user-defined, without limitation. A light source may be present in the target scene. The light source can be used to provide a ray of light to be tracked to the target scene. For example, the computer device can determine light source information such as the position of the light source in the target scene, the color of the light source, the intensity of the light source, and the type of the light source. The type of light source includes, for example, a point light source, a parallel light, a spotlight, etc., without limitation. Accordingly, the illumination information of the ray of light to be tracked provided by the light source to the target scene can be determined based on the light source information. The computer device can sample the ray of light to be tracked provided by the light source in conjunction with the light source information. Accordingly, the computer device can obtain the ray beam of light corresponding to the target scene from the ray of light to be tracked provided by the light source.
[0030] The beam of light to be tracked can be used by subsequent computer equipment to track the beam of light.
[0031] In some implementations, the light rays to be tracked that illuminate the target scene are sampled; based on a trained light beam recognition model, the type of light beam corresponding to the light ray to be tracked is determined according to the illumination information of the light ray to be tracked; and the light beam to which the light ray to be tracked belongs is determined based on all light rays to be tracked with the same light beam type.
[0032] For example, a trained ray beam recognition model can be trained on a large number of preset rays. These preset rays can be determined by the light provided by light sources under different light source information to different preset scenes, resulting in different illumination information for each preset ray. During the training of the ray beam recognition model, the computer needs to learn how to identify the differences between different preset rays within the same preset scene, and how to merge different preset rays based on these differences. Therefore, the computer can input a large number of preset rays into the preset ray beam recognition model, enabling the model to identify the differences between different preset rays based on their respective illumination information. Correspondingly, the preset ray beam recognition model can determine the ray beam type corresponding to each preset ray based on these differences, for subsequent training of the ray beam recognition model. During the training process, the computer can adjust the model parameters of the preset ray beam recognition model to minimize its loss function, resulting in a well-trained ray beam recognition model. The preset beam recognition model can include deep learning models, such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), etc., and there are no restrictions on them.
[0033] In one exemplary embodiment, before training the preset ray beam recognition model based on the illumination information of the preset ray, the preset ray beam recognition model can also preprocess the preset ray, such as performing noise reduction processing, standardization processing, etc., so as to train the preset ray beam recognition model using the preprocessed preset ray. Of course, it is not limited to this, and no limitation is made here.
[0034] A trained ray beam recognition model can be used by computer devices to obtain the ray beam to be tracked corresponding to the target scene.
[0035] For example, a computer device can sample the light rays to be tracked illuminating a target scene. For instance, the computer device can sample the light rays by combining the light source information of the target scene's corresponding light source. Accordingly, the computer device can input the sampled light rays into a trained ray beam recognition model, enabling the trained ray beam recognition model to identify the differences between different light rays. For instance, the trained ray beam recognition model can determine the differences between corresponding light rays based on their respective illumination information. The differences between different light rays can include at least one of the following: differences in light source position, light source color, light source intensity, light source type, etc., without limitation. The differences between different light rays can be used by the trained ray beam recognition model to determine the ray beam type corresponding to each different light ray.
[0036] Taking different tracked rays, including ray 1, ray 2, and ray 3, as an example, the trained ray beam recognition model can have a preset difference threshold. If the difference between ray 1 and ray 2 is less than or equal to the preset difference threshold, the trained ray beam recognition model can determine that the ray beam type of ray 1 and ray 2 are the same, such as both being ray beam type 1. If the difference between ray 3 and both ray 1 and ray 2 is greater than the preset difference threshold, the trained ray beam recognition model can determine that the ray beam type of ray 3 is different from both ray 1 and ray 2, such as ray beam type 2. However, this is not a limitation and is not set here.
[0037] Once the trained ray recognition model determines the ray beam type corresponding to the ray to be tracked, the computer device can use a merging strategy that combines different rays to be tracked within the same ray beam type and separates different rays to be tracked within different ray beam types. This merges all rays to be tracked with the same ray beam type to determine the ray beam to which the ray to be tracked belongs. For example, if the ray beam type of ray 1 is the same as that of ray 2, the computer device can merge ray 1 and ray 2 to obtain the corresponding ray beam 1. If the ray beam type of ray 3 is the same as that of ray 4, the computer device can merge ray 3 and ray 4 to obtain the corresponding ray beam 2. Of course, this is not a limitation and is not set forth here.
[0038] Thus, once the ray to be tracked belongs to the ray bundle to which it belongs, the computer device can then perform ray tracing on all the rays contained in the ray bundle to be tracked, without having to perform ray tracing on each ray individually. This helps to reduce the computational complexity of ray tracing and improve the ray tracing speed.
[0039] For example, a computer device can acquire the ray beam to be tracked corresponding to the target scene by combining at least one of the scene complexity of the target scene and the scene view movement speed corresponding to the target scene.
[0040] In some implementations, the degree of subdivision of the ray beam corresponding to the target scene is determined based on the scene complexity of the target scene; a preset ray beam corresponding to the target scene is determined based on the degree of subdivision of the ray beam; the ray beam sampling rate corresponding to the target scene is determined based on at least one of the scene complexity of the target scene and the scene viewpoint movement speed corresponding to the target scene; and the ray beam to be tracked corresponding to the target scene is sampled from the preset ray beam according to the ray beam sampling rate.
[0041] Computer devices can acquire the scene complexity of a target scene. For example, a computer device can determine the scene complexity of a target scene based on at least one of the following: the number of objects to be rendered, the shape of the objects to be rendered, the material of the objects to be rendered, the light source information, the spatial structure of the target scene, and the number of objects to be rendered that are dynamic objects.
[0042] In one exemplary implementation, the greater the number of objects to be rendered in the target scene, the higher the scene complexity of the target scene.
[0043] The greater the difference in shape between the various objects to be rendered, and / or the more numerous the objects with high shape complexity, the higher the scene complexity of the target scene. For example, when the shapes of the objects to be rendered are irregular, the shape complexity of the objects to be rendered is high.
[0044] The more objects to be rendered that have complex surface materials, the higher the scene complexity of the target scene. For example, complex surface materials can include materials with reflective properties, materials with refractive properties, transparent materials, and so on, without limitation.
[0045] The more light sources there are in the target scene, and / or the more light sources with different light source information there are, the higher the scene complexity of the target scene.
[0046] The more layers and depth information included in the spatial structure of the target scene, the higher the scene complexity.
[0047] The more dynamic objects there are to be rendered, the higher the scene complexity of the target scene. Dynamic objects include, for example, dynamic characters, dynamic objects, etc., without limitation.
[0048] Based on this, computer equipment can determine the scene complexity of a target scene by considering whether at least one of the following conditions is met: the number of objects to be rendered, the shape of the objects to be rendered, the material of the objects to be rendered, the light source information, the spatial structure of the target scene, and the number of dynamic objects to be rendered. Preset conditions may include, for example, the number of objects to be rendered, the number of objects to be rendered with shape differences greater than or equal to a preset difference threshold, the number of objects to be rendered with irregular shapes, the number of objects to be rendered with complex surface materials, the number of light sources, the number of light sources with different light source information, the number of layers in the spatial structure of the target scene, the amount of depth information in the spatial result of the target scene, and the number of dynamic objects to be rendered. The preset quantity thresholds under different judgment conditions can be different or the same, and can be pre-set or user-defined; no restrictions are placed here. Of course, the methods for determining the scene complexity of a target scene are not limited to this, and no restrictions are placed here either.
[0049] Given a defined scene complexity, the computer device can determine the degree of subdivision of the ray beams corresponding to the scene. The degree of subdivision can indicate at least one of the number and density of light samples contained in a preset ray beam corresponding to the scene. A higher number and density of light samples in a preset ray beam allows it to capture more lighting details in the scene, which is then used for subsequent rendering of objects within the scene.
[0050] For example, the scene complexity of the target scene may include a first scene complexity and a second scene complexity, where the first scene complexity is higher than the second scene complexity. The computer device can determine the ray beam subdivision level corresponding to the target scene as a first subdivision level based on the first scene complexity. Correspondingly, the computer device can determine the ray beam subdivision level corresponding to the target scene as a second subdivision level based on the second scene complexity, where the first subdivision level is higher than the second subdivision level. Based on this, the computer device can perform ray beam tracking on target scenes with higher scene complexity using a higher ray beam subdivision level. Of course, the scene complexity of the target scene is not limited to the first and second scene complexity, nor is the ray beam subdivision level corresponding to the target scene limited to the first and second subdivision levels; these are not considered restrictions here.
[0051] Given a defined level of light beam subdivision, the computer device can set the preset light beams corresponding to the target scene based on this level of subdivision. For example, given a defined light source information for the target scene, the light source information can be set based on the level of light beam subdivision so that the level of subdivision of the preset light beams provided by the light source to the target scene can be adapted to the level of subdivision required by the target scene.
[0052] Accordingly, given a predetermined light beam corresponding to the target scene, the computer device can dynamically determine the light sampling rate corresponding to the target scene based on at least one of the scene complexity of the target scene and the scene view movement speed corresponding to the target scene, so that the computer device can sample the light beam to be tracked corresponding to the target scene according to the light sampling rate.
[0053] For example, when the target scene has low complexity, the computer device does not need to sample too many ray tracing beams for ray tracing to subsequently render the objects in the target scene. Therefore, the computer device can reduce the ray sampling rate corresponding to the target scene to sample fewer ray tracing beams from the preset ray tracing beams. Conversely, when the target scene has high complexity, the computer device needs to sample more ray tracing beams for ray tracing to subsequently render the objects in the target scene. Therefore, the computer device can increase the ray sampling rate corresponding to the target scene to sample more ray tracing beams from the preset ray tracing beams. For instance, if the target scene complexity is level one, the ray sampling rate corresponding to the target scene is determined to be the first sampling rate. If the target scene complexity is level two, the ray sampling rate corresponding to the target scene is determined to be the second sampling rate. Here, level one scene complexity is higher than level two scene complexity, and the first sampling rate is higher than the second sampling rate.
[0054] For example, a camera can be set up in the target scene. The camera can be used to provide a viewing angle of the target scene, that is, to determine the scene view of the target scene. The camera can include different types of cameras, such as fixed cameras and free cameras. Among them, the scene view of the target scene corresponding to a fixed camera is fixed, while the scene view of the target scene corresponding to a free camera can change. Accordingly, different types of cameras can have corresponding scene view movement speeds. For example, the scene view movement speed of a fixed camera is 0. The scene view movement speed of a free camera can be determined according to the movement speed of different cameras. When the scene view movement speed corresponding to the target scene is slow, the computer device does not need to sample too many ray tracing beams to perform ray tracing for subsequent rendering of the objects to be rendered in the target scene. Therefore, the computer device can reduce the ray sampling rate corresponding to the target scene to sample fewer ray tracing beams from the preset ray tracing beams. Accordingly, when the scene viewpoint movement speed corresponding to the target scene is relatively fast, the computer device needs to sample more ray filaments to be tracked for ray tracing in order to subsequently render the objects to be rendered in the target scene. Therefore, the computer device can increase the ray sampling rate corresponding to the target scene to sample more ray filaments from the preset ray filaments. For example, if the scene viewpoint movement speed corresponding to the target scene is within a first speed range, the ray sampling rate corresponding to the target scene is determined to be the third sampling rate. If the scene viewpoint movement speed corresponding to the target scene is within a second speed range, the ray sampling rate corresponding to the target scene is determined to be the fourth sampling rate. Here, the minimum speed in the first speed range is greater than the maximum speed in the second speed range, and the third sampling rate is higher than the fourth sampling rate.
[0055] Of course, this is not limited to this. Computer devices can also determine the ray sampling rate for a target scene by comprehensively considering both the scene complexity and the corresponding viewpoint movement speed. For example, a computer device can determine the ray sampling rate corresponding to the scene complexity and the ray sampling rate corresponding to the viewpoint movement speed. The computer device can determine the ray sampling rate for the target scene based on one of the following: the average, minimum, maximum, or weighted average of the ray sampling rates corresponding to scene complexity and viewpoint movement speed. The weighting information for these two ray sampling rates in determining the ray sampling rate for the target scene can be pre-set or user-defined, without restriction. Once the ray sampling rate for the target scene is determined, the computer device can sample the target scene's corresponding ray beam from a preset ray beam according to the ray beam sampling rate. Of course, it is not limited to this. When the target scene corresponding to the ray beam to be tracked is obtained, the ray sampling rate of the ray beam to be tracked can change in response to at least one of the changes in the target scene and the changes in the scene view movement speed, so as to realize the dynamic adjustment of the ray sampling rate and improve the convenience and flexibility of adjusting the ray sampling rate. No restrictions are imposed here.
[0056] In this way, once the computer device determines the ray beam to be tracked corresponding to the target scene, it can perform ray tracing on the ray beam to be tracked, so as to render the objects to be rendered in the target scene later.
[0057] Step S102: Perform an intersection test between the ray beam to be tracked and the target area in the target scene to obtain the first test result; the size of the target area is smaller than the size of the target scene.
[0058] A computer device can divide a target scene into regions to obtain at least one target region. The size of the target region is smaller than the size of the target scene. In some implementations, the computer device can use a spatial partitioning data structure to manage the objects to be rendered in the target scene. The spatial partitioning data structure may include an octree, a kd-dimensional tree, etc., and is not limited here. For example, the computer device can use the spatial partitioning data result to divide the target scene into at least one target region, and store the object attributes of the objects to be rendered in the corresponding target region in each target region for subsequent rendering of the objects to be rendered. In an exemplary implementation, during the process of dividing the target scene and obtaining the target regions, the computer device can determine whether the currently divided preset regions contain objects to be rendered, so as to remove the preset regions that do not contain objects to be rendered, and determine the preset regions that contain objects to be rendered as the target regions. Of course, it is not limited to this, and is not limited here.
[0059] The computer equipment can perform an intersection test between the ray beam to be tracked and the target area to obtain a first test result. When there are multiple target areas, the number of first test results can also be multiple. For example... Figure 2 As shown, the target area in the target scene may include region 1 and region 2, where the size of both region 1 and region 2 is smaller than the size of the target scene. Region 1 may include, for example, objects to be rendered 1 to 2, and region 2 may include, for example, objects to be rendered n; this is not limited here. For example, the computer device can perform an intersection test between the ray to be traced and region 1 to obtain test result 1 corresponding to region 1. Furthermore, the computer device can perform an intersection test between the ray to be traced and region 2 to obtain test result 2 corresponding to region 2. Based on this, the first test result may include test result 1 and test result 2. However, this is not a limitation and is not imposed here.
[0060] In some implementations, when performing an intersection test between the ray beam to be tracked and a target region in the target scene, the computer device can determine a first bounding box corresponding to the target region. This allows for the intersection test between the ray beam to be tracked and the target region to be performed by conducting an intersection test between the ray beam to be tracked and the first bounding box, thus obtaining a first test result. However, this is not a limitation and is not intended to restrict the scope of the implementation.
[0061] In some implementations, when performing an intersection test between the ray beam to be traced and a target region in the target scene, the subdivision level of the ray beam to be traced is updated based on the region complexity of the target region to obtain the ray beam to be traced corresponding to the target region; then, an intersection test is performed between the ray beam to be traced corresponding to the target region and the target region. The method for determining the region complexity of the target region can refer to the method for determining the scene complexity of the target scene, such as determining the region complexity based on at least one of the following: the number of objects to be rendered in the target region, the shape of the objects to be rendered, the material of the objects to be rendered, the light source information of the light source, the spatial result of the target region, and the number of objects to be rendered that are dynamic objects. This will not be elaborated further here. When the target scene includes multiple target regions, the region complexity of each target region can be the same or different. Correspondingly, the subdivision level of the ray beam to be traced corresponding to each target region can be different or the same, without limitation. Based on this, during the intersection test between the ray beam to be tracked and the target area, the computer equipment can make the subdivision of the ray beam to be tracked adapt to the regional complexity of the target area. This is beneficial to improving the convenience and flexibility of adjusting the subdivision of the ray beam to be tracked, and also helps to reduce the computational complexity when performing the intersection test between the ray beam to be tracked and the target area, thereby reducing the computational complexity when tracking the ray beam.
[0062] For example, the first test result can be used to indicate either that the ray to be traced intersects with the target region or that the ray to be traced does not intersect with the target region. If the first test result indicates that the ray to be traced does not intersect with the target region, the computer device can determine that the ray to be traced does not intersect with any of the objects to be rendered in the target region. In this case, the computer device can prune the ray to be traced so that it will not continue to perform intersection tests on the objects to be rendered in the non-intersecting target region, thereby reducing the number of times the ray to be traced traverses the target scene and reducing unnecessary intersection tests.
[0063] In this way, the computer device can determine whether it is necessary to continue performing intersection tests between the ray tracing beam and the target region in the target scene based on the first test result. If the first test result indicates that the ray tracing beam and the target region do not intersect, the computer device does not need to continue performing intersection tests between the ray tracing beam and the non-intersecting target region, thereby reducing the computational complexity of ray tracing and allowing for subsequent improvements in the ray tracing speed, which in turn improves the rendering speed of the object being rendered.
[0064] Step S103: When the first test result indicates that the ray beam to be tracked intersects with the target area, an intersection test is performed between the ray beam to be tracked and the target sub-region in the target area to obtain the second test result; the size of the target sub-region is smaller than the size of the target area, and the target sub-region includes the object to be rendered.
[0065] If the first test result indicates that the ray beam to be tracked intersects with the target region, the computer device can divide the target region into sub-regions to obtain at least one target sub-region. The size of the target sub-region is smaller than the size of the target region. The computer device can use spatial segmentation data results to divide the target region. In some embodiments, during the process of dividing the target region and obtaining target sub-regions, the computer device can determine whether the currently divided preset sub-regions contain objects to be rendered, so as to discard preset sub-regions that do not contain objects to be rendered, and determine the preset sub-regions that contain objects to be rendered as target sub-regions. Based on this, the target sub-region includes objects to be rendered.
[0066] In one exemplary embodiment, the computer device can divide the target region into multiple levels to obtain target sub-regions of different levels. For example, the computer device can divide the target region into sub-regions to obtain at least one first-level target sub-region. Accordingly, the computer device can perform an intersection test between the ray beam to be traced and the first-level target sub-region. For the first-level target sub-region that intersects with the ray beam to be traced, the computer device can divide the first-level target sub-region to obtain at least one second-level target sub-region. Accordingly, the computer device can perform an intersection test between the ray beam to be traced and the second-level target sub-region. For the second-level target sub-region that intersects with the ray beam to be traced, the computer device can divide the second-level target sub-region, and so on. The computer device can determine whether it is necessary to divide the target region into multiple levels based on whether at least one of the shape, position, occlusion information, and depth information of different objects to be rendered in the target region satisfies a preset division condition. Preset partitioning conditions include, for example, determining that different objects cannot intersect with the same ray tracing beam based on at least one of their shape, position, occlusion information, and depth information. If the preset partitioning conditions are met, the computer device can then determine that the target area needs to be further subdivided into sub-regions. These preset partitioning conditions can be pre-set or user-defined, and are not limited here. Based on this, by partitioning the target area, the intersection between the objects to be rendered and the ray tracing beams within the sub-regions can be pre-judged. This helps reduce the computational complexity of subsequent intersection tests between the ray tracing beams and the objects to be rendered, thereby reducing the computational complexity of ray tracing and improving the ray tracing speed.
[0067] The computer equipment can perform intersection tests between the ray beam to be tracked and the target sub-region to obtain a second test result. When there are multiple target sub-regions, the number of second test results can also be multiple accordingly. For example... Figure 3 As shown, the target sub-region within the target region can include sub-region 1 and sub-region 2, where the size of both sub-region 1 and sub-region 2 is smaller than the size of the target region. Sub-region 1 may include, for example, the object to be rendered, A, and sub-region 2 may include, for example, the object to be rendered, B; this is not a limitation. For instance, the computer device can perform an intersection test between the ray to be traced and sub-region 1 to obtain test result 3 corresponding to sub-region 1. Furthermore, the computer device can perform an intersection test between the ray to be traced and sub-region 2 to obtain test result 4 corresponding to sub-region 2. Based on this, the second test result can include test result 3 and test result 4. However, this is not a limitation and is not a limitation in this regard.
[0068] In some implementations, when performing an intersection test between the ray beam to be tracked and a target sub-region within the target region, the computer device can determine a second bounding box corresponding to the target sub-region. This allows for the intersection test between the ray beam to be tracked and the target sub-region to be performed, thus obtaining a second test result. The size of the second bounding box is smaller than the size of the first bounding box. However, this is not a limitation and is not set forth herein.
[0069] In some implementations, when performing an intersection test between the ray beam to be traced and a target sub-region within the target area, the subdivision level of the ray beam to be traced is updated based on the sub-region complexity of the target sub-region, resulting in the ray beam to be traced corresponding to the target sub-region; then, an intersection test is performed between the ray beam to be traced corresponding to the target sub-region and the target sub-region. The sub-region complexity of the target sub-region can be determined by referring to the method for determining the scene complexity of the target scene and the region complexity of the target area. For example, the region complexity of the target area can be determined based on at least one of the following: the number of objects to be rendered in the target sub-region, the shape of the objects to be rendered, the material of the objects to be rendered, the light source information of the light source, the spatial result of the target area, and the number of dynamic objects to be rendered. This will not be elaborated further here. When the target area includes multiple target sub-regions, the sub-region complexity of each of the different target sub-regions can be the same or different. Correspondingly, the subdivision level of the ray beam to be traced corresponding to each of the different target sub-regions can be different or the same, without limitation. Based on this, during the intersection test between the ray beam to be tracked and the target sub-region, the computer equipment can make the subdivision of the ray beam to be tracked match the complexity of the target sub-region. This is beneficial to improving the ease and flexibility of adjusting the subdivision of the ray beam to be tracked, and also helps to reduce the computational complexity when performing the intersection test between the ray beam to be tracked and the target sub-region. This, in turn, helps to reduce the computational complexity when tracking the ray beam to be tracked and improve the tracking speed of the ray beam to be tracked.
[0070] For example, the second test result can be used to indicate either that the ray to be tracked intersects with the target sub-region, or that the ray to be tracked does not intersect with the target sub-region. If the second test result indicates that the ray to be tracked does not intersect with the target sub-region, the computer device can determine that the ray to be tracked does not intersect with any of the objects to be rendered in the target sub-region. The computer device can then prune the ray to be tracked so that it does not continue to perform intersection tests on the objects to be rendered in the non-intersecting target sub-regions, thereby reducing the number of times the ray to be tracked traverses the target scene and reducing unnecessary intersection tests.
[0071] In this way, the computer device can determine whether it is necessary to continue performing intersection tests between the ray tracing beam and the target sub-region within the target region, based on the second test result. If the second test result indicates that the ray tracing beam and the target sub-region do not intersect, the computer device does not need to continue performing intersection tests between the ray tracing beam and the non-intersecting target sub-region, thereby reducing the computational complexity of ray tracing and allowing for subsequent improvements in the ray tracing rate, ultimately increasing the rendering rate of the object to be rendered.
[0072] Step S104: When the second test result indicates that the ray beam to be traced intersects with the target sub-region, perform an intersection test between the ray beam to be traced and the object to be rendered in the target sub-region to obtain the third test result.
[0073] If the second test result indicates that the ray beam to be traced intersects with the target sub-region, the computer device can perform an intersection test between the ray beam to be traced and the objects to be rendered in the target sub-region to obtain a third test result. Where there are multiple objects to be rendered in the target sub-region, the number of third test results can also be multiple.
[0074] For example, the third test result can be used to indicate whether the ray tracing beam intersects with the object to be rendered or not. If the third test result indicates that the ray tracing beam does not intersect with the object, the computer device can determine that the ray tracing beam will not affect the rendering effects such as lighting and shadows on the non-intersecting object, and therefore there is no need to combine the lighting information of the ray tracing beam with the rendering of the object. Conversely, if the third test result indicates that the ray tracing beam intersects with the object, the computer device can determine that the ray tracing beam can affect the rendering effects such as lighting and shadows on the intersecting object, and therefore the lighting information of the ray tracing beam can be used to subsequently render the object.
[0075] Thus, when the second test result indicates that the ray beam to be tracked intersects with the target sub-region, the computer device performs an intersection test between the ray beam to be tracked and the object to be rendered in the target sub-region. The resulting third test result allows the computer device to determine whether it needs to combine the lighting information of the ray beam to be tracked before rendering the object, which improves the ease of rendering the object. Correspondingly, the computer device does not need to consume additional computing resources to combine the lighting information of the ray beam to be tracked to render non-intersecting objects, which improves the rendering speed of the object.
[0076] Step S105: When the third test result indicates that the ray beam to be traced intersects with the object to be rendered, the object to be rendered is rendered according to the lighting information of the ray beam to be traced and the object attributes of the object to be rendered.
[0077] For example, when rendering an object, a computer device can determine the lighting effects, pixel colors, etc., corresponding to the object based on the lighting information of the ray beam intersecting with the object and the object's attributes. For instance, object attributes can include the object's material, optical properties, etc., without limitation. When determining the lighting effects corresponding to the object, the computer device can determine the lighting effects that the ray beam can present on the object based on the lighting information such as the ray beam's intensity, color, and type, combined with the object's material, optical properties, etc. Lighting effects include, for example, at least one of ambient light, diffuse reflection, specular reflection, and refraction. Correspondingly, the computer device can combine the lighting effects of the ray beam on the object to simulate the brightness, color, and other information of the interaction between the ray beam and the object in the real world to determine the pixel colors corresponding to the object. Once the pixel colors of the object are determined, the computer device can render the object based on those pixel colors.
[0078] In this way, the computer device can render the object to be rendered based on the object attributes of the object to be rendered that intersects with the ray beam to be traced and the lighting information of the ray beam to be traced, which helps to improve the convenience of rendering the object to be rendered.
[0079] For example, the rendering information corresponding to the object to be rendered is obtained when rendering the object based on the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered; the correspondence between the lighting information of the ray beam to be tracked and the rendering information corresponding to the object to be rendered is determined.
[0080] For example, when a computer device renders an object based on the lighting information of the ray tracing beam and the object attributes, it can cache the corresponding rendering information during the rendering process. For instance, the computer device can obtain the rendering information corresponding to the object and establish a correspondence between the lighting information of the ray tracing beam and the rendering information of the object.
[0081] In some implementations, when there are other ray beams besides the one to be tracked that intersect with the object to be rendered, the similarity between the other ray beams and the one to be tracked is determined based on the lighting information of the other ray beams and the lighting information of the one to be tracked; when the similarity is greater than or equal to a preset similarity threshold, the object to be rendered is rendered based on the rendering information corresponding to the lighting information of the one to be tracked.
[0082] For example, during the rendering of an object, since the light sources set in the target scene can continuously provide ray beams to be tracked, and the target scene can change (e.g., a change in the scene's viewpoint can easily cause a change in the target scene), the computer device needs to continuously acquire the ray beams to be tracked corresponding to the target scene. For example, in addition to the currently tracked ray beam, the computer device can also acquire other ray beams besides the one currently being tracked.
[0083] When a computer device acquires ray beams other than the one to be tracked, if both the other ray beams and the one to be tracked intersect with the same object to be rendered, the computer device can determine whether the similarity between the other ray beams and the one to be tracked is greater than or equal to a preset similarity threshold. If the similarity is greater than or equal to the threshold, the computer device can acquire the rendering information corresponding to the lighting information of the one to be tracked and render the object. For example, the computer device can determine the similarity between the other ray beams and the one to be tracked by comparing their similarity. If the similarity between the other ray beams and the one to be tracked is greater than or equal to the preset similarity threshold, the computer device can determine that the effects of the other ray beams and the one to be tracked on the same object to be rendered, such as lighting effects, pixel colors, etc., can be similar. Therefore, the computer device can acquire the rendering information corresponding to the lighting information of the one to be tracked based on the correspondence between the lighting information of the one to be tracked and the rendering information corresponding to the object to be rendered, and render the object, thereby reusing the currently cached rendering information.
[0084] Thus, when other ray beams besides the one being tracked intersect with the object to be rendered, the computer device can determine the similarity between these other ray beams and the one being tracked. If the similarity between these other ray beams and the one being tracked is greater than or equal to a preset similarity threshold, the computer can render the object based on the rendering information corresponding to the lighting information of the one being tracked. Based on this, the computer device can save the computational resources required to determine the rendering information of other ray beams for the object being rendered, and directly reuse the currently cached rendering information corresponding to the one being tracked whose similarity to other ray beams is greater than or equal to the preset similarity threshold, which helps to improve the rendering speed of the object being rendered.
[0085] In some implementations, when the object to be rendered is a static object and the time interval between the current time and the time of determining the corresponding relationship is greater than or equal to a first time interval threshold, the corresponding relationship is deleted; when the object to be rendered is a dynamic object and the time interval between the current time and the time of determining the corresponding relationship is greater than or equal to a second time interval threshold, the corresponding relationship is deleted; the second time interval is less than the first time interval; the corresponding relationship is deleted in response to a change in the target scene where the object to be rendered is located.
[0086] When a computer device caches the mapping between lighting information of a ray to be traced and rendering information of the object to be rendered, changes in either the target scene or the object to be rendered can easily render the cached mapping inapplicable to the object. Therefore, the computer device needs to update the cached mapping promptly. For example, if the scene viewpoint corresponding to the target scene changes, the target scene will change. Or, if the object to be rendered is a dynamic object, the object will change.
[0087] For example, when a computer device changes the currently cached mapping, it can adopt a timed deletion strategy. Since static objects do not change, the computer device can cache the rendering information corresponding to static objects for a long time, such as caching the mappings corresponding to static objects for an extended period. Since dynamic objects change, the computer device can cache the rendering information corresponding to dynamic objects for a short time, such as caching the mappings corresponding to dynamic objects for a short period. For instance, when the object to be rendered is a static object, and the time interval between the current time and the determined time of the mapping is greater than or equal to a first time interval threshold, the mapping is deleted. The first time interval can be preset or user-defined, without restriction. As another example, when the object to be rendered is a dynamic object, and the time interval between the current time and the determined time of the mapping is greater than or equal to a second time interval threshold, the mapping is deleted. The second time interval threshold is greater than a preset time interval threshold. The second time interval threshold can be preset or user-defined, without restriction.
[0088] For example, when a computer device modifies the current cached mappings, it can adopt a scene-change-based deletion strategy. If the target scene changes, the effect of the tracing ray on the changed target scene will also change. Accordingly, the computer device needs to modify the rendering information of the object to be rendered. Based on this, the computer device can delete the currently cached rendering information corresponding to the object to be rendered when the target scene changes, in order to redetermine the rendering information corresponding to the object to be rendered. However, this is not limited to this. When the object to be rendered is a static object, since static objects do not change, if the change in the target scene is a change in the scene perspective, the computer device may not delete the currently cached mappings of the static object, and can further acquire and cache the rendering information corresponding to the static object under different scene perspectives, in response to changes in the scene perspective of the target scene, to acquire the corresponding rendering information and render the static object.
[0089] In this way, when the computer device determines the correspondence between the lighting information of the ray beam to be tracked and the rendering information of the object to be rendered, the computer device can adopt a variety of strategies to update the correspondence, which helps to improve the convenience and flexibility of updating the correspondence.
[0090] For example, when performing an intersection test on the ray beam to be tracked, the graphics processor performs the intersection test on all the rays to be tracked in the ray beam to be tracked in parallel.
[0091] In some implementations, to improve the speed of intersection testing and reduce the time required for it, the computer device can utilize the parallel computing power of the Graphics Processing Unit (GPU) to perform intersection testing on all tracing rays in the tracing ray beam in parallel. For example, when performing intersection testing between the tracing ray beam and a target region in the target scene, the GPU performs parallel intersection testing between all tracing rays in the tracing ray beam and the target region. Similarly, when performing intersection testing between the tracing ray beam and a target sub-region within the target region, the GPU performs parallel intersection testing between all tracing rays in the tracing ray beam and the target sub-region. Finally, when performing intersection testing between the tracing ray beam and an object to be rendered within the target sub-region, the GPU performs parallel intersection testing between all tracing rays in the tracing ray beam and the object to be rendered.
[0092] During the parallel intersection testing of all ray tracing rays in the ray beam using the GPU, the GPU can traverse all objects to be rendered in the target scene for each ray in parallel, checking whether the ray intersects with any of the objects. For example, the GPU can determine whether a ray intersects with an object by testing the intersection of a ray with a triangle, a ray with a sphere, and so on. Accordingly, if it is determined that a ray intersects with an object, the GPU can also calculate the intersection point between the ray and the object for subsequent rendering of the object.
[0093] Therefore, by performing intersection tests on all the rays in the ray beam to be tracked in parallel by the GPU, the time required for intersection tests can be reduced, which is beneficial to improving the tracking speed of the ray beam to be tracked, and thus beneficial to improving the rendering speed of the object to be rendered.
[0094] In some implementations, post-processing effects are added to the object to be rendered based on the rendering information corresponding to the object to be rendered.
[0095] For example, the rendering information corresponding to the object to be rendered may include the lighting effect of the ray tracing beam on the object to be rendered, the pixel color of the object to be rendered, etc. Post-processing effects may include screen space reflections, glare, and other effects used to enhance the visual effect of the object to be rendered.
[0096] For example, different post-processing effects can be added to the object to be rendered for different rendering information.
[0097] When the lighting effects, including reflection effects, of the object to be rendered are determined based on the rendering information corresponding to the object, the post-processing effects added by the computer device to the object to be rendered may include screen-space reflections. Screen-space reflections can simulate reflection effects during the rendering process of the object. For example, screen-space reflections can simulate the reflection phenomenon of the object in the real world by calculating the process of the light beam to be rendered originating from the camera corresponding to the target scene, being reflected by the surface of the object to be rendered, and then entering the camera, thereby generating reflection effects in real time during the rendering process.
[0098] When the lighting effects of the object to be rendered are determined to include at least one of scattering and diffuse reflection effects based on the rendering information corresponding to the object, the post-processing effects added by the computer device to the object to be rendered may include bloom. Bloom can be used to simulate the effects of light emitted by light sources in the real world scattering and diffuse reflection in the air, so as to add corresponding effects to the object to be rendered during the rendering process. For example, when the post-processing effect added to the object to be rendered is bloom, the highlighted areas in the object to be rendered can produce a soft halo effect to enhance the sense of depth and three-dimensionality of the object to be rendered.
[0099] Of course, post-processing effects are not limited to this, and will not be restricted here.
[0100] In this way, by adding post-processing effects to the object to be rendered based on the rendering information corresponding to the object, the computer device can improve the rendering effect of the object to be rendered and enhance the user's visual experience of the object to be rendered.
[0101] In some implementations, the amount of computing resources used by the post-processing effect is obtained; when the amount of computing resources is greater than or equal to a preset resource threshold, the effect parameters corresponding to the post-processing effect are adjusted according to a preset resource reduction strategy to update the post-processing effect.
[0102] For example, when adding post-processing effects to an object to be rendered, in order to ensure the rendering effect and rendering speed of the object, the computer device can control the amount of computing resources occupied by the post-processing effects so that the amount of computing resources occupied by the post-processing effects can be kept below a preset resource threshold for a long time.
[0103] In controlling the amount of computing resources used by the post-processing effect, the computer device can obtain the amount of computing resources used by the post-processing effect. When the amount of computing resources is greater than or equal to a preset resource threshold, the computer device can adopt a preset resource reduction strategy to adjust the effect parameters corresponding to the post-processing effect, so that while updating the post-processing effect, the amount of computing resources used by the updated post-processing effect can be less than the preset resource threshold.
[0104] Resource reduction strategies include, for example, using textures with a resolution less than or equal to a preset resolution threshold when adding post-processing effects to the rendered object, reducing the number of updates to post-processing effects, and optimizing the algorithm for adding post-processing effects, etc., and are not limited here. Correspondingly, the computer device can also dynamically adjust the effect parameters corresponding to the post-processing effects based on the scene complexity of the target scene and the hardware performance of the computer device. These are also not limited here.
[0105] Thus, when adding post-processing effects to the object to be rendered, by obtaining the amount of computing resources occupied by the post-processing effect and combining it with a preset resource threshold, the effect parameters corresponding to the post-processing effect can be adjusted to update the post-processing effect. This helps to improve the ease of control and control of the amount of computing resources occupied by the post-processing effect while ensuring the rendering effect and rendering speed of the object to be rendered.
[0106] The ray tracing method provided in the above embodiments obtains the ray beam to be tracked corresponding to the target scene; performs an intersection test between the ray beam to be tracked and the target region in the target scene to obtain a first test result; the size of the target region is smaller than the size of the target scene; when the first test result indicates that the ray beam to be tracked intersects with the target region, an intersection test is performed between the ray beam to be tracked and the target sub-region in the target region to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes the object to be rendered; when the second test result indicates that the ray beam to be tracked intersects with the target sub-region, an intersection test is performed between the ray beam to be tracked and the object to be rendered in the target sub-region to obtain a third test result; when the third test result indicates that the ray beam to be tracked intersects with the object to be rendered, the object to be rendered is rendered according to the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered.
[0107] For example, during the tracing of a ray, the computer device can divide the target scene into multiple target regions. The computer device can then perform intersection tests between the ray to be traced and each of these target regions to select the target region that intersects with the ray. The computer device can further divide the target region into sub-regions. The computer device can then perform intersection tests between the ray to be traced and each of these sub-regions to select the target sub-region that intersects with the ray. Since the target sub-region includes the object to be rendered, the computer device can perform an intersection test between the ray and the object to be rendered within the target sub-region that intersects with the ray. Once it is determined that the ray intersects with the object, the computer device can combine the lighting information of the ray with the object to be rendered for rendering. Based on this, the computer device does not need to divide the target area into target sub-regions that do not intersect with the ray beam to be tracked, nor does it need to perform intersection tests on the objects to be rendered in the target sub-regions that do not intersect with the ray beam to be tracked. This reduces the computational complexity of ray beam tracing and increases the tracing rate of the ray beam to be tracked, thereby improving the rendering rate of the image.
[0108] This application embodiment can also provide a ray beam tracking device. This ray beam tracking device can be configured in a server or computer device to execute the aforementioned ray beam tracking control method.
[0109] The ray beam tracing device includes: a ray beam acquisition module, a first intersection test module, a second intersection test module, a third intersection test module, and a rendering module.
[0110] The ray beam acquisition module is used to acquire the ray beam to be tracked corresponding to the target scene.
[0111] The first intersection test module is used to perform an intersection test between the ray beam to be tracked and the target region in the target scene to obtain a first test result; the size of the target region is smaller than the size of the target scene.
[0112] The second intersection test module is used to perform an intersection test between the ray beam to be tracked and a target sub-region in the target region when the first test result indicates that the ray beam to be tracked intersects with the target region, and to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes an object to be rendered.
[0113] The third intersection test module is used to perform an intersection test between the ray beam to be tracked and the object to be rendered in the target sub-region when the second test result indicates that the ray beam to be tracked intersects with the target sub-region, and obtain the third test result.
[0114] The rendering module is used to render the object to be rendered based on the lighting information of the ray beam to be traced and the object attributes of the object to be rendered when the third test result indicates that the ray beam to be traced intersects with the object to be rendered.
[0115] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and its modules and units can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0116] The method of this application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0117] For example, the above-described methods and apparatus can be implemented as a computer program that can run on a computer device.
[0118] Please see Figure 4 , Figure 4 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device can be a server or an electronic device.
[0119] like Figure 4 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include storage media and internal memory.
[0120] The storage medium may store the operating system and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any ray tracing method.
[0121] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0122] Internal memory provides an environment for the execution of computer programs stored in the storage medium. When these computer programs are executed by the processor, the processor can perform any ray tracing method.
[0123] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0124] It should be understood that a processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other convertible logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0125] In one embodiment, the processor is configured to execute a computer program and, when executing the computer program, perform the following steps:
[0126] Obtain the ray beam to be tracked corresponding to the target scene;
[0127] An intersection test is performed between the ray beam to be tracked and the target region in the target scene to obtain a first test result; the size of the target region is smaller than the size of the target scene.
[0128] When the first test result indicates that the ray beam to be tracked intersects with the target region, an intersection test is performed on the ray beam to be tracked and the target sub-region in the target region to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes the object to be rendered;
[0129] When the second test result indicates that the ray beam to be tracked intersects with the target sub-region, an intersection test is performed on the ray beam to be tracked and the object to be rendered in the target sub-region to obtain a third test result;
[0130] When the third test result indicates that the ray beam to be tracked intersects with the object to be rendered, the object to be rendered is rendered according to the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered.
[0131] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of controlling the interactive task described above can be referred to the corresponding process in the aforementioned ray beam tracing method embodiments, and will not be repeated here.
[0132] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method implemented can be referred to in various embodiments of the beam tracing method of this application.
[0133] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0134] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0135] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, herein, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0136] It should also be understood that any software tools or components not belonging to our company that appear in the embodiments of this application are merely illustrative examples and do not represent actual use.
[0137] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above descriptions are merely specific implementations of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A ray beam tracing method, characterized in that, include: Obtain the ray beam to be tracked corresponding to the target scene; An intersection test is performed between the light beam to be tracked and the target region in the target scene to obtain a first test result; The size of the target region is smaller than the size of the target scene; When the first test result indicates that the ray beam to be tracked intersects with the target region, an intersection test is performed on the ray beam to be tracked and the target sub-region in the target region to obtain a second test result; the size of the target sub-region is smaller than the size of the target region, and the target sub-region includes the object to be rendered; When the second test result indicates that the ray beam to be tracked intersects with the target sub-region, an intersection test is performed on the ray beam to be tracked and the object to be rendered in the target sub-region to obtain a third test result; When the third test result indicates that the ray beam to be tracked intersects with the object to be rendered, the object to be rendered is rendered according to the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered; The acquisition of the ray beam to be tracked corresponding to the target scene includes: The degree of light beam subdivision corresponding to the target scene is determined based on the scene complexity of the target scene; the scene complexity of the target scene is determined based on at least one of the following: the number of objects to be rendered in the target scene, the shape of the objects to be rendered, the material of the objects to be rendered, the light source information of the light source, the spatial structure of the target scene, and the number of objects to be rendered that are dynamic objects; Based on the degree of subdivision of the light beam, a preset light beam corresponding to the target scene is determined; The ray sampling rate corresponding to the target scene is determined based on the scene view movement speed corresponding to the target scene; According to the light beam sampling rate, sample the light beam to be tracked corresponding to the target scene from the preset light beam; The step of determining the ray sampling rate corresponding to the target scene based on the scene viewpoint movement speed corresponding to the target scene includes: If the scene view movement speed corresponding to the target scene is within the first speed range, the sampling rate of the light beam corresponding to the target scene is determined to be the third sampling rate; When the scene view movement speed corresponding to the target scene is within the second speed range, the light beam sampling rate corresponding to the target scene is determined to be the fourth sampling rate; wherein, the minimum speed in the first speed range is greater than the maximum speed in the second speed range, and the third sampling rate is higher than the fourth sampling rate.
2. The beam tracing method according to claim 1, characterized in that, The acquisition of the ray beam to be tracked corresponding to the target scene includes: The light rays to be tracked that illuminate the target scene are sampled; Based on the trained ray beam recognition model, the ray beam type corresponding to the ray beam to be tracked is determined according to the illumination information of the ray beam to be tracked; Based on all the light rays to be tracked that have the same light ray type, determine the light ray bundle to which the light ray to be tracked belongs.
3. The beam tracing method according to claim 1, characterized in that, The beam tracking method also includes: When rendering the object to be rendered, obtain the lighting information of the ray beam to be tracked and the object attributes of the object to be rendered; Determine the correspondence between the lighting information of the ray beam to be tracked and the rendering information of the object to be rendered; The rendering of the object to be rendered includes: When there are other ray beams besides the ray beam to be tracked that intersect with the object to be rendered, the similarity between the other ray beams and the ray beam to be tracked is determined based on the lighting information of the other ray beams and the lighting information of the ray beam to be tracked. When the similarity is greater than or equal to a preset similarity threshold, the object to be rendered is rendered according to the rendering information corresponding to the illumination information of the ray beam to be tracked.
4. The beam tracing method according to claim 3, characterized in that, After determining the correspondence between the lighting information of the ray beam to be tracked and the rendering information corresponding to the object to be rendered, at least one of the following is also included: When the object to be rendered is a static object, and the time interval between the current time and the time of determining the corresponding relationship is greater than or equal to the first time interval threshold, the corresponding relationship is deleted. When the object to be rendered is a dynamic object, and the time interval between the current time and the time of determining the correspondence is greater than or equal to the second time interval threshold, the correspondence is deleted; The second time interval threshold is less than the first time interval threshold; In response to a change in the target scene where the object to be rendered is located, the corresponding relationship is deleted.
5. The beam tracing method according to any one of claims 1 to 4, characterized in that, When performing an intersection test on the beam of light to be tracked, the graphics processor performs the intersection test on all the beams of light to be tracked in the beam of light to be tracked in parallel.
6. The beam tracing method according to any one of claims 1 to 4, characterized in that, After rendering the object to be rendered, the process further includes: Based on the rendering information corresponding to the object to be rendered, post-processing effects are added to the object to be rendered.
7. The beam tracing method according to claim 6, characterized in that, The post-processing effects added to the object to be rendered include: Obtain the amount of computing resources used to achieve the post-processing effect; When the amount of computing resources is greater than or equal to a preset resource threshold, the effect parameters corresponding to the post-processing effect are adjusted according to a preset resource reduction strategy to update the post-processing effect.
8. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement the beam tracing method as described in any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the beam tracing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Rendering method and device, equipment and storage medium
CN119091026A
Intersection testing in ray tracing systems using hierarchical acceleration structures with implicitly represented nodes
US20240404173A1
