A computer graphics rendering method and system based on ray tracing
Through the rendering method based on ray tracing, the problems of low raster rendering efficiency and insufficient details are solved, efficient and realistic rendering effects and physical simulations are achieved, and the rendering speed and image quality are improved.
Patent Information
- Application Number
- CN202311434904.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-10-30
AI Technical Summary
Among existing computer graphics rendering technologies, raster rendering has low efficiency, insufficient detail performance, large memory consumption, and difficulty in achieving physically accurate simulation, resulting in slow rendering speed and low image quality.
A rendering method based on ray tracing is adopted. By constructing a ray tracing acceleration structure, the rendering parameters and interaction status information are obtained, the ray tracing algorithm is applied for rendering, noise reduction processing and visual effects adjustment are performed, and the rendering result image is finally output.
It improves rendering efficiency and effects, can realistically simulate lighting and physical phenomena, achieves dynamic effects and high-resolution output, and reduces memory usage and calculation volume.
Smart Images

Figure CN117523070B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer graphics processing, and in particular to a computer graphics rendering method and system based on ray tracing. Background Art
[0002] Rendering is the process of generating images from models through software when drawing on a computer. A model is a description of a three-dimensional object or virtual scene that is strictly defined in a language or data structure. It includes information such as geometry, viewpoint, texture, lighting and shadow. An image is a digital image or a bitmap image. Rendering is used to generate the output process of the final video through the effects in computer video editing software. Rendering is one of the important research topics in three-dimensional computer graphics, and is closely related to other technologies in the practical field. In the graphics pipeline, rendering is the last important step, through which the final display effect of the model and animation is obtained. There are now various rendering tool products, some of which are integrated into larger modeling or animation, some are independent products, and some are open source products. From the inside, rendering tools are carefully designed programs based on theories of various disciplines, including optics, visual perception, digital and software development.
[0003] Pre-rendering or real-time rendering of 3D computer images is very slow. Pre-rendering is very computationally intensive and requires a lot of server computing to complete, and is usually used in movie production; real-time rendering is often used in 3D video games, and this process is usually completed through a graphics processing unit (GPU). The general computer rendering process pipeline design is mainly based on rasterization technology, which decomposes the image into a series of pixels, and then draws these pixels one by one on the computer screen to form a continuous image. In this process, the computer will fill each pixel with color, and perform depth sorting and occlusion elimination to ensure the realism and clarity of the image. However, rasterization technology has the following disadvantages:
[0004] 1) Low rendering efficiency: Rasterization requires color filling and depth sorting for each pixel, which is very computationally intensive. Therefore, the rendering efficiency of rasterization is relatively low. When processing complex scenes and high-resolution images, the speed of rasterization will become very slow, which may cause problems such as freezing or delay.
[0005] 2) Insufficient detail representation: Rasterization cannot perfectly represent some details and special effects, such as subtle textures, complex shadows and reflections, etc. These details need to be achieved through other image processing technologies, such as texture mapping, shadow mapping, etc., which will increase the complexity and computational effort of image rendering.
[0006] 3) Large memory consumption: Rasterization requires breaking down the image into a large number of pixels and storing and processing the data of these pixels in memory. This will take up a lot of memory space, especially when processing high-resolution images, the memory consumption will be more obvious.
[0007] 4) Difficulty in achieving physically accurate simulation: Rasterization focuses on the appearance and visual effects of images, but it is difficult to achieve physically accurate simulation. For example, in the rasterization process, it is difficult to take into account the physical properties of objects, such as the impact of factors such as material and weight on the image.
[0008] At present, with the improvement of computer hardware performance and the development of image processing technology, how to design and develop new computer graphics rendering technology is the main research direction in the field of computer graphics processing technology. Summary of the invention
[0009] The main technical problem solved by the present invention is how to improve computer rendering efficiency and rendering effect.
[0010] According to a first aspect, an embodiment provides a computer graphics rendering method based on ray tracing, comprising:
[0011] Obtaining rendering parameters; the rendering parameters include camera variables and rendering variables for ray tracing;
[0012] Constructing a ray tracing acceleration structure to obtain acceleration structure information; the ray tracing acceleration structure divides the geometric bodies in the scene to be rendered into different levels and maintains the parent-child relationship between each level, and the acceleration structure information is used to accelerate ray tracing and / or to test ray tracing visibility;
[0013] Acquire interaction state information of each of the geometric bodies in the scene to be rendered; the interaction state information is used to represent the selection, hiding, blurring and / or highlighting state information of the geometric body;
[0014] Applying a ray tracing algorithm to render the scene to be rendered according to the rendering parameters to generate rendering cache texture image data corresponding to each light source texture; each of the rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and / or acceleration structure information; the camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters, the camera transformation matrix includes camera displacement, rotation and scaling parameters, the perspective matrix is used to represent the projection mode of the camera on a two-dimensional screen, lens aperture radius and / or focal length parameters; the rendering parameters include rendering position, rendering size, shadow light offset and / or maximum light bounce times; the model geometry information includes vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered; the model matrix information includes displacement, rotation and / or scaling information of each geometric body in the scene to be rendered; the material mapping information includes material and mapping data of each geometric body;
[0015] Performing noise reduction processing on each of the rendering cache texture image data;
[0016] Performing color adjustment, cropping and / or correction on each of the rendering cache texture image data according to preset visual effects adjustment parameters;
[0017] Merging the rendering cache texture image data of each light source texture to obtain rendering texture image data;
[0018] The rendering texture image data is sampled according to preset display parameters to obtain a rendering result image, and output it as a rendering result.
[0019] In one embodiment, the ray tracing acceleration structure includes a top acceleration layer, a bottom acceleration layer, a geometry acceleration layer, and a primitive acceleration layer;
[0020] The top acceleration layer includes at least one top acceleration structure, the bottom acceleration layer includes bottom acceleration structures, and each bottom acceleration structure is a subset of a top acceleration structure in the top acceleration layer;
[0021] The primitive acceleration layer includes a primitive structure, and the primitive structure is a subset of a bottom-level acceleration structure in the bottom-level acceleration layer;
[0022] The geometric acceleration layer includes a geometric structure, which is a subset of one of the underlying acceleration structures in the underlying acceleration layer;
[0023] The acceleration structure information is used to mark the correspondence between each of the geometric bodies in the scene to be rendered and the ray tracing acceleration structure, so as to quickly locate, access and / or retrieve the geometric bodies to be rendered according to the acceleration structure information when applying the ray tracing algorithm to render the scene to be rendered.
[0024] In one embodiment, constructing a ray tracing acceleration structure includes:
[0025] When the geometric body in the scene to be rendered changes, the ray tracing acceleration structure is reconstructed, and updated acceleration structure information is obtained; the change in the geometric body includes a change in the position, quantity and / or type of the geometric body.
[0026] In one embodiment, the types of light source textures include direct light texture, indirect light texture, ambient light texture, shadow texture, depth texture, normal and material texture and / or motion texture; the direct light texture refers to the light that directly reaches the surface of the geometric body from the light source; the indirect light texture refers to the light obtained by multiple reflections and refractions; the ambient light texture refers to the light that illuminates the scene to be rendered; the shadow texture refers to the dark area or shadow area formed because the light is blocked by an obstruction; the depth texture refers to the distance from the light source to the surface of the geometric body for each light ray; the normal and material texture are used to determine the tangent direction of the curve or surface of the geometric body; the motion texture is used to record the position change information of any point of the geometric body in two adjacent frames of rendered images.
[0027] In one embodiment, the denoising process for each of the rendering cache texture image data includes:
[0028] The rendering cache texture image data of the direct light texture, indirect light texture and shadow texture are subjected to denoising processing respectively by a preset denoising algorithm.
[0029] In one embodiment, the visual effect adjustment parameters include grayscale processing, floor effect, mosaic, frosted glass effect, image fusion, picture mapping, edge detection and / or relief effect.
[0030] In one embodiment, sampling the rendered texture image data according to preset display parameters to obtain a rendered result image includes:
[0031] A preset deep learning algorithm is applied to obtain a new frame of rendering result image through the acquired continuous frame rendering result images to improve rendering efficiency.
[0032] In one embodiment, sampling the rendered texture image data according to preset display parameters to obtain a rendered result image includes:
[0033] When the image resolution of the preset display parameters is different from the resolution of the rendered texture image data, an interpolation algorithm, a subsampling algorithm or a bilinear interpolation algorithm is applied to sample the rendered texture image data to prevent the rendered result image from being deformed due to size stretching.
[0034] According to the second aspect, an embodiment provides a computer-readable storage medium, on which a program is stored, and the program can be executed by a processor to implement the method described in the first aspect.
[0035] According to a third aspect, an embodiment provides a computer graphics rendering system based on ray tracing, which is used to apply the computer graphics rendering method according to the first aspect, and the computer graphics rendering system includes:
[0036] A parameter acquisition module, used to acquire rendering parameters; the rendering parameters include camera variables and rendering variables used for ray tracing;
[0037] An acceleration structure building module, used to build a ray tracing acceleration structure to obtain acceleration structure information; the ray tracing acceleration structure divides the geometric bodies in the scene to be rendered into different levels and maintains the parent-child relationship between each level, and the acceleration structure information is used to accelerate ray tracing and / or for testing ray tracing visibility;
[0038] An interaction state acquisition module, used for acquiring interaction state information of each geometric body in the scene to be rendered; the interaction state information is used for indicating the selection, hiding, blurring and / or highlighting state information of the geometric body;
[0039] A rendering module, for applying a ray tracing algorithm to render the scene to be rendered according to the rendering parameters, so as to generate rendering cache texture image data corresponding to each light source texture; each of the rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and / or acceleration structure information; the camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters, the camera transformation matrix includes camera displacement, rotation and scaling parameters, the perspective matrix is used to represent the projection mode of the camera on a two-dimensional screen, lens aperture radius and / or focal length parameters; the rendering parameters include rendering position, rendering size, shadow light offset and / or maximum light bounce times; the model geometry information includes vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered; the model matrix information includes displacement, rotation and / or scaling information of each geometric body in the scene to be rendered; the material mapping information includes material and mapping data of each geometric body;
[0040] A denoising module, used for performing denoising processing on each of the rendering cache texture image data;
[0041] A post-processing module, used for coloring, cropping and / or correcting each of the rendering cache texture image data according to preset visual effects adjustment parameters;
[0042] An image acquisition module, used for merging the rendering cache texture image data of each light source texture to obtain rendering texture image data;
[0043] The image output module is used to sample the rendering texture image data according to preset display parameters to obtain a rendering result image and output it as a rendering result.
[0044] The computer graphics rendering method according to the above-mentioned embodiment is a rendering pipeline process designed entirely based on the principle of the ray tracing algorithm, which takes advantage of the ray tracing algorithm and breaks through the limitations of the traditional rasterization rendering process. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a schematic diagram of the principle of ray tracing technology;
[0046] Figure 2 A schematic diagram of a flow chart of a computer graphics rendering method in an embodiment;
[0047] Figure 3 A schematic diagram of a ray tracing acceleration structure in an embodiment;
[0048] Figure 4 A structural block diagram of a computer graphics rendering system in one embodiment. DETAILED DESCRIPTION
[0049] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0050] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0051] The serial numbers assigned to the components herein, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0052] Ray tracing is a method of simulating how light reacts in real life. It traces the path of light as it reaches an object, realistically simulating how the light bounces off to create accurate reflections, refractions, shadows, and indirect lighting. Figure 1 , which is a schematic diagram of the principle of ray tracing technology, specifically including:
[0053] 1. Send a ray V to each pixel and find the intersection point P with the scene;
[0054] 2. Calculate the direct illumination component Ic along V at point P;
[0055] 3. Find the reflection direction r of V and the intersection point Pr with other objects in the scene;
[0056] 4. Calculate the reflected light intensity Is along the r direction at the intersection point;
[0057] 5. Find the refraction direction t of V and the intersection point Pt with other objects in the scene;
[0058] 6. Calculate the reflected light intensity It along the t direction at the intersection;
[0059] 7. Apply the formula I = Ic + ks·Is + kt·It to calculate the total light intensity at point P.
[0060] In the prior art, ray tracing usually refers to a framework that is used in parallel with rasterization rendering and can solve the bottleneck of global information loss and global effect accuracy caused by rasterization. Figure 1 As shown, starting from the camera, a ray is projected for each pixel, intersecting with the first object in the scene, and the color of the intersection is calculated at the intersection according to the object properties, light source properties, and lighting model. Then at the focus, the light continues to turn green and reflect and refract, and this is done in sequence until the light reaches the light source or escapes the scene ray tracing, breaking down the rendering task of the scene. The rays are parallel and can obtain global information of a scene.
[0061] In the embodiments of the present application, the rendering pipeline process and architecture are redesigned completely based on the principles of the ray tracing algorithm, thereby improving the efficiency, realism and accuracy of scene rendering.
[0062] Embodiment 1:
[0063] Please refer to Figure 2 , is a flowchart of a computer graphics rendering method in an embodiment, the computer graphics rendering method is based on the algorithm and principle of ray tracing, and specifically includes:
[0064] Step 101, obtaining rendering parameters.
[0065] Each rendered frame can be understood as the camera acquiring the display changes of the 3D model in the scene. The display content of the display terminal (such as display size and display content) also has a limiting effect on the rendering parameters. Therefore, the rendering parameters include camera variables and rendering variables used for ray tracing. Camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters. The camera transformation matrix includes the displacement, rotation and scaling parameters of the camera. The perspective matrix is used to represent the projection method of the camera on the 2D screen, the lens aperture radius and / or focal length parameters. Rendering parameters include rendering position, rendering size, shadow light offset and / or maximum number of light bounces.
[0066] Step 102, obtaining acceleration structure information.
[0067] Build a ray tracing acceleration structure to obtain acceleration structure information. The ray tracing acceleration structure divides the geometry in the scene to be rendered into different levels and maintains the parent-child relationship between the levels. The acceleration structure information is used to accelerate ray tracing and / or test ray tracing visibility.
[0068] In one embodiment, the ray tracing acceleration structure includes a top acceleration layer, a bottom acceleration layer, a geometry acceleration layer, and a primitive acceleration layer. The top acceleration layer includes at least one top acceleration structure, the bottom acceleration layer includes a bottom acceleration structure, and each bottom acceleration structure is a subset of a top acceleration structure in the top acceleration layer. The primitive acceleration layer includes a primitive structure, which is a subset of a bottom acceleration structure in the bottom acceleration layer. The geometry acceleration layer includes a geometry structure, which is a subset of a bottom acceleration structure in the bottom acceleration layer. The acceleration structure information is used to mark the correspondence between each geometric body in the scene to be rendered and the ray tracing acceleration structure, so as to quickly locate, access and / or retrieve the geometry to be rendered based on the acceleration structure information when applying the ray tracing algorithm to render the scene to be rendered.
[0069] In one embodiment, when the geometry in the scene to be rendered does not change, it only needs to be constructed once. When the geometry in the scene to be rendered changes, the ray tracing acceleration structure is reconstructed and the updated acceleration structure information is obtained, wherein the geometry change includes the change in the position, quantity and / or type of the geometry. In one embodiment, the top acceleration layer is constructed based on the bottom acceleration layer, that is, the bottom acceleration layer is constructed first, and then the top acceleration layer is constructed.
[0070] Please refer to Figure 3 , is a structural schematic diagram of a ray tracing acceleration structure in an embodiment. The ray tracing acceleration structure can be represented as an organization representing the structural relationship of a model object. The model data comes from the model file data of the geometric body in the original scene to be rendered, and is constructed into an object organization with a hierarchical structure. The bottom layer acceleration structure is used to describe the set of geometric elements in the scene to be rendered, usually including elements such as bodies, faces, rings, edges, vertices, etc., which can be used to describe the shape, size, position and other features of the object. Each bottom layer acceleration structure can also include a combination of multiple geometric structures and multiple primitive structures. The geometric structure and the primitive structure are part of the attached bottom layer acceleration structure, which are combined into a complete bottom layer acceleration structure. The data buffer object is the geometric information required to store the model mesh object, including vertices, normals, indices and other information. The model mesh object can use the information in the data buffer object to describe the information of the model geometric features, including the starting position and size of the data read in each data buffer. In one embodiment, the ray tracing acceleration structure includes multiple top layer acceleration structures, and each top layer acceleration structure also establishes a parent-child relationship with multiple bottom layer acceleration structures.
[0071] The established ray tracing acceleration structure is used for acceleration and visibility testing during ray tracing operations, and it has universality, efficiency, and relevance. Among them, universality means that the constructed acceleration structure can be generally applied to ray tracing rendering scenes, efficiency means that the construction time is more than 10 times faster than that of conventional acceleration structures, and the memory usage is significantly reduced, and relevance means that the acceleration structure object and the model management object establish a relationship, which is helpful for subsequent application expansion.
[0072] Step 103: Obtain interaction status information.
[0073] Get the interactive state information of each geometric object in the scene to be rendered. The interactive state information is used to represent the selection, hiding, blurring and / or highlighting state information of the geometric object.
[0074] Step 104, rendering.
[0075] A ray tracing algorithm is applied to render the scene to be rendered according to the rendering parameters to generate rendering cache texture image data corresponding to each light source texture. Each rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and / or acceleration structure information. The camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters. The camera transformation matrix includes the displacement, rotation and scaling parameters of the camera. The perspective matrix is used to represent the projection mode of the camera on the two-dimensional screen, the lens aperture radius and / or focal length parameters. The rendering parameters include rendering position, rendering size, shadow light offset and / or maximum light bounce times. The model geometry information includes the vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered. The model matrix information includes the displacement, rotation and / or scaling information of each geometric body in the scene to be rendered. The material mapping information includes the material and mapping data of each geometric body. In one embodiment, the types of light source textures include direct light texture, indirect light texture, ambient light texture, shadow texture, depth texture, normal and material texture and / or motion texture. Direct light texture refers to the light that directly reaches the surface of the geometric body from the light source. Indirect light texture refers to the light obtained after multiple reflections and refractions. Ambient light texture refers to the light that illuminates the scene to be rendered. Shadow texture refers to the dark area or shadow area formed because the light is blocked by the occluder. Depth texture refers to the distance from the light source to the surface of the geometric body for each ray of light. Normal and material textures are used to determine the tangent direction of the curve or surface of the geometric body. Motion texture is used to record the position change information of any point of the geometric body in two adjacent frames of rendered images.
[0076] Step 105: noise reduction processing.
[0077] De-noising is performed on each rendering cache texture image data. In one embodiment, de-noising is performed on the rendering cache texture image data of the direct light texture, the indirect light texture and the shadow texture respectively by using a preset de-noising algorithm.
[0078] Step 106: image post-processing.
[0079] Each rendering cache texture image data is toned, cropped and / or corrected according to preset visual effect adjustment parameters, wherein the visual effect adjustment parameters include grayscale processing, floor effect, mosaic, frosted glass effect, image fusion, image mapping, edge detection and / or relief effect.
[0080] Step 107: image synthesis.
[0081] The rendering cache texture image data of each light source texture is merged to obtain rendering texture image data.
[0082] Step 108: output the rendering result.
[0083] The rendering texture image data is sampled according to the preset display parameters to obtain the rendering result image, and is output as the rendering result. When the image resolution of the preset display parameters is different from the resolution of the rendering texture image data, an interpolation algorithm, a subsampling algorithm or a bilinear interpolation algorithm is applied to sample the rendering texture image data to prevent the rendering result image from being deformed due to size stretching. In order to generate a display image that adapts to the terminal resolution, a preset sampling algorithm is used for processing so that the image will not be distorted due to size stretching, thereby reducing the rendering calculation amount. For example, a rendering image with a size of 1920*1080 can generate a display image of 3840*2160 through this process.
[0084] In one embodiment, a preset deep learning algorithm is applied to obtain a rendering result image of a new frame through the acquired continuous frame rendering result images to improve rendering efficiency.
[0085] The computer graphics rendering method disclosed in an embodiment of the present application is a rendering pipeline process designed entirely based on the principle of the ray tracing algorithm, which takes advantage of the ray tracing algorithm and breaks through the limitations of the traditional rasterization rendering process, so that the engine designed based on this architecture has the following characteristics:
[0086] 1. High fidelity.
[0087] Ray tracing calculates the pixel color of an image by simulating the path of light propagation in a scene. It can simulate the lighting effects in the real world very realistically.
[0088] 2. No pre-processing required.
[0089] Unlike traditional image rendering technology, ray tracing does not require pre-calculation of lighting or texture mapping of the scene. It can generate images directly from the camera position by tracing rays, so it can better handle complex scenes and lighting effects.
[0090] 3. Dynamic effects can be achieved.
[0091] Since ray tracing can calculate the pixel color of an image in real time, dynamic effects can be achieved, such as dynamic shadows, dynamic reflections, etc. These dynamic effects can improve the realism and interactivity of the scene, allowing users to be more immersed in the virtual scene.
[0092] 4. Strong scalability.
[0093] Ray tracing technology can increase the complexity and effect of the scene through expansion methods such as multiple light sources and multiple lenses. This scalability gives ray tracing a great advantage when dealing with large scenes and complex visual effects.
[0094] 5. Can be combined with physical models.
[0095] Ray tracing technology can be combined with physical models to simulate real-world physical phenomena by taking into account the physical properties of objects, such as material, weight, etc. This combination allows ray tracing to render realistic images while also supporting physically accurate simulations, such as object collisions, gravity effects, etc.
[0096] Please refer to Figure 4, is a structural block diagram of a computer graphics rendering system in an embodiment. In one embodiment of the present application, a computer graphics rendering system based on ray tracing is also disclosed, which is used to apply the computer graphics rendering method as described above. The computer graphics rendering system includes a parameter acquisition module 10, an acceleration structure building module 20, an interaction state acquisition module 30, a rendering module 40, a denoising module 50, a post-processing module 60, an image acquisition module 70 and an image output module 80. The parameter acquisition module 10 is used to obtain rendering parameters, and the rendering parameters include camera variables and rendering variables for ray tracing. The acceleration structure building module 20 is used to construct a ray tracing acceleration structure to obtain acceleration structure information. The ray tracing acceleration structure divides the geometric bodies in the scene to be rendered into different levels and maintains the parent-child relationship between each of the levels. The acceleration structure information is used to accelerate ray tracing and / or test the visibility of ray tracing. The interaction state acquisition module 30 is used to obtain the interaction state information of each geometric body in the scene to be rendered, and the interaction state information is used to represent the point selection, hiding, blurring and / or highlighting state information of the geometric body. The rendering module 40 is used to apply the ray tracing algorithm to render the scene to be rendered according to the rendering parameters to generate the rendering cache texture image data corresponding to each light source texture. Each rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and / or acceleration structure information. The camera variables include the camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters. The camera transformation matrix includes the displacement, rotation and scaling parameters of the camera. The perspective matrix is used to represent the projection mode of the camera on the two-dimensional screen, the lens aperture radius and / or focal length parameters. The rendering parameters include the rendering position, the rendering size, the shadow light offset and / or the maximum number of light bounces. The model geometry information includes the vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered. The model matrix information includes the displacement, rotation and / or scaling information of each geometric body in the scene to be rendered. The material mapping information includes the material and mapping data of each geometric body. The denoising module 50 is used to perform denoising on each rendering cache texture image data. The post-processing module 60 is used to adjust the color, crop and / or correct each rendering cache texture image data according to the preset visual effect adjustment parameters. The image acquisition module 70 is used to merge the rendering cache texture image data of each light source texture to obtain the rendering texture image data. The image output module 80 is used to sample the rendering texture image data according to the preset display parameters to obtain the rendering result image and output it as the rendering result.
[0097] The computer graphics rendering method disclosed in the embodiment of the present application first constructs a ray tracing acceleration structure based on rendering parameters and obtains the interactive state information of the geometric bodies in the scene to be rendered; then applies the ray tracing algorithm to render the scene to be rendered based on the rendering parameters to generate rendering cache texture image data corresponding to each light source texture; performs color adjustment, cropping and / or correction on the rendering cache texture image data after denoising; and finally samples the rendering cache texture image data merged with each light source texture to obtain the rendering result image. Since a ray tracing acceleration structure is constructed for the geometric bodies in the scene to be rendered, so as to quickly locate, access and retrieve the geometric bodies during the fiber tracing process, it can not only reduce the hardware requirements for ray tracing calculations, but also greatly improve the efficiency of ray tracing rendering.
[0098] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0099] The above specific examples are used to illustrate the present invention, which is only used to help understand the present invention and is not intended to limit the present invention. For those skilled in the art, according to the concept of the present invention, some simple deductions, modifications or substitutions can be made.
Claims
1. A computer graphics rendering method based on ray tracing, characterized in that: include: Get rendering parameters; The rendering parameters include camera variables and rendering variables for ray tracing; Build a ray tracing acceleration structure to obtain acceleration structure information; The ray tracing acceleration structure divides the geometry in the scene to be rendered into different levels and maintains the parent-child relationship between the levels. The acceleration structure information is used to accelerate ray tracing and / or to test ray tracing visibility. Acquire interaction state information of each of the geometric bodies in the scene to be rendered; the interaction state information is used to represent the selection, hiding, blurring and / or highlighting state information of the geometric body; Applying a ray tracing algorithm to render the scene to be rendered according to the rendering parameters to generate rendering cache texture image data corresponding to each light source texture; each of the rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and acceleration structure information; the camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters, the camera transformation matrix includes camera displacement, rotation and scaling parameters, the perspective matrix is used to represent the projection mode of the camera on a two-dimensional screen, lens aperture radius and / or focal length parameters; the rendering variables include rendering position, rendering size, shadow light offset and / or maximum light bounce times; the model geometry information includes vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered; the model matrix information includes displacement, rotation and / or scaling information of each geometric body in the scene to be rendered; the material mapping information includes material and mapping data of each geometric body; Performing noise reduction processing on each of the rendering cache texture image data; Performing color adjustment, cropping and / or correction on each of the rendering cache texture image data according to preset visual effects adjustment parameters; Merging the rendering cache texture image data of each light source texture to obtain rendering texture image data; Sampling the rendered texture image data according to preset display parameters to obtain a rendering result image, and outputting it as a rendering result; The ray tracing acceleration structure includes a top acceleration layer, a bottom acceleration layer, a geometric acceleration layer and a primitive acceleration layer; The top acceleration layer includes at least one top acceleration structure, the bottom acceleration layer includes bottom acceleration structures, each of the bottom acceleration structures is a subset of a top acceleration structure in the top acceleration layer; the bottom acceleration structure is used to describe a set of geometric elements in the scene to be rendered, the geometric elements include bodies, faces, rings, edges and vertices, and the geometric elements are used to describe the shape, size and position characteristics of an object; each bottom acceleration structure includes a combination of multiple geometric structures and multiple primitive structures; the geometric structures and the primitive structures are attached to a part of the bottom acceleration structure and are stored through a data buffer object; The data buffer object is used to store geometric information required by the model mesh object, and the geometric information includes vertex, normal and index information; wherein the model mesh object describes information of the geometric features of the model by using the information in the data buffer object, and the model mesh object includes the starting position and size of the data read in each data buffer; when the ray tracing acceleration structure includes multiple top-level acceleration layers, each of the top-level acceleration layers also establishes a parent-child relationship with multiple bottom-level acceleration layers; The primitive acceleration layer includes a primitive structure, and the primitive structure is a subset of a bottom-level acceleration structure in the bottom-level acceleration layer; The geometric acceleration layer includes a geometric structure, which is a subset of one of the underlying acceleration structures in the underlying acceleration layer; The acceleration structure information is used to mark the correspondence between each of the geometric bodies in the scene to be rendered and the ray tracing acceleration structure, so as to quickly locate, access and / or retrieve the geometric body to be rendered according to the acceleration structure information when the scene to be rendered is rendered by applying the ray tracing algorithm; The constructing of the ray tracing acceleration structure comprises: When the geometric body in the scene to be rendered changes, the ray tracing acceleration structure is reconstructed, and updated acceleration structure information is obtained; the change in the geometric body includes a change in the position, quantity and / or type of the geometric body.
2. The computer graphics rendering method according to claim 1, characterized in that: The types of light source textures include direct light texture, indirect light texture, ambient light texture, shadow texture, depth texture, normal and material texture and motion texture; the direct light texture refers to the light that directly reaches the surface of the geometric body from the light source; the indirect light texture refers to the light obtained by multiple reflections and refractions; the ambient light texture refers to the light that illuminates the scene to be rendered; the shadow texture refers to the dark area or shadow area formed because the light is blocked by an obstruction; the depth texture refers to the distance from the light source to the surface of the geometric body for each light ray; the normal and material texture are used to determine the tangent direction of the curve or surface of the geometric body; the motion texture is used to record the position change information of any point of the geometric body in two adjacent frames of rendered images.
3. The computer graphics rendering method according to claim 2, characterized in that: The performing noise reduction processing on each of the rendering cache texture image data comprises: The rendering cache texture image data of the direct light texture, indirect light texture and shadow texture are subjected to denoising processing respectively by a preset denoising algorithm.
4. The computer graphics rendering method according to claim 1, wherein: The visual effect adjustment parameters include grayscale processing, floor effect, mosaic, frosted glass effect, image fusion, picture mapping, edge detection and / or relief effect.
5. The computer graphics rendering method according to claim 1, characterized in that: The step of sampling the rendered texture image data according to preset display parameters to obtain a rendered result image includes: A preset deep learning algorithm is applied to obtain a new frame of rendering result image through the acquired continuous frame rendering result images to improve rendering efficiency.
6. The computer graphics rendering method according to claim 1, wherein: The step of sampling the rendered texture image data according to preset display parameters to obtain a rendered result image includes: When the image resolution of the preset display parameters is different from the resolution of the rendered texture image data, an interpolation algorithm, a subsampling algorithm or a bilinear interpolation algorithm is applied to sample the rendered texture image data to prevent the rendered result image from being deformed due to size stretching.
7. A computer-readable storage medium, characterized in that: The medium stores a program, which can be executed by a processor to implement the computer graphics rendering method according to any one of claims 1 to 6.
8. A computer graphics rendering system based on ray tracing, characterized in that: Used to apply the computer graphics rendering method according to any one of claims 1 to 6, the computer graphics rendering system comprising: A parameter acquisition module, used to acquire rendering parameters; the rendering parameters include camera variables and rendering variables used for ray tracing; An acceleration structure building module, used to build a ray tracing acceleration structure to obtain acceleration structure information; the ray tracing acceleration structure divides the geometric bodies in the scene to be rendered into different levels and maintains the parent-child relationship between each level, and the acceleration structure information is used to accelerate ray tracing and / or for testing ray tracing visibility; An interaction state acquisition module, used for acquiring interaction state information of each geometric body in the scene to be rendered; the interaction state information is used for indicating the selection, hiding, blurring and / or highlighting state information of the geometric body; A rendering module, for applying a ray tracing algorithm to render the scene to be rendered according to the rendering parameters, so as to generate rendering cache texture image data corresponding to various light source textures; each of the rendering cache texture image data includes camera variables, rendering variables, model geometry information, model matrix information, material mapping information and acceleration structure information; the camera variables include camera transformation matrix, perspective matrix, lens aperture radius and / or focal length parameters, the camera transformation matrix includes camera displacement, rotation and scaling parameters, the perspective matrix is used to represent the projection mode of the camera on a two-dimensional screen, lens aperture radius and / or focal length parameters; the rendering variables include rendering position, rendering size, shadow light offset and / or maximum light bounce times; the model geometry information includes vertex coordinates and / or normal parameters of each geometric body in the scene to be rendered; the model matrix information includes displacement, rotation and / or scaling information of each geometric body in the scene to be rendered; the material mapping information includes material and mapping data of each geometric body; A denoising module, used for performing denoising processing on each of the rendering cache texture image data; A post-processing module, used for coloring, cropping and / or correcting each of the rendering cache texture image data according to preset visual effects adjustment parameters; An image acquisition module, used for merging the rendering cache texture image data of each light source texture to obtain rendering texture image data; The image output module is used to sample the rendering texture image data according to preset display parameters to obtain a rendering result image and output it as a rendering result.
