A ray tracing rendering method and apparatus, device

By merging shading calculations and vector/matrix operations to process ray intersection information, the problem of high computational load and low efficiency in ray tracing rendering is solved, enabling efficient rendering of complex scenes.

CN115564885BActive Publication Date: 2026-11-06HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110735572.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-30
Publication Date
2026-11-06
Estimated Expiration
2041-06-30

AI Technical Summary

Technical Problem

Existing ray tracing rendering technology is computationally intensive and inefficient in complex scenes, and cannot fully utilize hardware resources, especially vector and matrix operation units.

Method used

By merging shading calculations and using vector or matrix operations to process the intersection information of multiple rays, parallelism and execution efficiency are improved, while the amount of computation is reduced.

Benefits of technology

It improves the efficiency of ray tracing rendering, reduces computational complexity, and enhances the utilization of hardware resources, making it suitable for fast rendering of complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115564885B_ABST
    Figure CN115564885B_ABST
Patent Text Reader

Abstract

This application relates to the field of computer graphics technology and provides a ray tracing rendering method, apparatus, and device. The ray tracing rendering method includes: when multiple rays originating from a viewpoint intersect with an object to be rendered, acquiring the coordinate information of each intersection point and the raw shading data of the pixels on the imaging surface corresponding to each intersection point; the rays originate from the reverse path of the light path from the light source to the viewpoint; the raw shading data includes at least one type of data required for calculating shading components; and performing merged shading calculations based on the coordinate information of each intersection point and the raw shading data corresponding to each intersection point to obtain the shading components of the pixels corresponding to each intersection point. This application improves the parallelism and execution efficiency of the ray tracing rendering process, reduces computational load, and improves the efficiency of ray tracing rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer graphics technology, and in particular to a ray tracing rendering method, apparatus, and device. Background Technology

[0002] Rendering refers to the process of generating an image from a model. A model is a description of a 3D object using a strictly defined language or data structure, including geometry, viewpoint, texture, and lighting information. The geometry of a 3D object can be represented in various ways; for example, it can be represented using a triangular mesh, approximating the surface of the 3D object with a triangular mesh. The rendering process is the process of projecting a model in a 3D scene into a 2D digital image according to predefined environment, lighting, materials, and rendering parameters. Commonly used rendering algorithms include ray tracing and rasterization.

[0003] Ray tracing is a general-purpose technique originating from geometric optics. By tracing the light rays that interact with the surface of an object, and considering the object's material and physical rules regarding specular reflection, diffuse reflection, or refraction, the path of the light rays can be determined. This allows for a relatively accurate simulation of the imaging process of objects in the real world as seen by a camera or the human eye, resulting in rendering effects that are "photorealistic." However, because ray tracing requires tracking every single ray in a scene, involving the reflection and refraction of each ray, and calculating the shading components at each intersection point, the imaging process demands a massive amount of computation. Especially for ray tracing rendering in complex scenes, the number of intersections between rays and objects, and the complexity of the object's surface material, all affect the efficiency of ray tracing. Therefore, improving the parallel computing capabilities of ray tracing has become a key research direction for this technology. Summary of the Invention

[0004] In view of this, this application provides a ray tracing rendering method, apparatus, and device, which improves the parallelism and execution efficiency of the ray tracing rendering process, reduces the amount of computation, and improves the efficiency of ray tracing rendering.

[0005] It should be understood that in the solution provided in this application, the ray tracing rendering method can be executed by a ray tracing rendering device or some components of the ray tracing rendering device. The ray tracing rendering device can be an image processing device, mobile phone, tablet, computer, or other device with ray tracing rendering function. Some components of the ray tracing rendering device can be a processing chip, processing circuit, processor, etc.

[0006] The first aspect of this application provides a ray tracing rendering method, including:

[0007] When multiple rays originating from the viewpoint intersect with the object to be rendered, the coordinate information of each intersection point and the raw shading data of the pixels of the imaging surface corresponding to each intersection point are obtained; the rays originate from the reverse path of the light path from the light source to the viewpoint; the raw shading data includes at least one type of data required to calculate the shading components;

[0008] Based on the coordinate information of each intersection point and the original coloring data corresponding to each intersection point, a merged coloring calculation is performed to obtain the coloring components of the pixels corresponding to each intersection point.

[0009] As described above, this method tracks multiple rays originating from the viewpoint. When these rays intersect with the object to be rendered, and the lines connecting each intersection point to the light source do not intersect the object, the method obtains the coordinate information of each intersection point and the raw shading data required for shading calculation. Then, based on the coordinate information and raw shading data of each intersection point, it performs a merged shading calculation to obtain the shading components of the pixels corresponding to each intersection point. This method improves the parallelism and execution efficiency of the shading calculation process by merging the shading calculations at each intersection point, reducing the computational load and thus improving the efficiency of the rendering process.

[0010] In one possible implementation of the first aspect, when the light source is a point light source with a single sampling point, the merging color calculation includes:

[0011] With the first vector This represents the color component of the pixel corresponding to each intersection point; using the second vector The coordinates of each intersection point are represented; the at least one type of data is represented by at least one third vector.

[0012] According to the second vector And the at least one third vector, through vector operations to the first vector

[0013] As shown above, when the light source is a point light source with a single sampling point, the coordinate information of each intersection point can be combined into a vector, and the original coloring data of each intersection point can be combined into a vector. Then, the coloring component of the pixel corresponding to each intersection point can be obtained through vector operation, thereby reducing the amount of calculation and improving the calculation efficiency.

[0014] In one possible implementation of the first aspect, the at least one third vector includes: a first third vector representing the bidirectional reflection distribution function of the object surface material corresponding to each intersection point. The second and third vectors represent the angles between the lines connecting each intersection point and the sampling point of the light source and the normal.

[0015] As described above, the Bidirectional Reflectance Distribution Function (BRDF) in this method defines how irradiance in a given incident direction affects emissivity in a given outgoing direction. It describes how incident light rays are distributed in various outgoing directions after being reflected by a surface. The BRDF of the object's surface material and the angle between the line connecting the intersection point and the light source sampling point and the normal are all parameters required in the shading calculation.

[0016] In one possible implementation of the first aspect, the first vector is obtained through vector operations. It is calculated using the following formula:

[0017]

[0018] Among them, I s Let be the illumination intensity at the sampling point of the light source, and s be the coordinates of the sampling point of the light source.

[0019] In one possible implementation of the first aspect, when the light source is a surface light source with multiple sampling points, the merging color calculation includes:

[0020] With the first vector The color component of the pixel corresponding to each intersection point is represented by the second matrix b; the illumination intensity information of each light source sampling point of the surface light source is represented by the second matrix b; the first data corresponding to each intersection point and each light source sampling point is represented by the first matrix A, and each first data is calculated based on the coordinate information of each intersection point and the at least one type of data corresponding to each intersection point. The at least one type of data does not include the illumination intensity information of each light source sampling point.

[0021] The first vector is obtained through matrix operations based on the first matrix A and the second matrix b.

[0022] As shown above, when the light source is a surface light source with multiple sampling points, its computational load is greater than that of a point light source with a single sampling point. In this case, the coordinate information of each intersection point can be combined into a matrix, and the original coloring data of each intersection point can be combined into a matrix. Then, the coloring components of the pixels corresponding to each intersection point can be obtained through matrix operations, thereby reducing the computational load and improving computational efficiency.

[0023] In one possible implementation of the first aspect, the information on the illumination intensity of each light source sampling point includes: light source sampling point S n Light intensity I n Sampling point of light source S n The probability P of being sampled n .

[0024] In one possible implementation of the first aspect, the at least one type of data includes: the coordinates S of the nth light source sampling point in the surface light source. n The intersection point h corresponding to pixel i j h j The bidirectional reflection distribution function f of the surface material of the object at the intersection point i , connecting l i,n Intersection point h i The angle θ between the normals i,n , connecting l i,n With light source sampling point S n The angle between the normals at the point The connection l i,n For the intersection point h j Sampling point S of the light source n The connection.

[0025] In one possible implementation of the first aspect, the first vector is obtained through matrix operations. It is calculated using the following formula:

[0026]

[0027]

[0028]

[0029] One possible implementation of the first aspect also includes:

[0030] If the ray continues to be tracked, and a new ray generated by the ray at the intersection point intersects with the object to be rendered, the new ray is considered one of the multiple rays.

[0031] As described above, when a ray intersects with an object to be rendered, the new ray generated at the intersection point is traced to determine whether the new ray intersects with the object. When they intersect, the shading components of the pixels corresponding to the intersection point of the new ray and the object are calculated through vector or matrix operations to enable continued ray tracing and rendering calculations.

[0032] In one possible implementation of the first aspect, the continued tracking of the ray includes situations where the number of scatterings of the ray is less than a set value.

[0033] Therefore, it can be determined whether to continue tracking the ray by detecting the number of scatterings at the intersection point. When the number of scatterings exceeds the set value, it can be considered that the energy of the ray has been severely attenuated and there is no need to continue tracking the ray.

[0034] In one possible implementation of the first aspect, the step of obtaining the coordinate information of each intersection point is performed when the line connecting the intersection point and the light source sampling point does not intersect the object to be rendered.

[0035] As mentioned above, when a ray intersects with an object to be rendered, it is necessary to determine whether the line connecting the intersection point and the light source intersects with the object. If it does not want to intersect, the coordinate information of the intersection point can be obtained for subsequent shading calculations. If it intersects, it means that the intersection point may be in a shadow, and it is necessary to determine whether to continue tracking the ray based on the number of times the ray is scattered at the intersection point.

[0036] A second aspect of this application provides a ray tracing rendering apparatus, comprising:

[0037] The tracking module is used to acquire the coordinate information of each intersection point and the raw shading data of the pixels of the imaging surface corresponding to each intersection point when multiple rays originating from the viewpoint intersect with the object to be rendered; the rays come from the reverse path of the light path from the light source to the viewpoint; the raw shading data includes at least one type of data required to calculate the shading components;

[0038] The rendering module is used to perform merged color calculations based on the coordinate information of each intersection point and the original coloring data corresponding to each intersection point, so as to obtain the coloring components of the pixels corresponding to each intersection point.

[0039] In one possible implementation of the second aspect, when the light source is a point light source with a single sampling point, the rendering module is specifically used for:

[0040] With the first vector This represents the color component of the pixel corresponding to each intersection point; using the second vector The coordinates of each intersection point are represented; the at least one type of data is represented by at least one third vector.

[0041] According to the second vector And the at least one third vector, through vector operations to the first vector

[0042] In one possible implementation of the second aspect, the at least one third vector includes: a first third vector representing the bidirectional reflection distribution function of the object surface material corresponding to each intersection point. The second and third vectors represent the angles between the lines connecting each intersection point and the sampling point of the light source and the normal.

[0043] In one possible implementation of the second aspect, the first vector is obtained through vector operations. It is calculated using the following formula:

[0044]

[0045] Among them, I s Let be the illumination intensity at the sampling point of the light source, and s be the coordinates of the sampling point of the light source.

[0046] In one possible implementation of the second aspect, when the light source is a surface light source with multiple sampling points, the rendering module is specifically used for:

[0047] With the first vector The color component of the pixel corresponding to each intersection point is represented by the second matrix b; the illumination intensity information of each light source sampling point of the surface light source is represented by the second matrix b; the first data corresponding to each intersection point and each light source sampling point is represented by the first matrix A, and each first data is calculated based on the coordinate information of each intersection point and the at least one type of data corresponding to each intersection point. The at least one type of data does not include the illumination intensity information of each light source sampling point.

[0048] The first vector is obtained through matrix operations based on the first matrix A and the second matrix b.

[0049] In one possible implementation of the second aspect, the information on the illumination intensity of each light source sampling point includes: light source sampling point S n Light intensity I n Sampling point of light source S n The probability P of being sampled n .

[0050] In one possible implementation of the second aspect, the at least one type of data includes: the coordinates S of the nth light source sampling point in the surface light source. n The intersection point h corresponding to pixel i j h j The bidirectional reflection distribution function f of the surface material of the object at the intersection point i , connecting l i,n Intersection point h i The angle θ between the normals i,n , connecting l i,n With light source sampling point S n The angle between the normals at the point The connection l i,n For the intersection point h j Sampling point S of the light source n The connection.

[0051] In one possible implementation of the second aspect, the first vector is obtained through matrix operations. It is calculated using the following formula:

[0052]

[0053]

[0054]

[0055] In one possible implementation of the second aspect, the tracking module is also used for:

[0056] If the ray continues to be tracked, and a new ray generated by the ray at the intersection point intersects with the object to be rendered, the new ray is considered one of the multiple rays.

[0057] In one possible implementation of the second aspect, the continued tracking of the ray includes situations where the number of scatterings of the ray is less than a set value.

[0058] In one possible implementation of the second aspect, the tracking module acquires the coordinate information of each intersection point when the line connecting the intersection point and the light source sampling point does not intersect the object to be rendered.

[0059] A third aspect of this application provides an image processing apparatus, including a ray tracing rendering apparatus as provided in the second aspect and various alternative implementations described above.

[0060] A fourth aspect of this application provides a computing device, comprising:

[0061] processor, and

[0062] The memory stores program instructions that, when executed by the processor, cause the processor to perform ray tracing rendering methods as provided in the first aspect and the various alternative implementations described above.

[0063] In one possible implementation, the computing device is a chip.

[0064] In one possible implementation, the computing device is either a mobile phone or a computer.

[0065] The fifth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, cause the computer to perform a ray tracing rendering method as provided in the first aspect and the various alternative implementations described above.

[0066] A sixth aspect of this application provides a computer program product comprising program instructions that, when executed by a computer, cause the computer to perform a ray tracing rendering method as provided in the first aspect and the various alternative implementations described above.

[0067] In summary, the ray tracing rendering method, apparatus, and device provided in this application improve the parallelism and execution efficiency of the ray tracing rendering process by merging the single-threaded shading calculation process to obtain the shading components of the pixels corresponding to each intersection point through merged shading calculation. This reduces the computational load and improves the efficiency of ray tracing rendering. Specifically, during the merged shading calculation, the coordinate information of each intersection point and the original shading data of the pixels on the imaging surface corresponding to each intersection point can be combined into a vector based on the number of light source sampling points, and vector operations can be performed. Alternatively, the coordinate information of each intersection point and the original shading data of the pixels on the imaging surface corresponding to each intersection point can be combined into a matrix, and matrix operations can be performed. Both vector and matrix operations reduce the computational load and improve the efficiency of shading calculation compared to traditional single-threaded shading calculation, thereby improving the overall efficiency of the ray tracing rendering process. Attached Figure Description

[0068] Figure 1 This is a schematic diagram illustrating the principle of ray tracing.

[0069] Figure 2 This is a schematic diagram of a ray tracing rendering process;

[0070] Figure 3 This is a schematic diagram illustrating the geometric relationship between the intersection point and the sampling point of the light source under a point light source.

[0071] Figure 4 This is a schematic diagram of a ray tracing rendering process in SIMT mode;

[0072] Figure 5 A flowchart illustrating a ray tracing rendering method provided in this application embodiment;

[0073] Figure 6 A flowchart illustrating another ray tracing rendering method provided in this application embodiment;

[0074] Figure 7 A schematic diagram illustrating the geometric relationship between the intersection point and the sampling point of the light source under a surface light source, provided in an embodiment of this application.

[0075] Figure 8 An architectural diagram of a ray tracing rendering apparatus provided in an embodiment of this application;

[0076] Figure 9 This is an architectural diagram of a computing device provided in an embodiment of this application.

[0077] It should be understood that the dimensions and shapes of the blocks in the above structural diagrams are for reference only and should not constitute an exclusive interpretation of the embodiments of the present invention. The relative positions and inclusion relationships between the blocks presented in the structural diagrams are only schematic representations of the structural relationships between the blocks, and are not intended to limit the physical connection methods of the embodiments of the present invention. Detailed Implementation

[0078] The technical solutions provided in this application will be further described below with reference to the accompanying drawings and embodiments. It should be understood that the system architecture and business scenarios provided in the embodiments of this application are mainly for illustrating possible implementations of the technical solutions of this application and should not be construed as the sole limitation on the technical solutions of this application. Those skilled in the art will recognize that the technical solutions provided in this application are equally applicable to similar technical problems as system architectures evolve and new business scenarios emerge.

[0079] Ray tracing is a rendering algorithm in computer graphics, including forward ray tracing and inverse ray tracing. Forward ray tracing starts from a light source and traces the propagation of each ray through the scene, collecting intersection information. However, a large number of rays in forward ray tracing do not reach the viewpoint, resulting in wasted computational resources. Therefore, the ray tracing techniques in the prior art and in this application essentially refer to inverse ray tracing, such as... Figure 1 As shown, light rays are emitted from the viewpoint (camera) towards pixels on the imaging surface, then travel from the imaging surface into the scene. The transmission of these rays is then traced. If a ray reaches the light source after several reflections and refractions, it is considered a valid ray. The shading component of the pixel corresponding to the intersection point of this ray and the object to be rendered is then calculated. If the object's surface at the intersection point is a scattering surface, the color produced by the light source directly illuminating that point is calculated. If the object's surface at the intersection point is a specular or refracting surface, another ray is traced in the direction of reflection or refraction. This process continues recursively until the ray escapes the scene or reaches the set maximum recursion depth.

[0080] Reference Figure 2 This paper describes the ray tracing rendering process in detail. In this process, a 3D model of the object to be rendered is constructed, and a viewpoint o and an imaging plane are set. The viewpoint o can be a virtual viewpoint of the camera or human eye in the rendering scene. To achieve more refined rendering effects, the imaging plane can be divided according to the number of pixels. Starting from the viewpoint o, at least one ray is emitted to each pixel, entering the scene containing the 3D model of the object to be rendered. Assuming the imaging plane consists of N pixels, it can be represented in set form as {p0, p1, ..., p...} N-1}, and simultaneously construct a set of rendering results {c0, c1, ..., c} with the same size as the imaging plane. N-1}, where any element c k Represents pixel p kThe final coloring result. Based on the constructed 3D model of the object, multiple rays originating from viewpoint o are traced. Specifically, the ray tracing rendering process includes:

[0081] S201: Pixel p that originates from viewpoint o and crosses the imaging plane i Generate initial ray r i ;

[0082] S202: For light r i Perform intersection calculations with the 3D model of the object;

[0083] By tracing the light r i For this ray r i Intersection calculations are performed with the 3D model of the object to determine the ray r. i Does it intersect with the 3D model of the object to be rendered in the scene?

[0084] S203: Determine the light ray r i Does the pixel p intersect with the 3D model of the object? If no intersection exists, then for that pixel p... i light r i The tracking process terminates if the intersection point h i If it exists, proceed to step S204;

[0085] By observing the light r i Track and determine the ray r i Does the ray r intersect with the 3D model of an object in the scene? If an intersection exists, is the ray r... i For a valid ray, it can be further traced how the ray reaches the light source sampling point s after reflection and refraction; when there is no intersection, the ray r i This is an invalid ray; at this point, the ray tracing rendering process ends, and the ray r is removed. i The corresponding pixel p i The rendering result is processed into a preset color or default color.

[0086] S204: Generate a node with intersection point h i Starting from point s, the line l pointing towards the sampling point s of the light source i ;

[0087] When light r i There is an intersection point h with the 3D model of the object. i At this time, the intersection point h can be... i As the starting point, a connection l is constructed between the light source sampling point s and the point s. i To verify the intersection point h i Is there any occlusion between the light source sampling point s and the light source?

[0088] S205: Connection l iPerform intersection calculations with the 3D model of the object;

[0089] In this embodiment of the application, by connecting line l i Intersection calculations are performed with the 3D model of the object to verify the intersection point h. i Is there an obstruction between the sampling point s of the light source and the sampling point h? i The corresponding 3D model of the object can also be a 3D model of other objects existing in the scene.

[0090] S206: Determine the connection l i Does the line intersect with the 3D model of the object? If so, what are the points of intersection? i If the line intersects with the 3D model of the object, proceed directly to step S208; if the line l i If the object's 3D model does not intersect, proceed to step S207 first to perform coloring calculations, and then proceed to step S208.

[0091] By judging the connection l i Does the connection point intersect with the 3D model of an object in the scene? If so, i If the intersection point h intersects with the 3D model of an object in the scene, then the intersection point h is... i If located in a shaded area or in an area indirectly illuminated by a light source, then the light beam needs to be adjusted. i The number of scattering events is calculated to determine whether to continue tracking, and to determine whether the light source sampling point s can be reached after reflection and refraction; if the connection l i If the 3D model of an object in the scene does not intersect, a shading function can be called to shade the intersection point h. i For pixel p i The coloring components are calculated.

[0092] S207: Calculate the intersection point h i For pixel p i Coloring component I i and I i Accumulated to pixel p i The corresponding element c in the corresponding rendering result set i That is, c i =p i +I i ;

[0093] There are several methods for calculating color components; the following formula can be used as an example:

[0094]

[0095] Among them, I s f is the illumination intensity at sampling point s of the light source. iThe bidirectional reflection distribution function (BRDF) represents the material properties of an object's surface relative to the line connecting l. i Directional illumination intensity conversion to light ray r i The conversion factor, θ i For connecting line l i Intersection point h i The angle between the normal n and the normal n, |sh i |From the light source sampling point s to the intersection point h i The distance at each location and the geometric relationships between the variables can be referenced as follows: Figure 3 As shown;

[0096] S208: Determine the light ray r i Has the maximum number of scattering steps been reached? If so, then pixel p... i The ray tracing process terminates; if not, proceed to step S209.

[0097] According to the ray r i Does the current number of scattering exceed the preset number? Determine whether to proceed with this ray r. i Continue tracking, where the number of scattering events is r of the ray. i The number of intersections with the 3D models of objects in the scene is determined by the energy attenuation of light rays. After multiple reflections and refractions, the energy of the light rays decreases to a negligible value. For example, the maximum number of scattering events can be set to five. i If the scattering number exceeds five times, the ray will no longer be tracked. i The number of scattering events did not exceed five, which is sufficient for the light ray r. i Continue to track.

[0098] S209: At intersection h i Scattering calculations are performed to obtain the new ray covering the ray r. i The process recursively returns to step S202.

[0099] When light r i When the number of scatterings does not exceed the maximum number of scatterings, by adjusting the light ray r i At intersection h i Scattering calculations are performed to obtain new rays. These new rays are then tracked, recursively entering step S202 to track the intersection information between the new ray and the 3D models of objects in the scene. Tracking continues until no intersection point is found between the new ray and the 3D models of the objects, or the number of scattering iterations exceeds the maximum number of scattering iterations. At this point, tracking of the ray r is complete. i The tracking.

[0100] according to Figure 2 The ray tracing rendering process shown is such that the tracing process for each ray is independent. Existing graphics processing units (GPUs) use a single instruction multiple threads (SIMT) mode in rendering tasks, which means that the ray corresponding to each pixel is traced and processed by an independent thread. After each thread completes its tracing process, the rendering result of the corresponding pixel can be obtained.

[0101] like Figure 4 The illustrated ray tracing rendering workflow in SIMT mode involves constructing several threads to trace several rays originating from the viewpoint, with each thread running independently. Taking threads i and j as examples, they trace rays originating from viewpoint o and passing through pixel p, respectively. i The generated initial ray r i Starting from viewpoint o and passing through pixel p j The generated initial ray r j The process involves tracking and accumulating the shading components calculated by each thread into the corresponding pixel.

[0102] Should Figure 4 The ray tracing method for each thread and Figure 2 The ray tracing method shown is the same, where steps S4101-S4109 are used to perform ray tracing from viewpoint o through pixel p in thread i. i The generated initial ray r i The tracking and color calculation, steps S4201-S4209 are used to perform the tracking and color calculation of the viewpoint o and the traversal of pixel p in thread j. j The generated initial ray r j The tracking and coloring calculations.

[0103] According to this Figure 4 As can be seen, in SIMT mode, in each thread, when the initial ray intersects with the 3D model of the object, the shading calculation step (e.g., S4107) and scattering calculation step (e.g., S4109) for the intersection point are independent of each other and there is no dependency between them. That is, regardless of whether the line connecting the intersection point and the light source intersects with the 3D model of the object, it is necessary to determine whether to continue tracking the ray based on the number of scatterings of the ray.

[0104] However, due to the limitations of single-thread execution order, each thread must complete shading calculations before proceeding to scattering calculations and ray tracing. This prevents shading and scattering calculations from being executed in parallel. In the ray tracing rendering process, a large number of rays need to be traced and shading calculated. Each thread requires separate shading calculations, and there is significant repetitive computation within these multiple threads. This massive computational load places enormous demands on hardware computing power, making it impossible to render ray tracing scenes in complex scenarios. Furthermore, with advancements in hardware configurations, GPUs and other processors often contain numerous matrix or vector operation units. The current single-threaded ray tracing method in SIMT mode cannot fully utilize these processor's matrix or vector operation units, further limiting the application scenarios of ray tracing technology.

[0105] To address the issues of incomplete parallelism and the inability to utilize vector or matrix computation units in the ray tracing rendering process under SIMT mode, this application provides a ray tracing rendering method. This method can be executed by a ray tracing rendering device or some components within it. For example, it can be executed by devices with ray tracing rendering capabilities, such as image processing devices, mobile phones, tablets, and computers, or by processors, processing circuits, and image processing units. This ray tracing rendering method extracts the shading calculation process from each thread, merging the large amount of shading calculations in each thread into a smaller number of vector or matrix calculations using vector or matrix computation units. This reduces the computational load and improves the parallelism and execution efficiency of the ray tracing rendering process.

[0106] The ray tracing rendering method provided in this application is applicable to multiple fields, such as film special effects, game animation, and design visualization. Based on the ray tracing rendering method provided in this application, faster rendering speeds can be achieved to achieve real-time rendering effects.

[0107] like Figure 5 The diagram shown is a flowchart of a ray tracing rendering method provided in an embodiment of this application. The ray tracing rendering method includes:

[0108] S501: When multiple rays originating from the viewpoint intersect with the object to be rendered, obtain the coordinate information of each intersection point and the original shading data of the pixels of the imaging surface corresponding to each intersection point; the rays originate from the reverse path of the light path from the light source to the viewpoint; the original shading data includes at least one type of data required to calculate the shading components;

[0109] In this embodiment, the processor can construct a 3D model of the object to be rendered. The surface structure of this 3D model can be represented by a triangular mesh, dividing the surface structure into multiple triangular elements of varying sizes and obtaining the face data of each triangular element. Then, a viewpoint o and an imaging surface are set according to the observation position. The viewpoint o can be a virtual viewpoint of a camera or human eye in the rendering scene. To achieve a more refined rendering effect, the imaging surface can be divided according to the number of pixels. Starting from the viewpoint o, at least one ray is emitted to each pixel, entering the scene where the 3D model of the object to be rendered is located. Assuming the imaging surface consists of N pixels, it can be represented in set form as {p0, p1, ..., p...} N-1}, and simultaneously construct a set of rendering results {c0,c1,…,c} with the same size as the imaging plane. N-1}, where any element c k Represents pixel p k The final shading result is obtained by constructing multiple ray tracing threads in the processor based on the constructed 3D model of the object, to trace multiple rays originating from viewpoint o, and to determine whether each ray intersects with the 3D model of the object.

[0110] When multiple rays originating from the viewpoint intersect the 3D model of an object, connecting lines are constructed between each intersection point and a light source sampling point to determine whether these connecting lines intersect the 3D model and the direct or indirect illumination position of each intersection point. For connecting lines that do not intersect the 3D model, the coordinates of the corresponding intersection points and the raw shading data of the pixels on the imaging surface at each intersection point are obtained for subsequent shading calculations. For example, when the light source is a point light source with a single sampling point, the raw shading data specifically includes the illumination intensity of the light source sampling point, the BRDF of the object's surface material, and the angle between the line connecting the intersection point and the light source sampling point and the normal at the intersection point. When the light source is an area light source with multiple sampling points, the raw shading data specifically includes the illumination intensity and sampling probability of each light source sampling point, the BRDF of the object's surface material, the angle between the line connecting the intersection point and each light source sampling point and the normal at the intersection point, and the angle between the line connecting the intersection point and each light source sampling point and the normal at the light source sampling point.

[0111] Due to the scattering characteristics of light on the surface of a 3D object model, when multiple rays originating from the viewpoint intersect with the 3D object model, regardless of whether the line connecting each intersection point and the light source sampling point intersects with the 3D object model, it is necessary to determine whether to continue tracking the ray based on the number of scatterings at the intersection point. For example, when the number of scatterings at the intersection point exceeds a set value, the ray can be stopped from being tracked, and the tracking process for that ray ends. When the number of scatterings at the intersection point is lower than the set value, the new ray generated by the scattering at the intersection point can continue to be tracked, recursively entering step S501 to determine whether the new ray intersects with the 3D object model of the object to be rendered, until the ray is no longer tracked.

[0112] S502: Based on the coordinate information of each intersection point and the original coloring data corresponding to each intersection point, perform a merged coloring calculation to obtain the coloring components of the pixels corresponding to each intersection point.

[0113] In this embodiment, the shading components of the pixels corresponding to each intersection point can be obtained by forming a vector or matrix from the coordinate information of each intersection point and the corresponding original shading data, and then performing vector or matrix operations using the processor's computing unit. The processor's computing unit can execute in parallel with multiple constructed ray tracing threads, thereby improving the parallelism and efficiency of ray tracing rendering.

[0114] For example, when the light source is a point light source with a single sampling point, the above-mentioned merging color calculation can be implemented using vector operations, such as using vector... The color components of the pixels corresponding to each intersection point are represented by vectors. Representing the coordinate information of each intersection point, in vector form. This represents the bidirectional reflection distribution function of the object surface material at each intersection point, expressed as a vector. Let represent the angle between the line connecting each intersection point to the light source sampling point and the normal. Then, the shading component of the pixel corresponding to each intersection point can be obtained through vector operations using the following formula:

[0115]

[0116] Among them, I s Let be the illumination intensity at the sampling point of the light source, and s be the coordinates of the sampling point of the light source.

[0117] For example, when the light source is a surface light source with multiple sampling points, the above-mentioned merging and coloring calculation can be achieved using matrix operations, such as vector operations. The color components of the pixels corresponding to each intersection point are represented by matrix b, which represents the illumination intensity information of each light source sampling point of the surface light source. The illumination intensity information of each light source sampling point includes the light source sampling point S. n Light intensity In Sampling point of light source S n The probability P of being sampled n Let matrix A represent the first data corresponding to each intersection point and each light source sampling point. Each first data is calculated based on the coordinate information of each intersection point and at least one type of data corresponding to each intersection point. The at least one type of data includes: the coordinates S of the nth light source sampling point in the surface light source. n The intersection point h corresponding to pixel i j h j The bidirectional reflection distribution function f of the surface material of the object at the intersection point i , connecting l i,n Intersection point h i The angle θ between the normals i,n , connecting l i,n With light source sampling point S n The angle between the normals at the point The connection l i,n For the intersection point h j Sampling point S of the light source n The lines connecting the points can be used to obtain the color components of the pixels corresponding to each intersection point through matrix operations using the following formula:

[0118]

[0119]

[0120]

[0121] Based on the above vector or matrix operations, the set of rendering results {c0, c1, ..., c} corresponding to each intersection point can be obtained. N-1 The final rendered image can be output by rearranging the set of rendered results according to the pixel positions on the imaging plane.

[0122] The ray tracing rendering method in this embodiment can be executed by processor hardware such as a Graphics Processing Unit (GPU) or an embedded Neural-network Processing Unit (NPU). It utilizes multiple threads within the processor to perform the tracing process of multiple rays, obtaining the intersection information between each ray and the object to be rendered. Then, it uses vector or matrix operation units within the processor to perform a merging shading calculation process, obtaining the shading components of the pixels corresponding to each intersection point. These vector or matrix operations are executed in parallel with the ray tracing by each thread, improving the utilization rate of the vector or matrix operation units in the processor system architecture and significantly enhancing the overall efficiency of ray tracing rendering. The ray tracing rendering method in this embodiment can also be executed by software, such as rendering tools like Vulkan or DirectX. It can also be implemented through a combination of processor and software modules.

[0123] See also Figure 6 The flowchart shown illustrates another ray tracing rendering method provided in this application embodiment. Figure 6 As shown in this embodiment, assuming the surface material of the object to be rendered is a diffuse material and the light source in the scene is a single point light source, a three-dimensional model of the object to be rendered is constructed and introduced into the rendering model of this embodiment. Using a camera or human eye as the viewpoint, several rays of light are emitted towards the imaging surface. Specifically, the number of emitted rays can be determined based on the number of pixels on the imaging surface. Assuming the imaging surface consists of N pixels, it can be represented in set form as {p0, p1, ..., p...} N-1}, and simultaneously construct a set of rendering results {c0,c1,…,c} with the same size as the imaging plane. N-1}, where any element c k Represents pixel p k The final shading result. Based on the N pixels of the imaging plane, this embodiment can construct N threads to trace the rays passing through these N pixels, and extract the intersection information of the rays traced by each thread with the object to be rendered. Then, the merging shading calculation is performed outside the threads to process the tracing process and the shading calculation process in parallel. This utilizes the GPU's vector operation unit or matrix operation unit to reduce the computational load of each thread and improve the efficiency of ray tracing. Specifically, taking parallel running threads i and j as examples, they respectively trace the rays from viewpoint o through pixel p. i The generated initial ray r i Starting from viewpoint o and passing through pixel p j The generated initial ray r j Tracing is performed, specifically in thread i:

[0124] S6101: Starting from viewpoint o, passing through pixel p i Generate initial ray r i ;

[0125] S6102: For light r i Perform intersection calculations with the 3D model of the object;

[0126] S6103: Determine the light source r i Does the pixel p intersect with the 3D model of the object? If no intersection exists, then for that pixel p... i light r i The tracking process terminates if the intersection point h i If it exists, proceed to step S6104;

[0127] By observing the light r i Track and determine the ray r i Does the ray r intersect with the 3D model of an object in the scene? If an intersection exists, is the ray r... i For a valid ray, it can be further traced how the ray reaches the light source sampling point after reflection and refraction; when there is no intersection, the ray r i This is an invalid ray; at this point, the ray tracing rendering process for thread i ends, and the ray r is removed. i The corresponding pixel p i The rendering result is processed into a preset color or default color.

[0128] S6104: Generate a node with intersection point h i Starting from point s, the line l pointing towards the sampling point s of the light source i ;

[0129] When light r i There is an intersection point h with the 3D model of the object. i At this time, the intersection point h can be... i As the starting point, a connection l is constructed between the light source sampling point s and the point s. i To verify the intersection point h i Is there any occlusion between the light source sampling point s and the light source?

[0130] S6105: Connection l i Perform intersection calculations with the 3D model of the object;

[0131] In this embodiment of the application, by connecting line l i Intersection calculations are performed with the 3D model of the object to verify the intersection point h. i Is there an obstruction between the sampling point s of the light source and the sampling point h? i The corresponding 3D model of the object can also be a 3D model of other objects existing in the scene.

[0132] S6106: Determine connection l i Does the line intersect with the 3D model of the object? If so, what are the points of intersection? i If the line intersects with the 3D model of the object, proceed directly to step S6107; if the line l i If the ray does not intersect with the object's 3D model, the data required for the shading calculation is extracted and stored in the constructed shading data storage structure to facilitate subsequent merging shading calculations. At the same time, the process proceeds to step S6107 to determine whether to continue tracking the ray.

[0133] By judging the connection l i Does the connection point intersect with the 3D model of an object in the scene? If so, i If a 3D model intersects with any object's 3D model in the scene, then the intersection point h is... i Located in the shadow, it is necessary to proceed to step S6107 to adjust the light ray r. i The number of scattering events is calculated to determine whether to continue tracking, and to determine whether the light source sampling point s can be reached after reflection and refraction; if the connection l i If the 3D model does not intersect with any object in the scene, then the intersection point h can be extracted. i The data required for the shading calculations are stored in the constructed shading data storage structure.

[0134] Specifically, the data required for coloring calculations includes the intersection point h. i coordinate information h i The intersection point h i BRDF information f corresponding to the surface material of the object i , connecting lines i Intersection point h i The angle information θ between the normals i And the coordinate information of the light source sampling point s, s, and the light intensity I s Since the light source is a single point light source, the coordinates of the light source sampling points and the light intensity at all intersection points are the same, and can be directly reused in the color merging calculation.

[0135] As shown in the table below, this coloring data storage structure is a structure built based on the N pixels to store the data required for coloring calculation. The extracted relevant data is grouped and stored according to the pixel number.

[0136]

[0137]

[0138] It should be noted that the color data storage structure in the table above is only one manifestation of the embodiment of this application. The form of the structure is not unique. It is mainly used to group and store the extracted color calculation data according to the pixel number so that it can be called in subsequent color merging calculations.

[0139] S6107: Determine the light ray r i Has the maximum number of scattering steps been reached? If so, then pixel p... i The ray tracing process terminates; if not, proceed to step S6108.

[0140] According to the ray r i Does the current number of scattering exceed the preset number? Determine whether to proceed with this ray r. i Continue tracking, where the number of scattering events is r of the ray. i The number of intersections with the 3D models of objects in the scene is determined by the energy attenuation of light rays. After multiple reflections and refractions, the energy of the light rays decreases to a negligible value. For example, the maximum number of scattering events can be set to five. i If the scattering number exceeds five times, the ray will no longer be tracked. i The number of scattering events did not exceed five, which is sufficient for the light ray r. i Continue to track.

[0141] S6108: At intersection h i Scattering calculations are performed to obtain the new ray covering the ray r. i The process recursively returns to step S6102.

[0142] When light r i When the number of scatterings does not exceed the maximum number of scatterings, by adjusting the light ray r i At intersection h i Scattering calculations are performed to obtain new rays. These new rays are then tracked recursively, proceeding to step S6102 to track the intersection information between the new ray and the 3D model of an object in the scene. Tracking continues until no intersection point is found between the new ray and the 3D model, or the number of scattering iterations exceeds the maximum number of scattering iterations. At this point, tracking of the ray r is complete. i The tracking.

[0143] Similarly, thread j starts from viewpoint o and passes through pixel p through steps S6201-S6208. j The generated initial ray r j Tracking is performed, and in step S6206, when the connection l j If the 3D model does not intersect with any object in the scene, then the intersection point h can be extracted. j The coordinate information of the intersection point h jBRDF information f corresponding to the surface material of the object j , connecting lines j Intersection point h j The angle information θ between the normals j The data is stored in the constructed color data storage structure.

[0144] In this embodiment, the constructed N threads are only used to track the light rays originating from viewpoint o and passing through N pixels, and to extract the shading data at the intersection points. This tracking includes tracking the initial light rays originating from viewpoint o and continuing to track light rays with scattering counts lower than the maximum scattering count. The merging shading calculation process shown in steps S6301 to S6304 is independent of these N threads and does not require the computational power of these N threads. Specifically, the merging shading calculation can be implemented using the vector operation unit or matrix operation unit on a graphics processing unit (GPU) or an embedded neural network processing unit (NPU). For example, the storage capacity of the shading data storage structure can be set to the shading data storage capacity corresponding to M pixels. When the shading data stored in the shading data storage structure reaches M pixels, the shading data of these M pixels can be reorganized into vectors according to data type. Specifically, the intersection coordinates, BRDF, and intersection points are respectively composed into three sets of vectors: Simultaneously call the coordinates s of a single point light source and the light intensity I. s The following vector calculations are performed in the vector operation unit:

[0145]

[0146] in, The intersection point [h] i ,h j ,h k ,…] in the corresponding pixel [p i ,p j ,p k The coloring components of [,...], I s Let be the illumination intensity at the sampling point of the light source, and s be the coordinates of the sampling point of the light source. Let be the bidirectional reflection distribution function vector of the object's surface. Let be the angle vector between the line connecting the intersection point and the sampling point of the light source and the normal. The coordinate vector of the intersection point.

[0147] After completing the shading merging calculation for the M pixels, clear the shading data storage structure and store the shading data of the other extracted intersection points sequentially until the merging calculation of all shading data extracted by the N threads is completed. Once all threads have terminated and the shading merging calculation is complete, the resulting rendering set {c0, c1, ..., c...} can be stored. N-1 The pixels are rearranged according to their positions on the imaging plane to output the final rendered image.

[0148] In this embodiment, by separating the shading calculation process of each thread from each thread and using a vector operation unit to perform vector operations, the efficiency of the ray tracing process can be improved while reducing the amount of computation by making the vector operation process independent of the ray tracing process of each thread. Taking the rendering of a 4K high-definition image (4096×2160 pixels) as an example, in ray tracing rendering, assuming that each ray scatters an average of 5 times, the solution of this invention can reduce the number of floating-point calculations by an average of 60 per thread. If the vector operation unit can perform a 64-bit vector operation per frame, then in full-image rendering, 530M floating-point calculations can be converted into 4M vector operations. At the same time, these vector operations are executed in parallel with other operations within the thread, which can greatly improve the overall efficiency of ray tracing rendering.

[0149] Still refer to Figure 6 In some modified embodiments, it is assumed that the surface material of the object to be rendered is still a diffuse material, and the light source in the scene is changed from a single point light source to a multi-point area light source. That is, when the number of light source sampling points is multiple, when performing shading calculations on the pixel corresponding to each intersection point, it is necessary to call the coordinates and light intensity of several light source sampling points on the area light source to perform shading calculations, and calculate the shading component corresponding to each light source sampling point. The sum of these several shading components is the shading component of the pixel corresponding to the intersection point.

[0150] For reference Figure 7 The diagram shows the geometric relationship between the intersection points and the light source sampling points under a surface light source. Assuming that the surface light source has N light source sampling points, the following formula is used for color calculation of each intersection point:

[0151]

[0152] Among them, S L Let S be the coordinates of the Lth light source sampling point (which can be used later). L (Referring to the Lth light source sampling point), I L S is the sampling point of the light source. L Light intensity, h j Let f be the coordinates of the intersection point. i Let h be the BRDF of the surface material of the object at the intersection point. j Sampling point S of the light sourceL The line connecting them is l i,L θ i,L For connecting line l i,L Intersection point h i The angle between the normal n and the normal n, For connecting line l i,L The normal n at the sampling point of the light source s The included angle, |S L -h i |Sampling point S of the light source L to intersection h i The distance at point P L S is the sampling point of the light source. L The probability of being sampled.

[0153] In this embodiment, we still refer to Figure 6 By constructing N threads, the ray passing through N pixels is traced. When it passes through pixel p... i light r i There is an intersection point h with the object to be rendered j When, then the intersection point h is generated. j Starting from the point {s1, s2, ... s}, pointing towards each sampling point {s1, s2, ... s} of the surface light source. N The connection of {l} i,1 ,l i,2 ,…l i,N} and determine whether each line intersects with the 3D model of any object in the scene.

[0154] When there are several connecting lines i,k ={l i,1 ,l i,2 ,…l i,k When the lines do not intersect with the 3D model of the object, the light source sampling points corresponding to these connecting lines are the light source sampling points that need to be called during the shading merging calculation. Therefore, the intersection point h is extracted. j coordinate information h i The intersection point h i BRDF information f corresponding to the surface material of the object i The aforementioned connecting lines l i,k ={l i,1 ,l i,2 ,…l i,k} and the intersection point h i The angle information of the normal {θ} i,1 ,θ i,2 ,…θ i,k}, and the coordinate information of the sampling points of the several light sources {s1,s2,…s k Light intensity {I1,I2,…I} kThe extracted color data is stored in the color data storage structure of this embodiment, and grouped according to pixel number, as shown in the table below:

[0155]

[0156]

[0157] The storage capacity of this color data storage structure can be set to the color data storage capacity corresponding to M pixels. When the color data stored in this color data storage structure reaches M pixels, the color data of these M pixels can be reorganized into a matrix according to data type, and the color quantity of these M pixels can be calculated through matrix operations. Specifically, since the illumination intensity and sampling probability of each light source sampling point can be reused in the color calculation, the matrix operations in this embodiment include:

[0158] Matrix A

[0159]

[0160] Matrix b

[0161]

[0162] By performing matrix operations on matrices A and b, get That is, the intersection point [h] i ,h j ,h k ,…] in the corresponding pixel [p i ,p j ,p k The shading components of [,...] are accumulated into the elements of the rendering result set according to their corresponding numbers.

[0163] After completing the shading merging calculation for the M pixels, clear the shading data storage structure and store the shading data of the other extracted intersection points sequentially until the merging calculation of all shading data extracted by the N threads is completed. Once all threads have terminated and the shading merging calculation is complete, the resulting rendering set {c0, c1, ..., c...} can be stored. N-1 The pixels are rearranged according to their positions on the imaging plane to output the final rendered image.

[0164] In summary, the embodiments of this application improve the efficiency of ray tracing and reduce computation by separating the shading calculation process of each thread from each thread and using vector operation units for vector operations or matrix operation units for matrix operations. These vector or matrix operations are independent of the ray tracing process of each thread. Taking the rendering of a 4K high-definition image (4096×2160 pixels) as an example, in ray tracing rendering, assuming an average of 5 scatterings per ray and 16 sampling points for the area light source, the solution of this invention can reduce the average number of floating-point calculations by 575 per thread. If the vector operation unit can perform 64-bit vector operations per frame, and the matrix operation unit can perform 16×16 matrix operations per frame, then in full-image rendering, 16.3G floating-point calculations can be converted into 189M vector operations or 2.8M matrix operations, significantly reducing computation. Meanwhile, these vector or matrix operations are executed in parallel with other operations within the thread, which improves the utilization rate of the vector or matrix operation units configured in the hardware and greatly enhances the overall efficiency of ray tracing rendering.

[0165] like Figure 8 As shown, this application provides a ray tracing rendering apparatus, which can be used to implement the ray tracing rendering method in the above embodiments, such as... Figure 8 As shown, the ray tracing rendering device 800 has a tracing module 810 and a rendering module 820.

[0166] The tracing module 810 is used to execute any one of steps S501, S6101-S6108, and S6201-S6208 in the above-described ray tracing rendering method, as well as any optional examples thereof. The rendering module 820 is used to execute any one of steps S502, S6301-S6304 in the above-described ray tracing rendering method, as well as any optional examples thereof. For details, please refer to the detailed description in the method embodiments, which will not be repeated here.

[0167] It should be understood that the ray tracing rendering device in this application embodiment can be implemented by software, for example, by a computer program or instructions with the above-mentioned functions. The corresponding computer program or instructions can be stored in the internal memory of the terminal, and the processor reads the corresponding computer program or instructions from the memory to implement the above functions. Alternatively, the ray tracing rendering device in this application embodiment can also be implemented by hardware. For example, the ray tracing rendering device can be implemented by an image processing device, or by a processor or chip in the image processing device, such as a GPU or NPU. Alternatively, the ray tracing rendering device can also be implemented by a terminal such as a mobile phone, tablet, or computer. Alternatively, the ray tracing rendering device in this application embodiment can also be implemented by a combination of a processor and software modules.

[0168] It should be understood that the processing details of the apparatus or module in the embodiments of this application can be found by referring to... Figure 2 , Figure 4 , Figure 5 , Figure 6 The descriptions of the embodiments and related extended embodiments shown will not be repeated in this application.

[0169] Figure 9 This is a schematic structural diagram of a computing device 1000 provided in an embodiment of this application. This computing device can serve as a ray tracing rendering apparatus, executing various optional embodiments of the ray tracing rendering method described above. The computing device can be a terminal, or a chip or chip system within a terminal. The computing device 1000 includes: a processor 1010, a memory 1020, a communication interface 1030, and a bus 1040.

[0170] It should be understood that Figure 9 The communication interface 1030 in the computing device 1000 shown can be used to communicate with other devices, and may specifically include one or more transceiver circuits or interface circuits.

[0171] The processor 1010 can be connected to the memory 1020. The memory 1020 can be used to store the program code and data. Therefore, the memory 1020 can be a storage module inside the processor 1010, an external storage module independent of the processor 1010, or a component that includes both the storage module inside the processor 1010 and the external storage module independent of the processor 1010.

[0172] The computing device 1000 may further include a bus 1040. The memory 1020 and communication interface 1030 can be connected to the processor 1010 via the bus 1040. The bus 1040 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 1040 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0173] It should be understood that in the embodiments of this application, the processor 1010 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 1010 may employ one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0174] The memory 1020 may include read-only memory and random access memory, and provides instructions and data to the processor 1010. A portion of the processor 1010 may also include non-volatile random access memory. For example, the processor 1010 may also store device type information.

[0175] When the computing device 1000 is running, the processor 1010 executes computer execution instructions stored in the memory 1020 to perform any of the operation steps of the above-described ray tracing rendering method and any of its optional embodiments.

[0176] It should be understood that the computing device 1000 according to the embodiments of this application can correspond to the corresponding subject in executing the methods according to the various embodiments of this application, and the above and other operations and / or functions of each module in the computing device 1000 are respectively for implementing the corresponding processes of the methods of this embodiment. For the sake of brevity, they will not be described in detail here.

[0177] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0178] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

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

[0180] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0181] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0182] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0183] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs a ray tracing rendering method, including at least one of the schemes described in the above embodiments.

[0184] The computer storage medium in this application embodiment can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0185] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, wherein computer-readable program code is attached. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which can transmit, propagate, or transfer programs for use by or in connection with an instruction execution system, apparatus, or device.

[0186] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0187] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0188] It should be noted that the embodiments described in this application are merely some embodiments, not all embodiments. The components of the embodiments of this application typically described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the above detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0189] The terms "first, second, third, etc." or similar terms such as module A, module B, module C, etc., used in the specification and claims are only used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that a specific order or sequence may be interchanged where permitted so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0190] In the above description, the step numbers involved, such as S201, S202, etc., do not necessarily mean that this step will be executed. It may also include intermediate steps or be replaced by other steps. Where permissible, the order of the preceding and following steps may be interchanged or executed simultaneously.

[0191] The term "comprising" as used in the specification and claims should not be construed as limiting itself to what follows; it does not exclude other elements or steps. Therefore, it should be interpreted as specifying the presence of the mentioned feature, integral, step, or component, but does not exclude the presence or addition of one or more other features, integrals, steps, or components, or groups thereof. Thus, the statement "device comprising means A and B" should not be limited to a device consisting solely of components A and B.

[0192] The terms "an embodiment" or "an embodiment" as used in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in at least one embodiment of this application. Therefore, the terms "in one embodiment" or "in an embodiment" appearing throughout this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. Furthermore, in the various embodiments of this application, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions between different embodiments are consistent and can be mutually referenced. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.

[0193] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this application, all of which fall within the scope of protection of this application.

Claims

1. A ray tracing rendering method, characterized in that, include: When multiple rays originating from the viewpoint intersect with the object to be rendered, the coordinate information of each intersection point and the raw shading data of the pixels of the imaging surface corresponding to each intersection point are obtained; the rays originate from the reverse path of the light path from the light source to the viewpoint; the raw shading data includes at least one type of data required to calculate the shading components; Based on the coordinate information of each intersection point and the original coloring data corresponding to each intersection point, a merged coloring calculation is performed to obtain the coloring components of the pixels corresponding to each intersection point; When the light source is a point light source with a single sampling point, the merging color calculation includes: using the first vector The second vector represents the color component of the pixel corresponding to each intersection point. The coordinate information of each intersection point is represented; the at least one type of data is represented by at least one third vector; the at least one third vector includes: a first third vector representing the bidirectional reflection distribution function of the object surface material corresponding to each intersection point. The second and third vectors represent the angles between the lines connecting each intersection point and the sampling point of the light source and the normal. According to the second vector And the at least one third vector, through vector operations to the first vector : ; in, The light intensity at the sampling point of the light source. The coordinates of the light source sampling point; Alternatively, when the light source is a surface light source with multiple sampling points, the step of performing the merged color calculation includes: using a first vector The second matrix represents the coloring components of the pixels corresponding to each intersection point; Information representing the illumination intensity at each sampling point of a surface light source; the illumination intensity information at each sampling point includes: the light source sampling point... Light intensity Light source sampling points Probability of being sampled ; with the first matrix This represents the first data corresponding to each intersection point and each light source sampling point. Each first data is calculated based on the coordinate information of each intersection point and the at least one type of data corresponding to each intersection point. The at least one type of data includes: the first data in the surface light source. Coordinates of each light source sampling point The coordinates of the intersection point corresponding to pixel i , Bidirectional reflection distribution function of the surface material of the object at the intersection point , connection Intersection Angle between the normals , connection With light source sampling points The angle between the normals at the point The connection line Intersection to the light source sampling point The connection; according to the first matrix Second matrix The first vector is obtained through matrix operations. : ; ; 。 2. The method according to claim 1, characterized in that, Also includes: While continuing to track the ray, when a new ray generated by the ray at the intersection point intersects with the object to be rendered, the new ray is considered one of the multiple rays.

3. The method according to claim 2, characterized in that, The condition for continuing to track the light includes when the number of scattering events of the light is less than a set value.

4. The method according to claim 1, characterized in that, The step of obtaining the coordinate information of each intersection point is performed when the line connecting the intersection point and the light source sampling point does not intersect the object to be rendered.

5. A ray tracing rendering apparatus, characterized in that, include: The tracking module is used to acquire the coordinate information of each intersection point and the raw shading data of the pixels of the imaging surface corresponding to each intersection point when multiple rays originating from the viewpoint intersect with the object to be rendered; the rays come from the reverse path of the light path from the light source to the viewpoint; the raw shading data includes at least one type of data required to calculate the shading components. The rendering module is used to perform merged color calculation based on the coordinate information of each intersection point and the original coloring data corresponding to each intersection point, so as to obtain the coloring components of the pixels corresponding to each intersection point. When the light source is a point light source with a single sampling point, the merging color calculation includes: using the first vector The second vector represents the color component of the pixel corresponding to each intersection point. The coordinate information of each intersection point is represented; the at least one type of data is represented by at least one third vector; the at least one third vector includes: a first third vector representing the bidirectional reflection distribution function of the object surface material corresponding to each intersection point. The second and third vectors represent the angles between the lines connecting each intersection point and the sampling point of the light source and the normal. According to the second vector And the at least one third vector, through vector operations to the first vector : ; in, The light intensity at the sampling point of the light source. The coordinates of the light source sampling point; Alternatively, when the light source is a surface light source with multiple sampling points, the step of performing the merged color calculation includes: using a first vector The second matrix represents the coloring components of the pixels corresponding to each intersection point; Information representing the illumination intensity at each sampling point of a surface light source; the illumination intensity information at each sampling point includes: the light source sampling point... Light intensity Light source sampling points Probability of being sampled ; with the first matrix This represents the first data corresponding to each intersection point and each light source sampling point. Each first data is calculated based on the coordinate information of each intersection point and the at least one type of data corresponding to each intersection point. The at least one type of data includes: the first data in the surface light source. Coordinates of each light source sampling point The coordinates of the intersection point corresponding to pixel i , Bidirectional reflection distribution function of the surface material of the object at the intersection point , connection Intersection Angle between the normals , connection With light source sampling points The angle between the normals at the point The connection line Intersection to the light source sampling point The connection; according to the first matrix Second matrix The first vector is obtained through matrix operations. : ; ; 。 6. The apparatus according to claim 5, characterized in that, The tracking module is also used for: While continuing to track the ray, when a new ray generated by the ray at the intersection point intersects with the object to be rendered, the new ray is considered one of the multiple rays.

7. The apparatus according to claim 6, characterized in that, The condition for continuing to track the light includes when the number of scattering events of the light is less than a set value.

8. The apparatus according to claim 5, characterized in that, The tracking module acquires the coordinate information of each intersection point when the line connecting the intersection point and the light source sampling point does not intersect the object to be rendered.

9. An image processing device, characterized in that, include: The ray tracing rendering apparatus according to any one of claims 5 to 8.

10. A computing device, characterized in that, include: processor, and A memory having stored program instructions that, when executed by the processor, cause the processor to perform the ray tracing rendering method according to any one of claims 1 to 4.

11. A computer-readable storage medium, characterized in that, It stores program instructions that, when executed by a computer, cause the computer to perform the ray tracing rendering method according to any one of claims 1 to 4.

12. A computer program product, characterized in that, It includes program instructions that, when executed by a computer, cause the computer to perform the ray tracing rendering method according to any one of claims 1 to 4.