A method, device and terminal device for calculating target radiation brightness

By implementing heterogeneous parallel computing between CPU and GPU under the Optix framework, and accelerating ray tracing using accelerated structures, the problem of long calculation time for target radiation brightness in the prior art is solved, and efficient and accurate calculation is achieved.

CN115082613BActive Publication Date: 2025-05-16BEIJING INST OF ENVIRONMENTAL FEATURES +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210829013.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-15
Publication Date
2025-05-16
Estimated Expiration
2042-07-15

AI Technical Summary

Technical Problem

The prior art is difficult to shorten the time of target radiation brightness simulation while ensuring calculation accuracy, resulting in the inability to balance high accuracy and real-time performance.

Method used

Under the Optix framework, the CPU and GPU heterogeneous parallel computing is used to transfer the simulation model to the GPU and build the acceleration structure of the target model. Ray tracing is started based on the Optix framework, and ray tracing is accelerated using the acceleration structure to determine the target radiation brightness.

Benefits of technology

While ensuring the calculation accuracy, the calculation time is significantly shortened and the calculation efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082613B_ABST
    Figure CN115082613B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer graphics processing technology, and in particular to a method, device and terminal device for calculating target radiant brightness. The method of the present application is applied to a terminal device, which includes a central processing unit (CPU) and a graphics processing unit (GPU), and a ray tracing application (Optix) framework is configured in the terminal device. The method includes: the CPU obtains a simulation model, and the simulation model includes a target model, a camera model and a light source model; the simulation model is transferred to the GPU; the GPU builds an acceleration structure of the target model; the GPU starts ray tracing of the simulation model based on the Optix framework, and accelerates the ray tracing using the acceleration structure to obtain the ray tracing result; the GPU determines the target radiant brightness according to the ray tracing result; the GPU sends the target radiant brightness to the CPU. The target radiant brightness calculation method provided in the present application has high calculation efficiency while ensuring calculation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer graphics processing, and in particular to a method, device and terminal equipment for calculating target radiation brightness. Background Art

[0002] With the development of science and technology, people have higher and higher requirements for the accuracy of target radiation brightness simulation calculations. This requires improving the refinement of the target model, such as increasing the number of target grids or reducing the simplification of the algorithm. However, this will significantly increase the simulation calculation time, making it impossible to balance high precision and real-time performance.

[0003] Therefore, there is an urgent need for a target radiation brightness calculation method to solve the above technical problems. Summary of the Invention

[0004] The embodiments of the present invention provide a method, an apparatus, and a terminal device for calculating target radiance, which can greatly shorten the calculation time while ensuring the calculation accuracy.

[0005] In a first aspect, an embodiment of the present invention provides a method for calculating target radiance, which is applied to a terminal device, wherein the terminal device includes a central processing unit (CPU) and a graphics processing unit (GPU), and the terminal device is configured with a ray tracing application program OptiX framework, and the method includes:

[0006] The CPU acquires a simulation model, where the simulation model includes a target model, a camera model, and a light source model;

[0007] transferring the simulation model to the GPU;

[0008] The GPU constructs an acceleration structure of the target model;

[0009] The GPU starts ray tracing of the simulation model based on the OptiX framework, and accelerates the ray tracing using the acceleration structure to obtain a ray tracing result;

[0010] The GPU determines target radiance according to the ray tracing result, and sends the target radiance to the CPU.

[0011] In one possible design, transferring the simulation model to the GPU includes:

[0012] Transferring the target model to the GPU by constructing a shader binding table SBT, wherein the target model includes a position, geometric parameters, texture, and physical property parameters of the target;

[0013] The camera model and the light source model are updated to the GPU by updating the launch parameter Launch Params; the camera model includes the camera's position, resolution, and pitch angle, and the light source model includes the light source's geometric parameters, position, direction, and radiance.

[0014] In a possible design, before the GPU constructs the acceleration structure of the target model, the method further includes:

[0015] Initialize the Optix framework, create contexts, modules, program groups, and program pipelines.

[0016] In a possible design, the acceleration structure is a BVH structure.

[0017] In one possible design, each pixel in the imaging plane of the simulation model corresponds to a plurality of light rays;

[0018] Before the GPU starts ray tracing based on the OptiX framework, the method further includes:

[0019] Assigning a thread ID to each pixel in the imaging plane of the simulation model according to the position, resolution, and pitch angle of the camera;

[0020] According to the thread ID of each pixel, the Prd data of each light ray in the pixel is initialized. The Prd data includes the direction of the light ray, the radiant brightness of the light ray, and a random number sequence.

[0021] In one possible design, the GPU starts ray tracing of the simulation model based on the OptiX framework, and accelerates the ray tracing using the acceleration structure to obtain ray tracing results, including:

[0022] For each ray of each pixel in the imaging plane, perform:

[0023] S1, determine whether the light intersects with the target surface;

[0024] If there is no intersection, the background light radiation brightness corresponding to the light is used as the return value, the Prd data is updated according to the return value, and the tracing of the light is stopped, and S3 is executed;

[0025] If they intersect, a preset function is called at the first intersection point, the Prd data is updated according to the calculation result of the preset function, and a shadow ray is emitted to the light source with the first intersection point as the starting point to determine whether the shadow ray can reach the light source; if so, the radiant brightness of the light source corresponding to the shadow ray is updated to the Prd data, and S2 is executed; if not, the Prd data is not updated, and S2 is executed; the first intersection point is the intersection point of the light ray and the target surface that is closest to the camera;

[0026] S2, adding 1 to the depth value, and determining whether the updated depth value is equal to the depth threshold. If so, stopping tracing the ray and executing S3; if not, continuing tracing the reflected ray generated by the ray at the first intersection, and returning to executing S1;

[0027] S3, taking the light radiation brightness in the current Prd data as the tracing result of the light.

[0028] In a possible design, the preset function is a closest_hit function.

[0029] In one possible design, the GPU determines the target radiance according to the ray tracing result, including:

[0030] The average of the radiances of several rays in each pixel is taken as the radiance of the corresponding pixel;

[0031] The radiance of each pixel is combined to obtain the radiance of the target.

[0032] In a second aspect, an embodiment of the present invention further provides a target radiance calculation device, comprising:

[0033] A first acquisition module is used to acquire a simulation model, wherein the simulation model includes a target model, a camera model, and a light source model;

[0034] A first sending module, configured to transfer the simulation model to the GPU;

[0035] A construction module, used for constructing an acceleration structure of the target model;

[0036] A second acquisition module is used to start ray tracing of the simulation model based on the OptiX framework, and accelerate the ray tracing using the acceleration structure to obtain a ray tracing result;

[0037] a determination module, configured to determine target radiance according to the ray tracing result;

[0038] The second sending module is configured to send the target radiation brightness to the CPU.

[0039] In a third aspect, an embodiment of the present invention further provides a terminal device comprising a CPU and a GPU, and configured with a ray tracing application Optix framework;

[0040] The CPU is configured to obtain a simulation model, the simulation model including a target model, a camera model, and a light source model, and transfer the simulation model to the GPU;

[0041] The GPU is used to build an acceleration structure of the target model, start ray tracing of the simulation model based on the OptiX framework, and accelerate the ray tracing using the acceleration structure to obtain ray tracing results; determine the target radiation brightness based on the ray tracing results, and send the target radiation brightness to the CPU.

[0042] An embodiment of the present invention provides a method, apparatus, and terminal device for calculating target radiance. The method is applied to a terminal device comprising a central processing unit (CPU) and a graphics processing unit (GPU), and the terminal device is configured with a ray tracing application (Optix) framework. The method enables the CPU and GPU to heterogeneously and concurrently calculate the target radiance based on the Optix framework. Specifically, a simulation model is first obtained using the CPU, the simulation model comprising a target model, a camera model, and a light source model. At the same time, since the GPU has powerful parallel computing capabilities, the simulation model can be transferred to the GPU. The GPU is then used to construct an acceleration structure for the target model to accelerate the traversal speed of light rays through the simulation scene. Ray tracing of the simulation model is initiated in the GPU based on the Optix framework, the ray tracing results are obtained, and the target radiance is determined based on the ray tracing results. Finally, the target radiance is sent to the CPU. From the above analysis, it can be seen that the embodiment of the present invention achieves high computational efficiency while ensuring computational accuracy because the CPU and GPU are heterogeneously and concurrently calculating the target radiance under the Optix framework. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0044] Figure 1 This is a flow chart of a method for calculating target radiance provided by one embodiment of the present invention;

[0045] Figure 2 is a schematic diagram of a ray tracing scene of a ray tracing algorithm provided by an embodiment of the present invention;

[0046] Figure 3 is a schematic diagram of a rendering equation provided by an embodiment of the present invention;

[0047] Figure 4 is a schematic diagram of shadow ray calculation provided by an embodiment of the present invention;

[0048] FIG5( a ) is a schematic diagram of a satellite model provided in a forward direction according to an embodiment of the present invention;

[0049] FIG5( b ) is a side view of a satellite model provided by an embodiment of the present invention;

[0050] FIG6( a ) is an image calculated in the red light band using the method of the present invention, provided in one embodiment of the present invention;

[0051] FIG6( b ) is an image calculated in the green light band using the method of the present invention, provided in one embodiment of the present invention;

[0052] FIG6( c ) is an image calculated in the blue light band using the method of the present invention, provided in one embodiment of the present invention;

[0053] FIG6( d ) is an image calculated using the method of the present invention and displayed in three channels in the visible light band using red, green, and blue colors, provided by an embodiment of the present invention;

[0054] FIG6(e) is a grayscale image calculated using the method of the present invention and displayed in the visible light band with red, green, and blue colors placed in the same channel, provided by an embodiment of the present invention;

[0055] Figure 7 This is a hardware architecture diagram of a computing device provided by one embodiment of the present invention;

[0056] Figure 8 This is a structural diagram of a target radiation brightness calculation device provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0058] As mentioned above, existing target radiation brightness calculation methods cannot balance the calculation accuracy and calculation time.

[0059] To address this issue, the inventors proposed that under the Optix framework, the CPU and GPU can heterogeneously and parallelly calculate the target's radiant brightness, and use an acceleration structure on the GPU side to shorten the calculation time.

[0060] The specific implementation of the above concept is described below.

[0061] Please refer to Figure 1 An embodiment of the present invention provides a method for calculating target radiance, which is applied to a terminal device including a central processing unit (CPU) and a graphics processing unit (GPU), and a ray tracing application program Optix framework configured in the terminal device. The method includes:

[0062] Step 100: The CPU obtains a simulation model, which includes a target model, a camera model, and a light source model.

[0063] Step 102, transferring the simulation model to the GPU;

[0064] Step 104: GPU builds an acceleration structure of the target model;

[0065] Step 106: The GPU starts ray tracing of the simulation model based on the OptiX framework, and accelerates the ray tracing using the acceleration structure to obtain ray tracing results.

[0066] Step 108: The GPU determines the target radiance based on the ray tracing results.

[0067] In step 110 , the GPU sends the target radiance to the CPU.

[0068] In this embodiment, a simulation model is first acquired using the CPU. Due to the powerful parallel computing capabilities of the GPU, this simulation model can be transferred to the GPU. The GPU is then used to construct an acceleration structure for the target model to accelerate the traversal of light rays through the simulation scene. Ray tracing of the simulation model is then initiated on the GPU based on the OptiX framework, and the ray tracing results are obtained. The target radiance is then determined based on the ray tracing results, and finally, the target radiance is sent to the CPU. This embodiment achieves high computational efficiency while ensuring accuracy due to the heterogeneous parallel calculation of the target radiance by the CPU and GPU under the OptiX framework.

[0069] To better understand the solution, before describing the specific implementation of each step, it is necessary to explain the principle of using ray tracing to determine the target radiation brightness and the rendering equation:

[0070] Figure 2Figure 3 is a schematic diagram of a ray tracing scenario for a ray tracing algorithm. In this scenario, a specified number of rays are emitted from the camera toward each pixel in the imaging plane. The transmission process of each ray is traced and recorded. Based on this transmission process, the rendering equation is solved to determine the radiance of the object (target). In other words, the radiance of the target is obtained by solving the rendering equation.

[0071] Figure 3 This is a schematic diagram of the rendering equation. In computer graphics, the classic rendering equation is shown as follows:

[0072] L o (x,ω o ,λ,t)=L e (x,ω o ,λ,t)+∫ Ω f λ (x,ω i ,ω o ,λ,t)L i (x,ω i ,λ,t)(ω i ·n)dω i (1-1)

[0073] Where, L o (x,ω o ,λ,t) is the direction of ω at point x on the surface of the object o The spectral radiance at wavelength λ projected in the direction; L e (x,ω o ,λ,t) is the direction of ω at point x on the surface of the object o Directional self-emission radiance; L i (x,ω i ,λ,t) is ω i Spectral radiance of the incident direction, ω o is the reflection direction of the light, which is also equivalent to the opposite direction of the view ray emitted from the camera in the calculation; t is the time; f λ (x,ω i ,ω o ,λ,t) is the bidirectional reflection distribution function, BRDF, of the object at point x on the surface; ω i n is the geometric term, the dot product of the incident unit vector and the unit normal vector, i.e. cosθ i ;dω i is the micro-element solid angle in the incident direction; θ i is the angle between the incident light ray and the normal.

[0074] It can be seen that the above rendering equation (1-1) is an integral equation. In traditional ray tracing calculations, if a large number of photons are to be emitted to converge the calculation results, and due to the limitation of computer computing power, this process takes an unacceptable amount of time. Many scholars have proposed lighting models such as Phong and Blinn-Phong to simplify the calculation of this equation. These simplifications are made to quickly solve the equation. These simplified calculation models usually do not consider the multiple scattering of light in the scene, and only calculate the influence of direct illumination of the light source on the surface radiation brightness. Therefore, the calculation results lack realism and have low accuracy.

[0075] With the advancement of computing power and the introduction of NVIDIA's CUDA parallel GPU computing architecture, ray tracing algorithms have been widely studied due to their high parallelism. In this application's computational method, the GPU initiates ray tracing based on the OptiX framework. Because the computational solution for each pixel is independent, a computational thread can be assigned to each pixel based on the camera's resolution, thereby accelerating the computation.

[0076] In addition, to improve the computational accuracy of the model solution, the present invention uses a path tracing algorithm based on Monte Carlo integration to solve the integral term of the rendering equation (1-1). It should be noted that due to the transient nature of the calculation process, the time term in the equation can be omitted. At the same time, for ease of reading, the position parameter and wavelength parameter can also be omitted. The simplified calculation equation for the integral term in the rendering equation (1-1) is shown in the following equation (1-2):

[0077]

[0078] In the formula, p(ω j ) is the probability density of sampling in the hemispherical space, and N is the number of photons.

[0079] It can be seen that formula (1-2) converts the integral calculation into the expectation calculation through the method of mathematical statistics. The advantage of this method compared to the discrete coordinate method for solving the integral is that only one photon needs to be tracked for each reflection calculation, and the result of the approximate integral is calculated by a large number of photons, rather than each reflection requiring a ray to be reflected in each grid of the discrete coordinates in the hemispherical space. This method fits the problem of small cache of a single thread in CUDA parallel computing.

[0080] Currently, common sampling probability densities are uniform sampling in hemispherical space or sampling based on Lambert probability density. The calculation formulas for these two sampling methods are as follows:

[0081] (1) Hemispherical uniform sampling:

[0082]

[0083] θ j =acos(1-ξ1) (1-4)

[0084] φ j =2πξ2 (1-5)

[0085] Where: p u (ω j ) is the probability density of uniform sampling, θ j ,φ j The reflection direction ω calculated by sampling j The zenith angle and circular angle of ξ1 and ξ2 are random numbers between 0 and 1.

[0086] (2) Lambert probability density sampling:

[0087]

[0088]

[0089] φ j =2πξ2 (1-8)

[0090] Where p l (ω j ) is the probability density of Lambert sampling, and the meanings of other parameters are the same as above.

[0091] In addition, in formula (1-2), The calculation is complicated. If:

[0092]

[0093] The BRDF term and the geometric term in the numerator can be eliminated. If the surface of the object is a diffuse reflection surface, the BRDF term satisfies:

[0094]

[0095] and then:

[0096]

[0097] It can be found that the above formula (1-11) is the probability density of Lambert sampling. Since the surfaces of most objects in reality are closer to diffuse reflection surfaces, the use of Lambert sampling probability density can usually achieve a faster convergence speed. Therefore, the embodiments of this application all use Lambert sampling probability density.

[0098] Described below Figure 1 How to perform the steps shown.

[0099] First, for step 100, the CPU obtains a simulation model, which includes a target model, a camera model, and a light source model.

[0100] like Figure 2 As shown in the figure, the simulation model is used to simulate a ray tracing scene. In this scene, there are targets, cameras and light sources. Within the imaging plane, the camera starts to emit a number of rays toward the target. Some rays do not intersect with the object and fall into the background. Some rays intersect with the object to generate reflected rays. Of course, the reflected rays will continue to transmit within the scene, or fall into the background, or reach the light source. Ray tracing is to record the transmission process of each ray and accumulate the energy during the transmission process. Finally, the radiation brightness of the target is determined by the accumulated results.

[0101] In this simulation model, the number of light sources and targets can be one or more, and can be of the same type or different types, which is not specifically limited in this application.

[0102] Next, for step 102, the simulation model is transferred to the GPU, including:

[0103] In step A, the target model is transferred to the GPU by constructing a shader binding table (SBT). The target model includes the target's position, geometry, texture, and physical properties (such as reflectivity, temperature, and refractive index). In this step, the SBT is composed of sharder records, which are used to transfer data to the GPU.

[0104] Step B: Update the camera model and light source model to the GPU by updating the launch parameters Launch Params; the camera model includes the camera's position, resolution, and pitch angle, and the light source model includes the light source's geometric parameters, position, direction, and radiance.

[0105] In steps A and B, the camera model and the light source model are stored in different locations on the GPU than the target model. This way, when the light source or camera parameters need to be adjusted while the target model remains unchanged, there is no need to rebuild the acceleration structure.

[0106] Then, for step 104, before the GPU builds the acceleration structure of the target model, it also includes: initializing the Optix framework, creating contexts, modules, program groups and program pipelines, so as to check whether the terminal device can run the Optix framework normally and prepare for starting the GPU.

[0107] For step 104 , the GPU constructs an acceleration structure of the target model.

[0108] In this step, the acceleration structure may be a BVH (bounding volume hierarchy) structure. The construction process of the structure is related to the geometric parameters of the target. After the structure is constructed, it can be used to accelerate the traversal speed of the light through the scene.

[0109] For example, suppose Figure 2 There are m grids in the imaging plane shown. If the CPU is used for calculation, since it does not use the acceleration structure, m grids must be traversed for each pixel and each reflection. After the GPU uses the acceleration structure, it only needs to traverse log2(m) grids at most each time. Even when encountering a pixel corresponding to the background, no grid needs to be traversed at all. This can greatly shorten the calculation time.

[0110] exist Figure 2 In the simulation model shown, each pixel in the imaging plane corresponds to a plurality of light rays. Before executing step 106, the following steps are also included:

[0111] Assign a thread ID to each pixel in the simulation model imaging plane based on the camera's position, resolution, and pitch angle;

[0112] According to the thread ID of each pixel, the Prd data of each light in the pixel is initialized. The Prd data includes the direction of the light, the radiation brightness of the light, and a random number sequence.

[0113] In this step, once the camera position, resolution, and pitch angle are determined, the ID of each pixel, that is, the thread ID, can be determined based on the position of the pixel in the resolution. Based on the thread ID, the initial state of each light ray can be determined, which is the starting point of ray tracing.

[0114] For step 106, the GPU starts ray tracing of the simulation model based on the OptiX framework and accelerates the ray tracing using the acceleration structure to obtain ray tracing results, including:

[0115] For each ray of each pixel in the imaging plane, perform:

[0116] S1, determine whether the light intersects with the target surface;

[0117] If they do not intersect, the background light radiance corresponding to the ray is used as the return value, the Prd data is updated according to the return value, and the tracing of the ray is stopped, and S3 is executed;

[0118] If they intersect, call the preset function at the first intersection point, update the Prd data according to the calculation result of the preset function, and emit a shadow ray to the light source with the first intersection point as the starting point to determine whether the shadow ray can reach the light source; if so, update the light source radiation brightness corresponding to the shadow ray to the Prd data and execute S2; if not, do not update the Prd data and execute S2; the first intersection point is the intersection point closest to the camera among the intersection points of the light ray and the target surface;

[0119] S2, add 1 to the depth value and determine whether the updated depth value is equal to the depth threshold. If so, stop tracing the ray and execute S3; if not, continue tracing the reflected ray generated by the ray at the first intersection and return to execute S1;

[0120] S3, taking the light radiation brightness in the current Prd data as the tracing result of the light.

[0121] In this step, the default function is the closest_hit function. Each time a ray is transmitted, the closest_hit function calculates the target's self-emitted radiance, ray energy, emitted shadow rays, updated ray starting point, and next reflection direction. Each time a ray is transmitted, the energy value is added to the previous energy value until the trace ends. The energy value (i.e., radiance) in the final Prd data is used as the radiance of the ray.

[0122] During the tracking process, if the light or reflected light does not intersect the target, the calculated background energy is added to the Prd data and the tracking is stopped. Otherwise, the tracking continues. Of course, as the number of transmissions increases, the energy contribution of the light becomes smaller and smaller. If it is tracked infinitely, it will not only increase the calculation time, but also have no contribution to the calculation accuracy. Therefore, in this step, the depth threshold can be 10, that is, for each light ray, it is tracked up to 10 times, and the energy accumulation value of these 10 times is used as the final radiant brightness of the light ray, which ensures the calculation accuracy while shortening the calculation time.

[0123] In this step, the shadow light is explained as follows.

[0124] In the field of visible light calculation, most objects do not have self-emitted radiance, so the radiance they project toward the camera is mainly the reflection of the radiance of the light source in the scene. According to the sampling method of Lambert sampling in hemispherical space, only a few reflected rays can intersect with the light source, and the direct illumination calculation of the light source converges slowly. Therefore, the present invention uses the shadow ray method. After detecting the intersection of light and object, in addition to calculating the reflected light, an additional shadow ray is emitted toward the light source. When the shadow ray does not collide with other objects in the scene, it is considered that the direct illumination of the light source can illuminate the intersection of the light and the object, and the radiance corresponding to the shadow ray is accumulated in the Prd data, which can accelerate the convergence of the illumination calculation.

[0125] like Figure 4 The figure shows a schematic diagram of shadow light calculation.

[0126] Figure 4 In the equation (1-1), x' is a point on the light source, and x is the point on the surface where the shadow light is emitted. Assuming that the infinitesimal area of ​​point x' is dA', the integral term of the rendering equation becomes:

[0127]

[0128] Where x-x' is the vector from point x to point x' on the light source; f(xx',ω o ) is the bidirectional reflection distribution function of the object at point x on the surface, BRDF; L i (x′, xx′) is the radiant brightness of the light source projected toward x; θ i is the angle between the vector x-x' and the normal vector n at point x; θ' is the angle between the vector x'-x and the normal vector n' at point x', ω o The direction of light reflected from the light source at point x toward the camera.

[0129] Using Monte Carlo integration again on equation (1-12), we get the following equation:

[0130]

[0131] Where A is the area of ​​the light source, 1 / A is the probability density of sampling on the light source, and v(x, x′) is the visibility function, which is 1 when the shadow ray is not blocked and 0 otherwise.

[0132] Formula (1-13) is the method for calculating the shadow rays of direct light sources. This method is also called importance sampling, which means that more dense sampling is performed in areas that have a greater impact on the integrand to speed up the convergence of lighting calculations.

[0133] For step 108, the GPU determines the target radiance based on the ray tracing results, including:

[0134] The average of the radiances of several rays in each pixel is taken as the radiance of the corresponding pixel;

[0135] The radiance of each pixel is combined to obtain the radiance of the target.

[0136] In this embodiment, since each pixel has many rays, each ray contributes to the radiance of the pixel. Therefore, the average of the radiances of all rays can be used as the final radiance of the pixel. Once the radiance of each pixel is determined, the radiance of the entire target can be determined.

[0137] Finally, with respect to step 110 , the target radiation brightness is sent to the CPU. After receiving the target radiation brightness, the CPU may display the image on the screen or output the image.

[0138] To demonstrate the computational effectiveness of the method of the present invention, the inventors used the method to simulate the distribution of the model's radiant brightness under sunlight. The GPU used in this program was an RTX 2060, CUDA version 11.1, graphics driver version 11.3, and Optix version 7.2. The maximum iteration depth was set to 10, the resolution was 6000×4800, and the number of photons per pixel was 1000. The specific parameters of the satellite model, the coordinate system layout, and the light source direction settings are shown in Table 1, Figures 5(a), and 5(b). Based on the different reflectance data for the three bands, the images of the red, green, and blue bands, as well as the entire visible light band, were calculated. The calculation results are shown in Table 1. Figure 6(a)~6(e) shown.

[0139] Table 1 Calculation of satellite model related parameters

[0140] Model Number of grids Number of materials Whether to use texture Number of texture images Satellite Model 34981 1 yes 1

[0141] from Figure 6(a)~6(e) It can be seen that the method of the present invention can effectively calculate the target's radiant brightness in each band and output the target image based on the calculated radiant brightness. Figure 6(a) shows the image calculated in the red light band, Figure 6(b) shows the image calculated in the green light band, Figure 6(c) shows the image calculated in the blue light band, Figure 6(d) shows the image displayed in the visible light band by placing red, green, and blue in three channels, i.e., the image visible to the human eye, and Figure 6(e) shows the grayscale image displayed in the visible light band by placing red, green, and blue in the same channel, i.e., the image that can reflect the total energy distribution.

[0142] In addition, the inventors also verified the acceleration effect of the embodiment of the present invention (in the verification model, the number of grids is 34981, the CPU does not use the acceleration structure, and the GPU uses the BVH acceleration structure). The verification results are shown in Table 2:

[0143] Table 2 Comparison of radiance time between CPU and GPU calculation models

[0144]

[0145] It can be seen from Table 2 that as the number of photons increases, the acceleration ratio continues to increase, that is, the method of the present invention can greatly shorten the calculation time of the target radiation brightness.

[0146] like Figure 7 、 Figure 8 As shown in FIG, an embodiment of the present invention provides a device for calculating target radiance. The device embodiment can be implemented by software, hardware, or a combination of software and hardware. From the hardware level, as shown in FIG. Figure 7 As shown in FIG. 1 , a hardware architecture diagram of a computing device where a target radiance calculation device is provided in an embodiment of the present invention is provided. Figure 7 In addition to the processor, memory, network interface, and non-volatile memory shown, the computing device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 8 As shown, as a logical device, the CPU of the computing device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it. This embodiment provides a target radiance calculation device, including:

[0147] A first acquisition module 800 is used to acquire a simulation model, where the simulation model includes a target model, a camera model, and a light source model;

[0148] A first sending module 802 is used to transfer the simulation model to the GPU;

[0149] A construction module 804 is used to construct an acceleration structure of the target model;

[0150] The second acquisition module 806 is used to start ray tracing of the simulation model based on the OptiX framework, and accelerate the ray tracing using the acceleration structure to obtain the ray tracing results;

[0151] A determination module 808 is configured to determine target radiance based on the ray tracing result;

[0152] The second sending module 810 is configured to send the target radiation brightness to the CPU.

[0153] In an embodiment of the present invention, the first acquisition module 800 can be used to execute step 100 in the above method embodiment, the construction module 802 can be used to execute step 102 in the above method embodiment, the first sending module 804 can be used to execute step 104 in the above method embodiment, the second acquisition module 806 can be used to execute step 106 in the above method embodiment, the determination module 808 can be used to execute step 108 in the above method embodiment, and the second sending module 810 can be used to execute step 110 in the above method embodiment.

[0154] In some implementations, the first sending module 802 is configured to execute:

[0155] The target model is transferred to the GPU by building a shader binding table SBT, which includes the target's position, geometric parameters, texture and physical parameters;

[0156] The camera model and light source model are updated to the GPU by updating the launch parameters Launch Params; the camera model includes the camera's position, resolution, and pitch angle, and the light source model includes the light source's geometric parameters, position, direction, and radiant brightness.

[0157] In some embodiments, a creation module 812 is further included. Before executing the construction module 804, the creation module 812 is used to execute:

[0158] Initialize the Optix framework, create contexts, modules, program groups, and program pipelines.

[0159] In some implementations, in the building block 804 , the acceleration structure is a BVH structure.

[0160] In some embodiments, each pixel in the imaging plane of the simulation model corresponds to a plurality of light rays. Before executing the second acquisition module 806, the process further includes:

[0161] Assign a thread ID to each pixel in the simulation model imaging plane based on the camera's position, resolution, and pitch angle;

[0162] According to the thread ID of each pixel, the Prd data of each light in the pixel is initialized. The Prd data includes the direction of the light, the radiation brightness of the light, and a random number sequence.

[0163] In some implementations, the second acquisition module 806 is configured to execute:

[0164] For each ray of each pixel in the imaging plane, perform:

[0165] S1, determine whether the light intersects with the target surface;

[0166] If they do not intersect, the background light radiance corresponding to the ray is used as the return value, the Prd data is updated according to the return value, and the tracing of the ray is stopped, and S3 is executed;

[0167] If they intersect, call the preset function at the first intersection point, update the Prd data according to the calculation result of the preset function, and emit a shadow ray to the light source with the first intersection point as the starting point to determine whether the shadow ray can reach the light source; if so, update the light source radiation brightness corresponding to the shadow ray to the Prd data and execute S2; if not, do not update the Prd data and execute S2; the first intersection point is the intersection point closest to the camera among the intersection points of the light ray and the target surface;

[0168] S2, add 1 to the depth value and determine whether the updated depth value is equal to the depth threshold. If so, stop tracing the ray and execute S3; if not, continue tracing the reflected ray generated by the ray at the first intersection and return to execute S1;

[0169] S3, taking the light radiation brightness in the current Prd data as the tracing result of the light.

[0170] In some implementations, the preset function is a closest_hit function.

[0171] In some implementations, the determination module 808 is configured to perform:

[0172] The average of the radiances of several rays in each pixel is taken as the radiance of the corresponding pixel;

[0173] The radiance of each pixel is combined to obtain the radiance of the target.

[0174] An embodiment of the present invention further provides a terminal device comprising a CPU and a GPU, and configured with a ray tracing application Optix framework;

[0175] The CPU is used to obtain a simulation model, which includes a target model, a camera model, and a light source model, and transfer the simulation model to the GPU;

[0176] The GPU is used to build an acceleration structure for the target model, start ray tracing of the simulation model based on the Optix framework, and use the acceleration structure to accelerate ray tracing to obtain ray tracing results; determine the target radiation brightness based on the ray tracing results, and send the target radiation brightness to the CPU.

[0177] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the processor executes a target radiance calculation method according to any embodiment of the present invention.

[0178] Specifically, a system or device equipped with a storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program codes stored in the storage medium.

[0179] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.

[0180] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0181] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.

[0182] In addition, it can be understood that the program code read from the storage medium is written into a memory provided in an expansion board inserted into the computer or into a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.

[0183] It should be noted that, in this article, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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 device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical factors in the process, method, article or device comprising the elements.

[0184] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk, etc. Various media that can store program codes.

[0185] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for calculating target radiation brightness, characterized in that: Applied to a terminal device, the terminal device includes a central processing unit (CPU) and a graphics processing unit (GPU), and the terminal device is configured with a ray tracing application Optix framework, the method includes: The CPU acquires a simulation model, wherein the simulation model includes a target model, a camera model, and a light source model; transferring the simulation model to the GPU; The GPU constructs an acceleration structure of the target model; The GPU starts ray tracing of the simulation model based on the Optix framework, and accelerates the ray tracing by using the acceleration structure to obtain ray tracing results; The GPU determines the target radiance according to the ray tracing result, and sends the target radiance to the CPU; The acceleration structure is a BVH structure; Each pixel in the imaging plane of the simulation model corresponds to a number of light rays; Before the GPU starts ray tracing based on the Optix framework, the method further includes: Assigning a thread ID to each pixel in the imaging plane of the simulation model according to the position, resolution and pitch angle of the camera; According to the thread ID of each pixel, the Prd data of each light ray in the pixel is initialized, and the Prd data includes the direction of the light ray, the radiation brightness of the light ray, and a random number sequence.

2. The method according to claim 1, characterized in that The transferring the simulation model to the GPU comprises: The target model is transferred to the GPU by constructing a shader binding table SBT, wherein the target model includes a position, geometric parameters, texture and physical property parameters of a target; The camera model and the light source model are updated to the GPU by updating the launch parameters Launch Params; the camera model includes the position, resolution and pitch angle of the camera, and the light source model includes the geometric parameters, position, direction and radiant brightness of the light source.

3. The method according to claim 1, characterized in that Before the GPU constructs the acceleration structure of the target model, the method further includes: Initialize the Optix framework, create contexts, modules, program groups, and program pipelines.

4. The method according to claim 1, characterized in that The GPU starts ray tracing of the simulation model based on the Optix framework, and accelerates the ray tracing using the acceleration structure to obtain ray tracing results, including: For each ray of each pixel in the imaging plane, perform: S1, determine whether the light intersects with the target surface; If they do not intersect, the background light radiation brightness corresponding to the light is used as the return value, the Prd data is updated according to the return value, and the tracing of the light is stopped, and S3 is executed; If they intersect, call a preset function at the first intersection, update the Prd data according to the calculation result of the preset function, and emit a shadow ray to the light source with the first intersection as the starting point to determine whether the shadow ray can reach the light source; if so, update the radiation brightness of the light source corresponding to the shadow ray to the Prd data, and execute S2; if not, do not update the Prd data, and execute S2; the first intersection is the intersection point of the light ray and the target surface that is closest to the camera; S2, adding 1 to the depth value, determining whether the updated depth value is equal to the depth threshold, if so, stopping tracing the ray and executing S3; if not, continuing tracing the reflected ray generated by the ray at the first intersection, and returning to execute S1; S3, taking the light radiation brightness in the current Prd data as the tracing result of the light.

5. The method according to claim 4, characterized in that The preset function is the closest_hit function.

6. The method according to claim 4, characterized in that The GPU determines the target radiation brightness according to the ray tracing result, including: The average of the radiances of several rays in each pixel is taken as the radiance of the corresponding pixel; The radiance of each pixel is combined to obtain the radiance of the target.

7. A target radiation brightness calculation device, characterized in that: Applied to terminal equipment, including: A first acquisition module, used to acquire a simulation model, wherein the simulation model includes a target model, a camera model and a light source model; A first sending module, used for transferring the simulation model to a GPU; A construction module, used for constructing an acceleration structure of the target model; A second acquisition module is used to start the ray tracing of the simulation model based on the Optix framework, and accelerate the ray tracing by using the acceleration structure to obtain the ray tracing result; A determination module, used to determine the target radiation brightness according to the ray tracing result; A second sending module, used to send the target radiation brightness to the CPU; The acceleration structure is a BVH structure; Each pixel in the imaging plane of the simulation model corresponds to a number of light rays; Before executing the ray tracing of the simulation model based on the Optix framework, the second acquisition module further includes: Assigning a thread ID to each pixel in the imaging plane of the simulation model according to the position, resolution and pitch angle of the camera; According to the thread ID of each pixel, the Prd data of each light ray in the pixel is initialized, and the Prd data includes the direction of the light ray, the radiation brightness of the light ray, and a random number sequence.

8. A terminal device, characterized in that: Includes CPU and GPU, and is equipped with Optix framework, a ray tracing application; The CPU is used to obtain a simulation model, wherein the simulation model includes a target model, a camera model, and a light source model, and transfer the simulation model to the GPU; The GPU is used to construct an acceleration structure of the target model, and start ray tracing of the simulation model based on the Optix framework, and accelerate the ray tracing by using the acceleration structure to obtain ray tracing results; Determine the target radiance according to the ray tracing result, and send the target radiance to the CPU; The acceleration structure is a BVH structure; Each pixel in the imaging plane of the simulation model corresponds to a number of light rays; Before the GPU starts the ray tracing of the simulation model based on the Optix framework, the GPU further includes: Assigning a thread ID to each pixel in the imaging plane of the simulation model according to the position, resolution and pitch angle of the camera; According to the thread ID of each pixel, the Prd data of each light ray in the pixel is initialized, and the Prd data includes the direction of the light ray, the radiation brightness of the light ray, and a random number sequence.

Citation Information

Patent Citations

  • Real-time ray tracing and rendering method based on GPU (Graphics Processing Unit) aggregate

    CN103049927A

  • Light field display device simulating method based on ray tracing algorithm

    CN107563088A