Light beam tracking method and device and storage medium

By performing area division and ray beam interception testing on the target scene, the problem of high ray tracing calculation complexity is solved, and more efficient ray tracing and image rendering is achieved.

CN119888050APending Publication Date: 2025-04-25SHENZHEN RENDERBUS TECH

Patent Information

Application Number
CN202411822123.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing ray tracing technology has high computational complexity, resulting in poor ray tracing rate, which in turn affects the image rendering rate.

Method used

By dividing the target scene area, the ray beam to be tracked is intersected with the target area and the target sub-region, and only the intersecting areas and objects are rendered in detail, reducing unnecessary calculation complexity.

Benefits of technology

Improves the rate and efficiency of ray tracing, improves the rate of image rendering, and reduces the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888050A_ABST
    Figure CN119888050A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of ray tracing, and provides a ray tracing method and device and a storage medium, and the method comprises the steps: obtaining a to-be-tracked ray beam; performing an intersection test on the to-be-tracked light beam and a target area in the target scene to obtain a first test result; the size of the target area is smaller than that of the target scene; when the first test result indicates that the to-be-tracked light beam intersects with the target area, performing an intersection test on the to-be-tracked light beam and a target sub-area in the target area to obtain a second test result; the size of the target sub-region is smaller than that of the target region, and the target sub-region comprises a to-be-rendered object; when the second test result indicates that the to-be-tracked light beam intersects with the target sub-region, performing an intersection test on the to-be-tracked light beam and the to-be-rendered object to obtain a third test result; and when the third test result indicates that the to-be-tracked light beam intersects with the to-be-rendered object, rendering the to-be-rendered object according to the illumination information of the to-be-tracked light beam and the object attribute of the to-be-rendered object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of ray tracing technology, and in particular to a ray beam tracing method, device and storage medium. Background Art

[0002] At present, ray tracing can be used as a rendering technology and is widely used in different scenarios, such as image rendering, video rendering, game scene rendering, etc., to generate realistic images, thereby providing users with visual effects similar to the real environment. However, in the related art, when performing ray tracing, due to the high computational complexity required for ray tracing, it is easy to have a poor clarity of the ray tracing rate, thereby resulting in a poor rendering rate of the image. Summary of the invention

[0003] The main purpose of this application is to provide a ray tracing method, device and storage medium, aiming to reduce the computational complexity of ray tracing, improve the ray tracing rate, and thus improve the image rendering rate.

[0004] In a first aspect, the present application provides a ray beam tracing method, the ray beam tracing method comprising:

[0005] Obtain the light beam to be traced corresponding to the target scene;

[0006] Performing an intersection test on the light beam to be traced and a target area in the target scene to obtain a first test result; the size of the target area is smaller than the size of the target scene;

[0007] When the first test result indicates that the light beam to be traced intersects the target area, performing an intersection test on the light beam to be traced and a target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes an object to be rendered;

[0008] When the second test result indicates that the light beam to be traced intersects the target sub-region, performing an intersection test on the light beam to be traced 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 light beam to be traced intersects the object to be rendered, the object to be rendered is rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered.

[0010] In a second aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;

[0011] The memory is used to store computer programs;

[0012] The processor is used to execute the computer program and implement the steps of the ray beam tracing method as described above when executing the computer program.

[0013] In a third aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the ray beam tracing method as described above are implemented.

[0014] The present application provides a ray beam tracing method, a device and a storage medium. The ray beam tracing method includes: obtaining a ray beam to be traced corresponding to a target scene; performing an intersection test on the ray beam to be traced and a target area in the target scene to obtain a first test result; the size of the target area 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 area, performing an intersection test on the ray beam to be traced and a target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes an object to be rendered; when the second test result indicates that the ray beam to be traced intersects with the target sub-area, performing an intersection test on the ray beam to be traced and the object to be rendered in the target sub-area 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 according to illumination information of the ray beam to be traced and object properties of the object to be rendered.

[0015] For example, in the process of tracing the ray to be traced, the computer device may perform region division on the target scene to divide the target scene into multiple target regions. The computer device may screen out the target region intersecting with the ray bundle to be traced from the multiple target regions by performing intersection tests on the ray to be traced and the multiple target regions respectively. The computer device may perform sub-region division on the target region intersecting with the ray bundle to be traced to divide the target region into multiple target sub-regions. The computer device may screen out the target sub-region intersecting with the ray bundle to be traced from the multiple target sub-regions by performing intersection tests on the ray to be traced and the multiple target sub-regions respectively. Since the target sub-region includes the object to be rendered, the computer device may perform intersection tests on the ray bundle to be traced and the object to be rendered included in the target sub-region intersecting with the ray bundle to be traced. When determining that the ray bundle to be traced intersects with the object to be rendered, the computer device may combine the illumination information of the ray bundle to be traced and render the object to be rendered. Based on this, the computer device does not need to divide the target area that does not intersect with the light beam to be traced into target sub-areas, nor does it need to perform intersection tests on the objects to be rendered in the target sub-areas that do not intersect with the light beam to be traced. This can reduce the computational complexity of ray beam tracing for the light beam to be traced, and improve the tracing rate of the light beam to be traced, which is beneficial to improving the rendering rate of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 is a flowchart of a ray beam tracing method provided in an embodiment of the present application;

[0018] Figure 2 is a schematic block diagram of a target scenario involved in an embodiment of the present application;

[0019] Figure 3 is a schematic block diagram of a target area involved in an embodiment of the present application;

[0020] Figure 4 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0023] The embodiments of the present application provide a ray beam tracing method, device and storage medium. The ray beam tracing method can be applied to a computer device, which can be a mobile phone, a tablet computer, a laptop computer, a desktop computer and the like. It can also be applied to a server, which can be a separate server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0024] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0025] See also Figure 1 , Figure 1 It is a flow chart of a ray beam tracing method provided by an embodiment of the present application. It should be noted that the ray beam tracing method provided by an embodiment of the present application can be used in computer devices, and of course can also be used in servers. 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 beam tracing method to obtain a third test result corresponding to the ray beam to be traced. Exemplarily, 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 properties of the object to be rendered to the computer device, so that the computer device renders the object to be rendered; of course, it is not limited to this, and no limitation is made here.

[0026] In specific implementation, computer devices include but are not limited to: any one of mobile phones, tablet computers, laptop computers, and desktop computers; the server can be a single server or a server cluster, or a cloud server that provides cloud computing services.

[0027] like Figure 1 As shown, the ray beam tracing method includes steps S101 to S105.

[0028] Step S101: Obtain a light beam to be traced corresponding to a target scene.

[0029] In some embodiments, the target scene may be pre-set or may be set by the user, which is not limited here. A light source may be provided in the target scene. The light source may be used to provide light to be tracked to the target scene. For example, the computer device may 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, the type of the light source, etc. The type of light source includes, for example, point light source, parallel light, spotlight, etc., which are not limited here. Accordingly, the lighting information of the light to be tracked provided by the light source to the target scene may be determined based on the light source information. The computer device may sample the light to be tracked provided by the light source in combination with the light source information. Accordingly, the computer device may obtain the light beam to be tracked corresponding to the target scene from the light to be tracked provided by the light source.

[0030] The light beam to be traced can be used by a subsequent computer device to perform light beam tracing on the light beam to be traced.

[0031] In some embodiments, the light rays to be traced that illuminate the target scene are sampled; based on a trained light bundle recognition model, the type of light bundle corresponding to the light rays to be traced is determined according to the illumination information of the light rays to be traced; and based on all light rays to be traced having the same light bundle type, the light bundle to be traced to which the light rays to be traced belong is determined.

[0032] For example, the trained light beam recognition model can be obtained by training based on a large number of preset lights. The preset lights can be determined based on the lights provided by light sources under different light source information to different preset scenes, and the illumination information of different preset lights can be different. When training the light beam recognition model, the computer device needs to learn how to identify the differences between different preset lights under the same preset scene, and how to merge different preset lights based on the differences between different preset lights under the same preset scene. Based on this, the computer device can input a large number of preset lights into the preset light beam recognition model, so that the preset light beam recognition model can identify the differences between different preset lights based on the illumination information of each preset light. Accordingly, the preset light beam recognition model can determine the light beam type corresponding to each preset light based on the differences between different preset lights, so as to obtain the trained light beam recognition model later. During the training process of the preset light beam recognition model, the computer device can adjust the model parameters of the preset light beam recognition model to minimize the loss function of the preset light beam recognition model and obtain the trained light beam recognition model. Among them, the preset light beam recognition model may include a deep learning model, such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), etc., which is not limited here.

[0033] In an exemplary embodiment, before the preset light beam recognition model is trained according to the illumination information of the preset light beam, the preset light beam recognition model may also pre-process the preset light beam, such as performing denoising and standardization on the preset light beam, so as to train the preset light beam recognition model through the pre-processed preset light beam. Of course, this is not limited to this and is not limited here.

[0034] The trained light beam recognition model can be used by a computer device to obtain the light beam to be tracked corresponding to the target scene.

[0035] For example, the computer device may sample the light rays to be traced that are irradiated to the target scene. For example, the computer device may sample the light rays to be traced in combination with the light source information of the light source corresponding to the target scene. Accordingly, the computer device may input the sampled light rays to be traced into a trained light beam recognition model so that the trained light beam recognition model can recognize the differences between different light rays to be traced. For example, the trained light beam recognition model may determine the differences between the corresponding light rays to be traced based on the illumination information of the different light rays to be traced. The differences between the different light rays to be traced may include at least one of the differences in the positions of the light sources, the colors of the light sources, the intensities of the light sources, the types of the light sources, and the like, which are not limited here. The differences between the different light rays to be traced may be used by the trained light beam recognition model to determine the types of light beams corresponding to the different light rays to be traced.

[0036] Take the different light rays to be traced including light 1, light 2 and light 3 as an example. The trained light bundle recognition model can be preset with a preset difference threshold. When the difference between light 1 and light 2 is less than or equal to the preset difference threshold, the trained light bundle recognition model can determine that the light bundle type of light 1 and the light bundle type of light 2 are the same, such as both are light bundle type 1. When the difference between light 3 and light 1 and light 2 respectively is greater than the preset difference threshold, the trained light bundle recognition model can determine that the light bundle type of light 3 is different from the light bundle types of light 1 and light 2 respectively, such as the light bundle type of light 3 is light bundle type 2. Of course, it is not limited to this and is not limited here.

[0037] When the trained ray recognition model determines the ray bundle type corresponding to the ray to be traced, the computer device can merge all the rays to be traced of the same ray bundle type based on the merging strategy of different rays to be traced under different ray bundle types, so as to determine the ray bundle to be traced to which the ray to be traced belongs. For example, when the ray bundle type of ray 1 is the same as the ray bundle type of ray 2, the computer device can merge ray 1 and ray 2 to obtain the corresponding ray bundle 1. When the ray bundle type of ray 3 is the same as the ray bundle type of ray 4, the computer device can merge ray 3 and ray 4 to obtain the corresponding ray bundle 2. Of course, it is not limited to this and is not limited here.

[0038] In this way, when it is determined that the ray bundle to be traced belongs to, the computer device can subsequently uniformly trace all the rays to be traced contained in the ray bundle to be traced, without having to trace each ray to be traced individually, which is beneficial to reducing the computational complexity of ray tracing and improving the ray tracing rate.

[0039] Exemplarily, the computer device may acquire the to-be-traced light beam corresponding to the target scene in combination with at least one of the scene complexity of the target scene and the scene perspective movement speed corresponding to the target scene.

[0040] In some embodiments, the degree of subdivision of a light bundle corresponding to the target scene is determined according to the scene complexity of the target scene; a preset light bundle corresponding to the target scene is determined according to the degree of subdivision of the light bundle; a sampling rate of the light bundle corresponding to the target scene is determined according to at least one of the scene complexity of the target scene and the scene perspective movement speed corresponding to the target scene; and the light bundle to be tracked corresponding to the target scene is sampled from the preset light bundle according to the light bundle sampling rate.

[0041] The computer device may acquire the scene complexity of the target scene. For example, the computer device may determine the scene complexity of the target scene based on at least one of 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 dynamic objects to be rendered.

[0042] In an exemplary implementation, when the number of objects to be rendered in the target scene is greater, the scene complexity of the target scene is higher.

[0043] When the shapes of different objects to be rendered are greatly different and / or the number of objects to be rendered with higher shape complexity is greater, the scene complexity of the target scene is higher. For example, when the shapes of the objects to be rendered are irregular, the shape complexity of the objects to be rendered is higher.

[0044] The more objects to be rendered have complex surface materials, the higher the scene complexity of the target scene. For example, complex surface materials may include materials with reflection functions, materials with refraction functions, transparent materials, etc., which are not limited here.

[0045] When the number of light sources in the target scene is greater and / or the number of light sources with different light source information is greater, the scene complexity of the target scene is higher.

[0046] When the spatial structure of the target scene includes at least one of levels and depth information in greater numbers, the scene complexity of the target scene is higher.

[0047] When the number of objects to be rendered that are dynamic objects is greater, the scene complexity of the target scene is higher. Dynamic objects include, for example, dynamic characters, dynamic objects, etc., which are not limited here.

[0048] Based on this, the computer device can determine the scene complexity of the target scene based on whether at least one of 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 dynamic objects to be rendered meets the preset conditions. The preset conditions include, for example, the number of objects to be rendered, the number of objects to be rendered whose shape difference is greater than or equal to the preset difference threshold, the number of objects to be rendered whose shape is an irregular shape, the number of objects to be rendered whose material is a complex surface material, the number of light sources, the number of light sources with different light source information, the number of levels of the spatial structure of the target scene, the number of depth information of the spatial result of the target scene, and the number of dynamic objects to be rendered. At least one of the thresholds is greater than or equal to the corresponding preset number threshold. The preset number thresholds under different judgment conditions can be different or the same, can be pre-set, or can be set by the user, and are not limited here. Of course, the method for determining the scene complexity of the target scene is not limited to this, and is not limited here.

[0049] When determining the scene complexity of the target scene, the computer device may determine the degree of subdivision of the light bundle corresponding to the target scene according to the scene complexity of the target scene. The degree of subdivision of the light bundle may be used to indicate at least one of the number and density of light samples included in the preset light bundle corresponding to the target scene. When the number and density of light samples included in the preset light bundle are greater, the preset light bundle may capture more lighting details in the target scene for subsequent rendering of the to-be-rendered object in the target scene.

[0050] For example, the scene complexity of the target scene includes, for example, a first scene complexity and a second scene complexity. Among them, the first scene complexity is higher than the second scene complexity. The computer device can determine that the subdivision degree of the light beam corresponding to the target scene is the first subdivision degree based on the scene complexity of the target scene being the first scene complexity. Correspondingly, the computer device can determine that the subdivision degree of the light beam corresponding to the target scene is the second subdivision degree based on the scene complexity of the target scene being the second scene complexity. Among them, the first subdivision degree is higher than the second subdivision degree. Based on this, the computer device can perform ray beam tracing on a target scene with a higher scene complexity through a higher ray beam subdivision degree. Of course, the scene complexity of the target scene is not limited to the first scene complexity and the second scene complexity, and the subdivision degree of the light beam corresponding to the target scene is not limited to the first subdivision degree and the second subdivision degree, and no limitation is made here.

[0051] When determining the degree of light bundle subdivision, the computer device may set the preset light bundle corresponding to the target scene according to the degree of light bundle subdivision. For example, when determining the light source information of the light source corresponding to the target scene, the light source information may be set according to the degree of light bundle subdivision so that the degree of light bundle subdivision of the preset light bundle provided by the light source to the target scene can be adapted to the degree of light bundle subdivision required by the target scene.

[0052] Accordingly, when determining the preset 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 perspective 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 scene complexity of the target scene is low, the computer device does not need to sample too many light beams to be traced to perform light beam tracing on the light beams to be traced, so as to render the object to be rendered in the target scene later. The computer device can adjust the light beam sampling rate corresponding to the target scene down to sample fewer light beams to be traced from the preset light beams. Correspondingly, when the scene complexity of the target scene is high, the computer device needs to sample more light beams to be traced to perform light beam tracing on the light beams to be traced, so as to render the object to be rendered in the target scene later. The computer device can adjust the light beam sampling rate corresponding to the target scene up to sample more light beams to be traced from the preset light beams. For example, when the scene complexity of the target scene is the first scene complexity, the light beam sampling rate corresponding to the target scene is determined to be the first sampling rate. When the scene complexity of the target scene is the second scene complexity, the light beam sampling rate corresponding to the target scene is determined to be the second sampling rate. Wherein, the first scene complexity is higher than the second scene complexity, and the first sampling rate is higher than the second sampling rate.

[0054] For example, the target scene may be provided with a camera. The camera may be used to provide a viewing angle for the target scene, that is, to determine the scene angle of the target scene. The camera may include different types of cameras, such as a fixed camera and a free camera. Among them, the scene angle of the target scene corresponding to the fixed camera is fixed, and the scene angle of the target scene corresponding to the free camera is variable. Accordingly, different types of cameras may have corresponding scene angle movement speeds. For example, the scene angle movement speed of a fixed camera is 0. The scene angle movement speed of a free camera may be determined according to the speed of different camera movement operations. In the case where the scene angle movement speed corresponding to the target scene is slow, the computer device does not need to sample too many light beams to be traced to perform light beam tracing on the light beams to be traced, so as to provide for subsequent rendering of the object to be rendered in the target scene, then the computer device may reduce the light beam sampling rate corresponding to the target scene to sample fewer light beams to be traced from the preset light beams. Accordingly, when the scene perspective corresponding to the target scene moves at a faster speed, the computer device needs to sample more light beams to be traced to perform light beam tracing on the light beams to be traced, so as to subsequently render the objects to be rendered in the target scene. The computer device can increase the light beam sampling rate corresponding to the target scene to sample more light beams to be traced from the preset light beams. For example, when the scene perspective moving speed corresponding to the target scene is within a first speed range, the light beam sampling rate corresponding to the target scene is determined to be a third sampling rate. When the scene perspective moving speed corresponding to the target scene is within a second speed range, the light beam sampling rate corresponding to the target scene is determined to be a fourth sampling rate. Among them, 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, it is not limited to this. The computer device can also determine the light sampling rate corresponding to the target scene based on the scene complexity of the target scene and the scene perspective movement speed corresponding to the target scene. For example, the computer device can determine the light sampling rate corresponding to the scene complexity of the target scene, and determine the light sampling rate corresponding to the scene perspective movement speed. The computer device can determine the light sampling rate corresponding to the target scene based on one of the average value, minimum value, maximum value, and weighted average value between the light sampling rate corresponding to the scene complexity and the light sampling rate corresponding to the scene perspective movement speed. Among them, the weight information of the light sampling rate corresponding to the scene complexity and the light sampling rate corresponding to the scene perspective movement speed when determining the light sampling rate corresponding to the target scene can be pre-set or set by the user, which is not limited here. In the case of determining the light sampling rate corresponding to the target scene, the computer device can sample the light beam to be tracked corresponding to the target scene from the preset light beam according to the light beam sampling rate. Of course, it is not limited to this. When the light beam to be traced corresponding to the target scene is obtained, the light sampling rate of the light beam to be traced can change in response to at least one of the changes in the target scene and the changes in the speed of movement of the scene perspective, so as to realize dynamic adjustment of the light sampling rate and improve the convenience and flexibility of adjusting the light sampling rate, which is not limited here.

[0056] In this way, when the computer device determines the light beam to be traced corresponding to the target scene, it can perform light beam tracing on the light beam to be traced, so as to subsequently render the object to be rendered in the target scene.

[0057] Step S102: performing an intersection test on the light beam to be traced and the target area in the target scene to obtain a first test result; the size of the target area is smaller than the size of the target scene.

[0058] The computer device can divide the 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 embodiments, the computer device can use a spatial segmentation data structure to manage the objects to be rendered in the target scene. The spatial segmentation data structure may include an octree, a kd tree (k-dimensionaltree), etc., which are not limited here. For example, the computer device can use the spatial segmentation data result to divide the target scene into at least one target region, and store the object properties 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 embodiment, the computer device can determine whether the preset region currently divided contains the objects to be rendered in the process of dividing the target scene and obtaining the target region, so as to eliminate the preset region that does not contain the objects to be rendered, and determine the preset region containing the objects to be rendered as the target region. Of course, it is not limited to this, and is not limited here.

[0059] The computer device may perform an intersection test on the ray bundle to be traced and the target area to obtain a first test result. Wherein, in the case where there are multiple target areas, there may be multiple first test results accordingly. Figure 2 As shown, the target area in the target scene may include area 1 and area 2, and the size of area 1 and the size of area 2 are both smaller than the size of the target scene. Area 1, for example, includes objects 1 to 2 to be rendered, and area 2, for example, includes object n to be rendered, which is not limited here. For example, the computer device may perform an intersection test on the ray beam to be traced and area 1, and obtain a test result 1 corresponding to area 1. Furthermore, the computer device may perform an intersection test on the ray beam to be traced and area 2, and obtain a test result 2 corresponding to area 2. Based on this, the first test result may include test result 1 and test result 2. Of course, it is not limited to this, and is not limited here.

[0060] In some embodiments, when performing an intersection test on the ray bundle to be traced and the target area in the target scene, the computer device may determine a first bounding box corresponding to the target area, so as to perform an intersection test on the ray bundle to be traced and the first bounding box, thereby performing an intersection test on the ray bundle to be traced and the target area, and obtaining a first test result. Of course, this is not limited to this, and is not limited here.

[0061] In some embodiments, when performing an intersection test on a ray bundle to be traced and a target area in a target scene, the ray bundle subdivision degree of the ray bundle to be traced is updated according to the regional complexity of the target area to obtain a ray bundle to be traced corresponding to the target area; and an intersection test is performed on the ray bundle to be traced corresponding to the target area and the target area. The method for determining the regional complexity of the target area can refer to the method for determining the scene complexity of the target scene, such as determining the regional complexity of the target area according to at least one of the number of objects to be rendered in the target area, 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, which will not be repeated here. In the case where the target scene includes multiple target areas, the regional complexity of different target areas may be the same or different. Accordingly, the ray bundle subdivision degree of the ray bundle to be traced corresponding to different target areas may be different or the same, which is not limited here. Based on this, during the process of performing intersection test on the ray beam to be traced and the target area, the computer device can make the ray beam subdivision degree of the ray beam to be traced adapt to the regional complexity of the target area, which is conducive to improving the convenience and flexibility of adjusting the ray beam subdivision degree of the ray beam to be traced, and is conducive to reducing the computational complexity when performing intersection test on the ray beam to be traced and the target area, thereby helping to reduce the computational complexity when performing ray beam tracing on the ray beam to be traced.

[0062] For example, the first test result may be used to indicate one of the following: the ray bundle to be traced intersects with the target area, or the ray bundle to be traced does not intersect with the target area. When the first test result indicates that the ray bundle to be traced does not intersect with the target area, the computer device may determine that the ray bundle to be traced does not intersect with all the objects to be rendered in the target area, and the computer device may perform pruning on the ray bundle to be traced so that the ray bundle to be traced does not continue to perform intersection tests on the objects to be rendered in the non-intersecting target area, thereby reducing the number of traversals of the ray bundle to be traced on the target scene and reducing unnecessary intersection tests.

[0063] In this way, the computer device can determine whether it is necessary to continue to perform an intersection test between the ray bundle to be traced and the target area in the target scene, and obtain a first test result. In the case where the first test result indicates that the ray bundle to be traced does not intersect with the target area, the computer device does not need to continue to perform an intersection test between the ray bundle to be traced and the object to be rendered in the non-intersecting target area, so as to reduce the computational complexity when performing ray bundle tracing on the ray bundle to be traced, so as to subsequently improve the tracing rate of the ray bundle to be traced, thereby improving the rendering rate of the object to be rendered.

[0064] Step S103: when the first test result indicates that the traced light beam intersects the target area, an intersection test is performed on the traced light beam and the target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes the object to be rendered.

[0065] When the first test result indicates that the beam of light to be traced intersects the target area, the computer device may divide the target area into sub-areas to obtain at least one target sub-area. The size of the target sub-area is smaller than the size of the target area. The computer device may use the spatial segmentation data result to divide the target area. In some embodiments, when dividing the target area to obtain the target sub-area, the computer device may determine whether the currently divided preset sub-area contains the object to be rendered, so as to eliminate the preset sub-area that does not contain the object to be rendered, and determine the preset sub-area that contains the object to be rendered as the target sub-area. Based on this, the target sub-area includes the object to be rendered.

[0066] In an exemplary embodiment, the computer device may perform multi-level division on the target area to obtain target sub-areas of different levels. For example, the computer device may perform sub-area division on the target area to obtain at least one target sub-area of ​​the first level. Accordingly, the computer device may perform an intersection test on the target sub-area of ​​the first level with the target beam to be traced. For the target sub-area of ​​the first level that intersects with the target beam to be traced, the computer device may divide the target sub-area of ​​the first level to obtain at least one target sub-area of ​​the second level. Accordingly, the computer device may perform an intersection test on the target sub-area of ​​the second level with the target beam to be traced. For the target sub-area of ​​the second level that intersects with the target beam to be traced, the computer device may divide the target sub-area of ​​the second level, and so on. Among them, the computer device may determine whether it is necessary to perform multi-level division on the target area based on whether at least one of the shapes, positions, occlusion information, and depth information of different objects to be rendered in the target area meets the preset division conditions. The preset division conditions include, for example: determining that different objects to be rendered cannot intersect with the same light beam to be traced based on at least one of their respective shapes, positions, occlusion information, and depth information. When it is determined that the preset division conditions are met, the computer device can determine that the target area needs to be divided into sub-areas at the next level. The preset division conditions can be pre-set or set by the user, and are not limited here. Based on this, by dividing the target area, the intersection between the object to be rendered and the light beam to be traced in the target sub-area can be pre-judged, which is beneficial to subsequently reduce the computational complexity of the intersection test between the light beam to be traced and the object to be rendered, and further helps to reduce the computational complexity of tracing the light beam to be traced, and improve the tracing rate of the light beam to be traced.

[0067] The computer device may perform an intersection test on the ray bundle to be traced and the target sub-region to obtain a second test result. Wherein, in the case where there are multiple target sub-regions, there may be multiple second test results accordingly. Figure 3 As shown, the target sub-region in the target region may include sub-region 1 and sub-region 2, and the size of sub-region 1 and the size of sub-region 2 are both smaller than the size of the target region. Sub-region 1, for example, includes object A to be rendered, and sub-region 2, for example, includes object B to be rendered, which is not limited here. For example, the computer device may perform an intersection test on the ray beam to be traced and sub-region 1, and obtain a test result 3 corresponding to sub-region 1. Furthermore, the computer device may perform an intersection test on the ray beam to be traced and sub-region 2, and obtain a test result 4 corresponding to sub-region 2. Based on this, the second test result may include test result 3 and test result 4. Of course, it is not limited to this, and is not limited here.

[0068] In some embodiments, when performing an intersection test on the ray bundle to be traced and the target sub-region in the target region, the computer device may determine a second bounding box corresponding to the target sub-region, so as to perform an intersection test on the ray bundle to be traced and the second bounding box, thereby performing an intersection test on the ray bundle to be traced and the target sub-region, and obtaining a second test result. The size of the second bounding box is smaller than the size of the first bounding box. Of course, this is not limited to this and is not limited here.

[0069] In some embodiments, when performing an intersection test on a ray bundle to be traced and a target sub-region in a target region, the ray bundle subdivision degree of the ray bundle to be traced is updated according to the sub-region complexity of the target sub-region to obtain a ray bundle to be traced corresponding to the target sub-region; and an intersection test is performed on the ray bundle to be traced corresponding to the target sub-region and the target sub-region. The method for determining the sub-region complexity of the target sub-region can refer to the scene complexity of the target scene and the method for determining the regional complexity of the target region, such as determining the regional complexity of the target region according to at least one of 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 region, and the number of objects to be rendered as dynamic objects, which will not be described in detail here. In the case where the target region includes multiple target sub-regions, the sub-region complexity of each of the different target sub-regions may be the same or different. Accordingly, the ray bundle subdivision degree of each of the ray bundles to be traced corresponding to each of the different target sub-regions may be different or the same, which is not limited here. Based on this, in the process of performing intersection test on the ray beam to be traced and the target sub-region, the computer device can make the ray beam subdivision degree of the ray beam to be traced adapt to the sub-region complexity of the target sub-region, which is conducive to improving the convenience and flexibility of adjusting the ray beam subdivision degree of the ray beam to be traced, and is conducive to reducing the computational complexity when performing intersection test on the ray beam to be traced and the target sub-region, thereby helping to reduce the computational complexity when performing ray beam tracing on the ray beam to be traced, and improving the tracing rate of the ray beam to be traced.

[0070] For example, the second test result may be used to indicate one of the following: the ray bundle to be traced intersects with the target sub-region, or the ray bundle to be traced does not intersect with the target sub-region. When the second test result indicates that the ray bundle to be traced does not intersect with the target sub-region, the computer device may determine that the ray bundle to be traced does not intersect with all the objects to be rendered in the target sub-region, and the computer device may perform pruning on the ray bundle to be traced so that the ray bundle to be traced does not continue to perform intersection tests on the objects to be rendered in the non-intersecting target sub-region, thereby reducing the number of traversals of the ray bundle to be traced on the target scene and reducing unnecessary intersection tests.

[0071] In this way, the computer device can determine whether it is necessary to continue to perform the intersection test between the ray bundle to be traced and the target sub-region in the target region and obtain the second test result. In the case where the second test result indicates that the ray bundle to be traced does not intersect with the target sub-region, the computer device does not need to continue to perform the intersection test between the ray bundle to be traced and the object to be rendered in the non-intersecting target sub-region, so as to reduce the computational complexity when performing ray bundle tracing on the ray bundle to be traced, so as to subsequently improve the ray bundle tracing rate of the ray bundle to be traced, thereby improving the rendering rate of the object to be rendered.

[0072] Step S104: When the second test result indicates that the light beam to be traced intersects with the target sub-region, an intersection test is performed on the light beam to be traced and the object to be rendered in the target sub-region to obtain a third test result.

[0073] When the second test result indicates that the ray bundle to be traced intersects the target sub-region, the computer device may perform an intersection test on the ray bundle to be traced and the object to be rendered in the target sub-region to obtain a third test result. If there are multiple objects to be rendered in the target sub-region, the number of the third test results may also be multiple accordingly.

[0074] For example, the third test result can be used to indicate one of the following: the light beam to be traced intersects with the object to be rendered, or the light beam to be traced does not intersect with the object to be rendered. In the case where the third test result indicates that the light beam to be traced does not intersect with the object to be rendered, the computer device can determine that the light beam to be traced will not affect the non-intersecting object to be rendered due to lighting effects, shadow effects, and other rendering effects, and there is no need to render the object to be rendered in combination with the lighting information of the light beam to be traced. Accordingly, in the case where the third test result indicates that the light beam to be traced intersects with the object to be rendered, the computer device can determine that the light beam to be rendered can affect the intersecting object to be rendered due to lighting effects, shadow effects, and other rendering effects, and can subsequently render the object to be rendered in combination with the lighting information of the light beam to be traced.

[0075] In this way, when the second test result indicates that the ray bundle to be traced intersects with the target sub-region, the computer device performs an intersection test on the ray bundle to be traced and the object to be rendered in the target sub-region, and the obtained third test result can be used by the computer device to determine whether it is necessary to render the object to be rendered in combination with the illumination information of the ray bundle to be traced, which is conducive to improving the rendering convenience of the object to be rendered. Accordingly, the computer device does not need to consume additional computing resources to render the non-intersecting objects to be rendered in combination with the illumination information of the ray bundle to be traced, which is conducive to improving the rendering rate of the object to be rendered.

[0076] Step S105 : when the third test result indicates that the light beam to be traced intersects with the object to be rendered, the object to be rendered is rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered.

[0077] For example, when rendering an object to be rendered, the computer device may determine the lighting effect, pixel color, etc. corresponding to the object to be rendered based on the lighting information of the light beam to be traced that intersects the object to be rendered and the object properties of the object to be rendered. For example, the object properties may include the material of the object to be rendered, the optical properties of the object to be rendered, etc., which are not limited here. When determining the lighting effect corresponding to the object to be rendered, the computer device may determine the lighting effect that the light beam to be traced can present on the object to be rendered based on the lighting information such as the lighting intensity, lighting color, and lighting type of the light beam to be traced, combined with the object properties such as the material and optical properties of the object to be rendered. The lighting effect includes, for example, at least one of ambient light, diffuse reflection, specular reflection, and refraction. Accordingly, the computer device may simulate the light and shade, color, and other information after the interaction between the light beam to be traced and the object to be rendered in the real world, in combination with the lighting effect of the light beam to be traced on the object to be rendered, so as to determine the pixel color corresponding to the object to be rendered. When the pixel color of the object to be rendered is determined, the computer device may render the object to be rendered based on the pixel color.

[0078] In this way, the computer device can render the object to be rendered based on the object properties of the object to be rendered that intersects with the light beam to be traced and the lighting information of the light beam to be traced, which is conducive to improving the rendering convenience of the object to be rendered.

[0079] Exemplarily, rendering information corresponding to the object to be rendered is obtained when rendering the object to be rendered based on the lighting information of the light beam to be traced and the object properties of the object to be rendered; and the correspondence between the lighting information of the light beam to be traced and the rendering information corresponding to the object to be rendered is determined.

[0080] For example, when a computer device renders an object to be rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered, the computer device may cache the corresponding rendering information during the rendering process. For example, the computer device may obtain the rendering information corresponding to the object to be rendered, and establish a corresponding relationship between the illumination information of the light beam to be traced and the rendering information corresponding to the object to be rendered.

[0081] In some embodiments, when there are other light beams other than the light beam to be traced that intersect with the object to be rendered, the similarity between the other light beams and the light beam to be traced is determined based on the illumination information of the other light beams and the illumination information of the light beam to be traced; 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 illumination information of the light beam to be traced.

[0082] For example, in the process of rendering an object to be rendered, since the light source set in the target scene can continuously provide the target scene with the light beams to be traced, and the target scene can change, such as when the scene perspective corresponding to the target scene changes, it is easy to cause the target scene to change, so the computer device needs to continuously obtain the light beams to be traced corresponding to the target scene. For example, in addition to the currently traced light beam to be traced, the computer device can also obtain other light beams except the light beam to be traced.

[0083] When the computer device obtains other light beams except the light beam to be traced, if the other light beams and the light beam to be traced intersect with the same object to be rendered, the computer device can determine whether the similarity between the other light beams and the light beam to be traced is greater than or equal to the preset similarity threshold, so as to obtain the rendering information corresponding to the illumination information of the light beam to be traced when the similarity is greater than or equal to the similarity threshold, so as to render the object to be rendered. For example, the computer device can determine the similarity between the other light beams and the light beam to be traced by comparing the similarity between the other light beams and the light beam to be traced. When the similarity between the other light beams and the light beam to be traced is greater than or equal to the preset similarity threshold, the computer device can determine that the effects of the other light beams and the light beam to be traced on the same object to be rendered, such as the illumination effect, the pixel color, etc., can be similar, and the computer device can obtain the rendering information corresponding to the illumination information of the light beam to be traced based on the correspondence between the illumination information of the light beam to be traced and the rendering information corresponding to the object to be rendered, so as to render the object to be rendered, thereby realizing the reuse of the currently cached rendering information.

[0084] In this way, when there are other light beams other than the light beam to be traced that intersect with the object to be rendered, the computer device can determine the similarity between the other light beams and the light beam to be traced, so that when the similarity between the other light beams and the light beam to be traced is greater than or equal to the preset similarity threshold, the computer device renders the object to be rendered according to the rendering information corresponding to the illumination information of the light beam to be traced. Based on this, the computer device can save the computing resources required for determining the rendering information of the object to be rendered by other light beams, and directly reuse the currently cached rendering information corresponding to the light beam to be traced whose similarity with other light beams is greater than or equal to the preset similarity threshold, which is conducive to improving the rendering rate of the object to be rendered.

[0085] In some embodiments, when the object to be rendered is a static object and the time interval between the current time and the determined time of 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 determined time of 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; in response to a change in the target scene in which the object to be rendered is located, the corresponding relationship is deleted.

[0086] When a computer device caches the correspondence between the illumination information of the light beam to be traced and the rendering information corresponding to the object to be rendered, since at least one of the target scene and the object to be rendered may change, it is easy to cause the currently cached correspondence to no longer be applicable to rendering the object to be rendered. In this case, the computer device needs to change the currently cached correspondence in a timely manner. For example, when the scene perspective corresponding to the target scene changes, the target scene will change. For another example, when the object to be rendered is a dynamic object, the object to be rendered will change.

[0087] For example, when the computer device changes the currently cached correspondence, it can adopt a timed deletion strategy. Since the static object will not change, the computer device can cache the rendering information corresponding to the static object for a long time, such as caching the corresponding relationship corresponding to the static object for a long time. Since the dynamic object will change, the computer device can cache the rendering information corresponding to the dynamic object for a short time, such as caching the corresponding relationship corresponding to the dynamic object for a short time. For example, when the object to be rendered is a static object, and the time interval between the current time and the determined time of the corresponding relationship is greater than or equal to the first time interval threshold, the corresponding relationship is deleted. The first time interval can be preset or set by the user, which is not limited here. For 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 corresponding relationship is greater than or equal to the second time interval threshold, the corresponding relationship is deleted. Among them, the second time interval threshold is greater than the preset time interval threshold. The second time interval threshold can be preset or set by the user, which is not limited here.

[0088] For example, when the computer device changes the currently cached correspondence, it can adopt a deletion strategy based on scene changes. When the target scene changes, the effect of the traced light beam on the changed target scene will also change. Accordingly, the computer device needs to change 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 where the object to be rendered is located changes, so as to re-determine the rendering information corresponding to the object to be rendered. Of course, it is not limited to this. When the object to be rendered is a static object, since the static object will not change, when the change in the target scene is a change in the scene perspective, the computer device may not delete the corresponding relationship corresponding to the currently cached static object, and further obtain and cache the rendering information corresponding to the static object under different scene perspectives, so as to obtain the corresponding rendering information in response to the change in the scene perspective of the target scene, and render the static object.

[0089] In this way, when the computer device determines the correspondence between the illumination information of the light beam to be traced and the rendering information corresponding to the object to be rendered, the computer device can adopt multiple strategies to update the correspondence, which is conducive to improving the convenience and flexibility of updating the correspondence.

[0090] Exemplarily, when performing an intersection test on a ray bundle to be traced, the graphics processor performs an intersection test on all the rays to be traced in the ray bundle to be traced in parallel.

[0091] In some embodiments, based on the consideration of improving the intersection test speed to reduce the time required for the intersection test, when the computer device performs the intersection test on the ray bundle to be traced, it can utilize the parallel computing capability of the graphics processing unit (GPU) to perform the intersection test on all the rays to be traced in the ray bundle to be traced in parallel. For example, when performing the intersection test on the ray bundle to be traced and the target area in the target scene, the GPU is used to perform the intersection test on all the rays to be traced in the ray bundle to be traced and the target area in parallel. When performing the intersection test on the ray bundle to be traced and the target sub-area in the target area, the GPU is used to perform the intersection test on all the rays to be traced in the ray bundle to be traced and the target sub-area in parallel. When performing the intersection test on the ray bundle to be traced and the object to be rendered in the target sub-area, the GPU is used to perform the intersection test on all the rays to be traced in the ray bundle to be traced and the object to be rendered in parallel.

[0092] In the process of performing intersection tests on all the rays to be traced in the ray bundle to be traced in parallel through the GPU, the GPU can traverse all the objects to be rendered in the target scene in parallel for each ray to be traced, and check whether the ray to be traced intersects with the object to be rendered. For example, the GPU can determine whether the ray to be traced intersects with the object to be rendered by performing intersection tests between the ray and the triangle, the ray and the sphere, and so on. Accordingly, when it is determined that the ray to be traced intersects with the object to be rendered, the GPU can also calculate the intersection point between the ray to be traced and the object to be rendered, so as to provide for subsequent rendering of the object to be rendered.

[0093] In this way, by performing intersection tests on all the rays to be traced in the ray bundle to be traced in parallel by the GPU, the time required for the intersection test can be reduced, which is beneficial to improving the tracing rate of the ray bundle to be traced, and thus beneficial to subsequently improving the rendering rate of the object to be rendered.

[0094] In some implementations, a post-processing effect is added to the object to be rendered according to rendering information corresponding to the object to be rendered.

[0095] Exemplarily, the rendering information corresponding to the object to be rendered may include the lighting effect of the light beam to be traced on the object to be rendered, the pixel color corresponding to the object to be rendered, etc. Post-processing effects may include screen space reflection, glare, etc., which are used to enhance the visual effect of the object to be rendered.

[0096] For example, for different rendering information, different post-processing effects may be added to the object to be rendered.

[0097] In the case where it is determined according to the rendering information corresponding to the object to be rendered that the illumination effect of the object to be rendered includes a reflection effect, the post-processing effect added by the computer device to the object to be rendered may include screen space reflection. Screen space reflection can simulate the reflection effect during the rendering process of the object to be rendered. For example, screen space reflection can simulate the reflection phenomenon of the object to be rendered in the real world by calculating the process in which the light beam to be rendered starts from the camera corresponding to the target scene and enters the camera after being reflected by the surface of the object to be rendered, thereby generating a reflection effect in real time during the rendering process.

[0098] In the case where it is determined according to the rendering information corresponding to the object to be rendered that the illumination effect of the object to be rendered includes at least one of a scattering effect and a diffuse reflection effect, the post-processing effect added by the computer device to the object to be rendered may include floodlight. Floodlight can be used to simulate the effects of scattering and diffuse reflection of light emitted by a light source in the real world in the air, so as to add a corresponding effect to the object to be rendered during the rendering process of the object to be rendered. For example, when the post-processing effect added to the object to be rendered is floodlight, a soft halo effect can be generated in the highlight area of ​​the object to be rendered, so as to enhance the layering and three-dimensional sense of the object to be rendered.

[0099] Of course, the post-processing effect is not limited to this and is not limited here.

[0100] In this way, 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 by adding a post-processing effect to the object to be rendered according to the rendering information corresponding to the object to be rendered.

[0101] In some implementations, the amount of computing resources occupied 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, in the process of adding post-processing effects to an object to be rendered, based on the consideration of ensuring the rendering effect and rendering rate of the object to be rendered, 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 maintained below a preset resource threshold for a long time.

[0103] In the process of controlling the amount of computing resources occupied by the post-processing effect, the computer device can obtain the amount of computing resources occupied by the post-processing effect. When the amount of computing resources is greater than or equal to a preset resource amount threshold, the computer device can use a preset resource amount reduction strategy to adjust the effect parameter corresponding to the post-processing effect, so that while updating the post-processing effect, the amount of computing resources occupied by the updated post-processing effect can be less than the preset resource amount threshold.

[0104] The resource reduction strategy includes, for example, using a texture 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 the post-processing effects, optimizing the algorithm for adding post-processing effects, etc., which are not limited here. Accordingly, the computer device can also dynamically adjust the effect parameters corresponding to the post-processing effect according to the scene complexity of the target scene and the hardware performance of the computer device. This is not limited here.

[0105] In this way, in the process of 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 amount threshold, the effect parameters corresponding to the post-processing effect are adjusted, thereby updating the post-processing effect. This is beneficial for ensuring the rendering effect and rendering rate of the object to be rendered while improving the convenience and effect of controlling the amount of computing resources occupied by the post-processing effect.

[0106] The ray beam tracing method provided by the above embodiment obtains the ray beam to be traced corresponding to the target scene; performs an intersection test on the ray beam to be traced and the target area in the target scene to obtain a first test result; the size of the target area 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 area, performs an intersection test on the ray beam to be traced and a target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes an object to be rendered; when the second test result indicates that the ray beam to be traced intersects with the target sub-area, performs an intersection test on the ray beam to be traced and the object to be rendered in the target sub-area 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, the object to be rendered is rendered according to the illumination information of the ray beam to be traced and the object properties of the object to be rendered.

[0107] For example, in the process of tracing the ray to be traced, the computer device may perform region division on the target scene to divide the target scene into multiple target regions. The computer device may screen out the target region intersecting with the ray bundle to be traced from the multiple target regions by performing intersection tests on the ray to be traced and the multiple target regions respectively. The computer device may perform sub-region division on the target region intersecting with the ray bundle to be traced to divide the target region into multiple target sub-regions. The computer device may screen out the target sub-region intersecting with the ray bundle to be traced from the multiple target sub-regions by performing intersection tests on the ray to be traced and the multiple target sub-regions respectively. Since the target sub-region includes the object to be rendered, the computer device may perform intersection tests on the ray bundle to be traced and the object to be rendered included in the target sub-region intersecting with the ray bundle to be traced. When determining that the ray bundle to be traced intersects with the object to be rendered, the computer device may combine the illumination information of the ray bundle to be traced and render the object to be rendered. Based on this, the computer device does not need to divide the target area that does not intersect with the light beam to be traced into target sub-areas, nor does it need to perform intersection tests on the objects to be rendered in the target sub-areas that do not intersect with the light beam to be traced. This can reduce the computational complexity of ray beam tracing for the light beam to be traced, and improve the tracing rate of the light beam to be traced, which is beneficial to improving the rendering rate of the image.

[0108] The embodiment of the present application may also provide a ray beam tracing device. The ray beam tracing device may be configured in a server or a computer device to execute the above-mentioned ray beam tracing control method.

[0109] The ray bundle tracing device comprises: a ray bundle acquisition module, a first intersection test module, a second intersection test module, a third intersection test module and a rendering module.

[0110] The light beam acquisition module is used to acquire the light beam to be traced corresponding to the target scene.

[0111] The first intersection test module is used to perform an intersection test on the light beam to be traced and a target area in the target scene to obtain a first test result; the size of the target area is smaller than the size of the target scene.

[0112] A second intersection test module is used to perform an intersection test on the light beam to be traced and a target sub-region in the target region to obtain a second test result when the first test result indicates that the light beam to be traced intersects the target region; 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 on the light beam to be traced and the object to be rendered in the target sub-region to obtain a third test result when the second test result indicates that the light beam to be traced intersects with the target sub-region.

[0114] A rendering module is used to render the object to be rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered when the third test result indicates that the light beam to be traced intersects with the object to be rendered.

[0115] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0116] The method of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present 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. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0117] Exemplarily, the above method and apparatus may be implemented in the form of a computer program, which may be run on a computer device.

[0118] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or an electronic device.

[0119] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.

[0120] The storage medium may store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor may execute any ray beam tracing method.

[0121] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0122] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any ray beam tracing method.

[0123] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0124] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0125] In one embodiment, the processor is used to execute a computer program and implement the following steps when executing the computer program:

[0126] Obtain the light beam to be traced corresponding to the target scene;

[0127] Performing an intersection test on the light beam to be traced and a target area in the target scene to obtain a first test result; the size of the target area is smaller than the size of the target scene;

[0128] When the first test result indicates that the light beam to be traced intersects the target area, performing an intersection test on the light beam to be traced and a target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes an object to be rendered;

[0129] When the second test result indicates that the light beam to be traced intersects the target sub-region, performing an intersection test on the light beam to be traced 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 light beam to be traced intersects the object to be rendered, the object to be rendered is rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered.

[0131] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the control of the interactive task described above can refer to the corresponding process in the aforementioned ray beam tracing method embodiment, and will not be repeated here.

[0132] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. The method implemented when the computer program is executed by a processor can refer to the various embodiments of the ray beam tracing method of the present application.

[0133] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a 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, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0134] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0135] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0136] It should also be understood that the non-Company software tools or components appearing in the embodiments of the present application are merely examples and do not represent actual use.

[0137] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A ray beam tracing method, characterized in that: include: Obtain the light beam to be traced corresponding to the target scene; Performing an intersection test on the light beam to be traced and a target area in the target scene to obtain a first test result; The size of the target area is smaller than the size of the target scene; When the first test result indicates that the light beam to be traced intersects the target area, performing an intersection test on the light beam to be traced and a target sub-area in the target area to obtain a second test result; the size of the target sub-area is smaller than the size of the target area, and the target sub-area includes an object to be rendered; When the second test result indicates that the light beam to be traced intersects the target sub-region, performing an intersection test on the light 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 light beam to be traced intersects the object to be rendered, the object to be rendered is rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered.

2. The ray beam tracing method according to claim 1, characterized in that: The step of obtaining a light beam to be traced corresponding to the target scene includes: Sampling the light to be traced that illuminates the target scene; Based on the trained light bundle recognition model, determining the light bundle type corresponding to the light to be traced according to the illumination information of the light to be traced; According to all the to-be-traced rays of the same ray bundle type, the to-be-traced ray bundle to which the to-be-traced ray belongs is determined.

3. The ray beam tracing method according to claim 1, characterized in that: The step of obtaining a light beam to be traced corresponding to the target scene includes: Determining the degree of subdivision of the light beam corresponding to the target scene according to the scene complexity of the target scene; Determining a preset light beam corresponding to the target scene according to the light beam subdivision degree; Determining a light beam sampling rate corresponding to the target scene according to at least one of scene complexity of the target scene and a scene perspective moving speed corresponding to the target scene; According to the light bundle sampling rate, the light bundle to be traced corresponding to the target scene is sampled from the preset light bundle.

4. The ray beam tracing method according to claim 1, characterized in that: The ray beam tracing method further comprises: Acquire rendering information corresponding to the object to be rendered when rendering the object to be rendered according to the illumination information of the light beam to be traced and the object properties of the object to be rendered; Determine a correspondence between illumination information of the light beam to be traced and rendering information corresponding to the object to be rendered; The rendering of the object to be rendered includes: When there are other light bundles other than the light bundle to be traced that intersect the object to be rendered, determining the similarity between the other light bundles and the light bundle to be traced according to illumination information of the other light bundles and illumination information of the light bundle to be traced; 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 light beam to be traced.

5. The ray beam tracing method according to claim 4, characterized in that: After determining the correspondence between the illumination information of the light beam to be traced and the rendering information corresponding to the object to be rendered, at least one of the following is further included: When the object to be rendered is a static object, and the time interval between the current time and the determined time of the corresponding relationship is greater than or equal to a first time interval threshold, deleting the corresponding relationship; When the object to be rendered is a dynamic object, and the time interval between the current time and the determined time of the corresponding relationship is greater than or equal to a second time interval threshold, deleting the corresponding relationship; 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.

6. The ray beam tracing method according to any one of claims 1 to 5, characterized in that: When performing the intersection test on the light beam to be traced, the graphics processor performs the intersection test on all the light beams to be traced in the light beam to be traced in parallel.

7. The ray beam tracing method according to any one of claims 1 to 5, characterized in that: After rendering the object to be rendered, the method further includes: Adding a post-processing effect to the object to be rendered according to the rendering information corresponding to the object to be rendered.

8. The ray beam tracing method according to claim 7, characterized in that: The adding a post-processing effect to the object to be rendered includes: Obtaining the amount of computing resources occupied by the post-processing effect; When the computing resource amount is greater than or equal to a preset resource amount threshold, the effect parameter corresponding to the post-processing effect is adjusted according to a preset resource amount reduction strategy to update the post-processing effect.

9. 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 implement the ray beam tracing method according to any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the ray beam tracing method according to any one of claims 1 to 8 are implemented.

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

    US20210407170A1

  • Intersection Testing in Ray Tracing Systems with Skipping of Nodes in Sub-trees of Hierarchical Acceleration Structures

    US20210407171A1

  • Intersection testing in ray tracing systems using hierarchical acceleration structures with implicitly represented nodes

    US20240404173A1

Cited By

  • Light ray tracing device and method, GPU, light ray tracing system and electronic equipment

    CN122415830A