A Real-time Global Illumination Rendering Method for a Virtual Cable Tunnel Scenario Model
The method optimizes global illumination rendering in virtual cable tunnel scenes using kd-trees and GPU processing, addressing efficiency challenges and enhancing realism in virtual and augmented reality systems.
Patent Information
- Application Number
- CN202110039027.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-12
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-01-12
AI Technical Summary
The prior art has not yet effectively solved the problems of low real-time global lighting rendering efficiency and high time cost of virtual cable tunnel scene models.
A real-time global lighting rendering method for virtual cable tunnel scene model is adopted, including calculating the light source position and radiation intensity, using the kd-tree data structure to store the material properties of the three-dimensional scene model, and ray tracing and screen rendering are realized through GPU parallel processing.
Real-time global lighting rendering of the three-dimensional scene model of virtual cable tunnel is realized, which improves the efficiency of rendering algorithms and reduces time costs. It is suitable for fields such as virtual reality, augmented reality and mixed reality.
Smart Images

Figure CN112734892B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of lighting rendering. Specifically, it relates to a method for real-time global illumination rendering of a virtual cable tunnel scene model. Background Art
[0002] In recent years, with the rapid development of virtual reality technology, the real-time global illumination rendering technology applied to virtual roaming scenes has also developed rapidly. Global illumination rendering is a core content in computer graphics. Its main task is to generate a realistic image from a pre-organized three-dimensional scene model, so that users can have a more immersive experience when roaming in the virtual scene. To achieve this goal, we must simulate various physical phenomena that occur when light propagates in the scene, such as reflection, shadow, caustics, etc. The process of simulating ray tracing for global illumination rendering not only requires an accurate description of the virtual camera parameters, the geometric shapes, materials, textures of each object in the entire scene, and the light sources, but also needs to face the huge computational amount brought by multiple reflections and refractions of light.
[0003] In order to improve the efficiency of the global illumination rendering algorithm and reduce the time cost. After decades of development, there are now multiple implementation directions for global illumination. The common main schools of global illumination include ray tracing, path tracing, radiosity, etc. Each school can be further divided into various improved or derivative algorithms. For example, ray tracing can be divided into recursive ray tracing, distributed ray tracing, Monte Carlo ray tracing, etc. The path tracing school can be divided into Monte Carlo path tracing, bidirectional path tracing, energy redistribution path tracing, etc. The radiosity algorithm treats all object surfaces in the scene as diffuse reflection surfaces, collects all the color information visible at each position in the scene, and then summarizes and processes this color information as the final color at that position and colors the current position. If the entire scene is divided into smaller and smaller parts, the resulting final illumination effect will be better, but the accompanying cost is longer rendering time. The basic idea of path tracing is to emit a ray from the viewpoint. When the ray intersects the object surface, continue to sample a direction according to the material properties of the surface and emit another ray. This iteration continues until the ray hits the light source (or escapes the scene), and then the Monte Carlo method is used to calculate its contribution as the color value of the pixel. Path tracing is achieved by introducing the Monte Carlo method during the ray tracing process, and its algorithm efficiency and complexity are much higher than that of ray tracing. The main idea of ray tracing is to emit a ray from the viewpoint to the pixel on the imaging plane, find the intersection point of the nearest object intersected by the ray. If the surface at this point is a scattering surface, calculate the color generated by the direct illumination of the light source on this point; if the surface at this point is a specular or refractive surface, continue to trace another ray in the reflection or refraction direction. This recursion continues until the ray escapes the scene or reaches the set maximum recursion depth. This algorithm has a very good illumination effect for handling various materials such as scattering, refraction, and reflection on the object surface, and the running efficiency is also very high.
[0004] In response to the problems in the related art, no effective solution has been proposed yet. Summary of the Invention
[0005] In response to the above technical problems in the related art, the present invention proposes a real-time global illumination rendering method for a virtual cable tunnel scene model, which can realize the real-time global illumination rendering of a three-dimensional scene model of a virtual cable tunnel, effectively improve the efficiency of the global illumination rendering algorithm, and reduce the time cost.
[0006] To achieve the above technical objectives, the technical solution of the present invention is realized as follows:
[0007] A real-time global illumination rendering method for a virtual cable tunnel scene model includes the following steps:
[0008] S1 Use a computer to load the panoramic image data and three-dimensional scene model of the cable tunnel scene;
[0009] S2 uses the panoramic image data to calculate the position and radiation intensity of the light source in the three-dimensional scene model, and then obtains the material properties of the three-dimensional scene model;
[0010] S3 reads in the triangular facets of the three-dimensional scene model;
[0011] S4 tracks the light emitted from the viewpoint to the screen pixel, and determines whether the light intersects with the triangle face. If so, the color value of the intersection is calculated as the color value of the screen pixel according to the material properties of the intersection. If not, the background color is filled into the screen pixel, thereby completing the real-time global illumination rendering of the screen image to obtain a realistic screen image.
[0012] Furthermore, the calculating of the position and radiation intensity of the light source in the three-dimensional scene model by using the panoramic image data in S2 specifically includes:
[0013] S21 converts the low dynamic range panoramic image including three channels of R, G, and B in the panoramic image data into a high dynamic range radiance map through inverse color scale mapping;
[0014] S22 calculates the average value and variance of the three channels R, G, and B in the radiance map, and then calculates the threshold value;
[0015] S23 generates a single-channel mask with the same width and height as the panoramic image. If the three-channel radiance values of a certain pixel are all higher than the threshold, the pixel at the corresponding position of the single-channel mask is set to white, otherwise it is set to black, and then the white pixels in the lower half of the single-channel mask are removed, and then a breadth-first search is performed to determine the connectivity of the white pixels, and the position of the light source in the panoramic image is obtained, and then the position of the light source in the three-dimensional scene model is calculated;
[0016] S24 calculates the irradiance of the light source according to the number of pixels, the panoramic image, the radiance map, and the panoramic image solid angle.
[0017] Furthermore, the material properties of the three-dimensional scene model obtained in S2 specifically include:
[0018] S25 utilizes the interactive properties between the object surface and the light source, obtains the material properties of the three-dimensional scene model according to the material comparison table, and stores it as a material file.
[0019] Furthermore, the S3 specifically includes:
[0020] S31 reads in the 3D points, 3D point normal vectors, point textures, and triangular facets of the 3D scene model, and reads in the material properties of each triangular facet from the material file;
[0021] S32 calculates the maximum range of the three-dimensional scene model and encloses the entire three-dimensional scene model with an axially symmetric cuboid bounding box;
[0022] S33 divides the cuboid bounding box according to a tree data structure and stores the triangular patches of the three-dimensional scene model in the tree data structure.
[0023] Further, the S33 specifically includes:
[0024] Based on the SAH strategy, the entire cuboid bounding box is divided according to a tree data structure, the tree data structure is a kd-tree, and the triangular patches of the three-dimensional scene model are stored in the leaf nodes of the kd-tree.
[0025] Further, in the S4, the background color is black.
[0026] Further, in the S4, the real-time global illumination rendering of the screen image is completed by using the GPU parallel processing method.
[0027] Further, the specific steps of obtaining the realistic screen image in the S4 include:
[0028] When the viewpoint position and orientation change, the real-time global illumination rendering of the screen image is performed again.
[0029] The beneficial effects of the present invention: It can realize the real-time global illumination rendering of the virtual cable tunnel three-dimensional scene model, effectively improve the efficiency of the global illumination rendering algorithm, reduce the time cost, this method has practical value in computer graphics, and it can be popularized and used in the fields of virtual reality / augmented reality, mixed reality, reverse engineering, etc. It has the advantages of low algorithm complexity and high rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0031] Figure 1 is a flowchart of the method for real-time global illumination rendering of the virtual cable tunnel scene model according to the embodiment of the present invention;
[0032] Figure 2 is a ray tracing schematic diagram when calculating the color value of a single screen pixel according to the embodiment of the present invention;
[0033] Figure 3 It stores the light ray schematic diagram according to the binary tree data structure described in the embodiments of the present invention. Detailed implementation manners
[0034] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present invention.
[0035] As Figures 1 - 3 shown, a real-time global illumination rendering method for a virtual cable tunnel scene model according to the embodiments of the present invention includes the following steps:
[0036] S1 Use a computer to load the panoramic image data and three-dimensional scene model of the cable tunnel scene;
[0037] S2 Calculate the position and radiation intensity of the light source in the three-dimensional scene model by using the panoramic image data, and then obtain the material properties of the three-dimensional scene model;
[0038] S3 Read in the triangular patches of the three-dimensional scene model;
[0039] S4 Trace the light rays emitted from the viewpoint to the screen pixels, and determine whether the light rays intersect with the triangular patches. If they intersect, calculate the color value of the intersection point as the color value of the screen pixel according to the material properties of the intersection point. If they do not intersect, fill the background color into the screen pixel, thereby completing the real-time global illumination rendering of the screen image to obtain a realistic screen image.
[0040] In a specific embodiment of the present invention, the specific steps of calculating the position and radiation intensity of the light source in the three-dimensional scene model by using the panoramic image data in S2 include:
[0041] S21 Convert the low-dynamic range panoramic image including the R, G, and B channels in the panoramic image data into a high-dynamic range radiance map through inverse tone mapping;
[0042] S22 Calculate the average value and variance of the R, G, and B channels in the radiance map, and then calculate the threshold value;
[0043] S23 generates a single-channel mask with the same width and height as the panoramic image. If the radiance values of the three channels of a certain pixel are all higher than the threshold, the pixel at the corresponding position of the single-channel mask is set to white; otherwise, it is set to black. Then, the white pixels in the lower half of the single-channel mask are removed, and then breadth-first search is performed to determine the connectivity of the white pixels, obtaining the position of the light source in the panoramic image, and further calculating the position of the light source in the three-dimensional scene model;
[0044] S24 calculates the irradiance of the light source according to the number of pixels, the panoramic image, the radiance map, and the solid angle of the panoramic image.
[0045] In a specific embodiment of the present invention, the material properties of the three-dimensional scene model obtained in S2 specifically include:
[0046] S25 utilizes the interaction property between the object surface and the light source, obtains the material properties of the three-dimensional scene model according to the material comparison table, and stores them as a material file.
[0047] In a specific embodiment of the present invention, S3 specifically includes:
[0048] S31 reads in the three-dimensional points, three-dimensional point normal vectors, point textures, and the triangular patches of the three-dimensional scene model, and reads in the material properties of each triangular patch from the material file;
[0049] S32 calculates the maximum range of the three-dimensional scene model, and uses an axisymmetric cuboid bounding box to enclose the entire three-dimensional scene model;
[0050] S33 divides the cuboid bounding box according to a tree data structure, and stores the triangular patches of the three-dimensional scene model in the tree data structure.
[0051] In a specific embodiment of the present invention, S33 specifically includes:
[0052] Based on the SAH strategy, the entire cuboid bounding box is divided according to a tree data structure, the tree data structure is a kd-tree, and the triangular patches of the three-dimensional scene model are stored in the leaf nodes of the kd-tree.
[0053] In a specific embodiment of the present invention, in S4, the background color is black.
[0054] In a specific embodiment of the present invention, in S4, the real-time global illumination rendering of the screen image is completed by using the GPU parallel processing method.
[0055] In a specific embodiment of the present invention, the obtaining of the realistic screen image in S4 specifically includes:
[0056] When the viewpoint position and orientation change, the screen image is re - rendered with real - time global illumination.
[0057] To facilitate the understanding of the above - mentioned technical solution of the present invention, the following provides a detailed description of the above - mentioned technical solution of the present invention through specific usage methods.
[0058] The method for real - time global illumination rendering of the virtual cable tunnel scene model according to the present invention first calculates the accurate position and actual irradiance of the light source in the three - dimensional model using panoramic image data, secondly uses the kd - tree data structure to store the triangular patches of the three - dimensional model and their corresponding material properties, then traces the light rays emitted from the viewpoint to the screen, simulates the traveling process of the light rays in the scene based on the physical rules of the real world, and finally uses GPU acceleration to real - time render the visible part of the three - dimensional scene model on the screen, achieving the purpose of the user's roaming in the virtual cable tunnel scene. It specifically includes the following steps:
[0059] Step 1: Use a computer to load the panoramic image data of the cable tunnel scene and the three - dimensional scene model of the corresponding virtual cable tunnel scene.
[0060] Step 2: Convert the low - dynamic - range panoramic image containing the R, G, and B channels in the panoramic image data into a high - dynamic - range radiance map through inverse tone mapping , and the conversion formula is:
[0061] (1)
[0062] (2)
[0063] (3)
[0064] Among them, is the input brightness value, is the proportionality coefficient.
[0065] Step 3: Calculate the average value of the R, G, and B channels in the radiance map and the variance , and calculate the threshold , and the calculation formula is
[0066] (4)
[0067] Step 4: Generate a single-channel mask with the same width and height as the panoramic image. If the radiance values of the three channels of a pixel are all higher than the threshold, then this pixel is considered to be part of the light source, and the pixel at the corresponding position in the single-channel mask is set to white; otherwise, it is set to black. Since indoor light sources are generally located on the ceiling, first remove the white pixels belonging to the light source in the lower half of the single-channel mask, and then perform a breadth-first search to determine the connectivity of the white pixels, obtain the position of the light source in the panoramic image, and further calculate the position of the light source in the three-dimensional scene model.
[0068] Step 5: Let the solid angle of the panoramic image be , the number of pixels be N, and calculate the irradiance of the light source. The calculation formula is
[0069] (5)
[0070] (6)
[0071] where is the contribution of each pixel to the irradiance of the light source.
[0072] Step 6: The material of an object is manifested as the interaction property between the object surface and light. Obtain the material attributes of the three-dimensional scene model according to the material comparison table and store them as a material file.
[0073] Step 7: Read in the three-dimensional points v, three-dimensional point normal vectors vn, point textures vt, and triangular meshes f of the three-dimensional scene model, and read in the material attributes of each triangular mesh from the material file. Among them, both the three-dimensional points v and the three-dimensional point normal vectors vn are three-dimensional vectors, the point texture vt is a two-dimensional vector representing the coordinates of the point texture in the texture map, and the triangular mesh f is a three-dimensional vector containing the information of three points in a triangular mesh.
[0074] Step 8: Calculate the maximum range of the three-dimensional scene model, and use an axisymmetric cuboid bounding box to enclose the entire three-dimensional scene model. The calculation formula of the cuboid bounding box is
[0075] (7)
[0076] where the coordinates of the cuboid bounding box on the axis are respectively , represents the maximum and minimum coordinate values of the cuboid bounding box on the axis, represents the maximum and minimum coordinate values of the cuboid bounding box on the axis, represents the maximum and minimum coordinate values of the cuboid bounding box on the axis. respectively represent the coordinates of the three-dimensional point v on the axis, where i = 0, 1, …, m, and m represents the number of three-dimensional points v.
[0077] Step 9: Divide the entire cuboid bounding box according to the SAH strategy by using a kd-tree. The kd-tree uses axis-aligned sub-planes to divide the entire space in the k-dimensional space time after time, stores the triangular patch f in the leaf nodes of the kd-tree, and the triangular patch f in the non-leaf nodes is empty. Finally, a kd-tree data structure containing all the triangular patches f is obtained.
[0078] When performing kd-tree division based on the SAH strategy, assume that for the space S, a dissection plane P is selected to divide the space into two sub-spaces SL and SR on the left and right. At the same time, the triangular patches in the three-dimensional scene model are divided into two sets NL and NR. Then the SAH optimization function formula is
[0079] (8)
[0080] where node refers to the current space node, represents the surface area of the space S, represents the intersection cost of the ray with each triangular patch, represents the cost of the ray traversing the current node. When is the smallest, each node is divided, and the division is terminated when any of the following conditions is met:
[0081] 1) The depth of the current node exceeds a preset threshold D, where D is greater than or equal to 1 and is an integer;
[0082] 2) The number of triangular patch formats in the current node is less than a preset threshold TN, where TN is greater than or equal to 0 and is an integer less than 20.
[0083] Step 10: Set the viewpoint as the starting point start of the ray, the screen size is H and W, and there are a total of H * W pixels.
[0084] Step 11: For each pixel in the screen image, a ray R is emitted from the viewpoint through the center of the screen pixel towards the three-dimensional scene model, and it is determined whether it intersects with the triangular patches in the three-dimensional scene model. Among them, the kd-tree data structure and the cuboid bounding box can accelerate the determination of whether the ray intersects with the triangular patches in the three-dimensional scene model and reduce the number of intersection point calculations.
[0085] Step 12: If the ray Ray intersects with the triangular patch closest to the viewpoint in the scene at point P, assume the general equation of the triangular patch is , where is the normal vector of the triangular patch; Substitute the intersection point into the general equation of the triangular patch for solution , and then calculate the value of the intersection point P. According to the material properties of the intersection point P, calculate the color value of the intersection point P as the color value of this screen pixel; The light intensity contribution includes three aspects: 1) The local light intensity contribution of the light source to P ; 2) The light intensity contribution along the specular reflection direction R at the intersection point P ; 3) The light intensity contribution along the transmission direction T at the intersection point P ; The color value of the intersection point P The calculation formula is
[0086] (9)
[0087] where is the reflection coefficient at the intersection point P, is the refraction coefficient at the intersection point P, and the light source intensity is represented by the light source irradiance . The reflected ray R and the refracted ray T are stored using the binary tree data structure shown in Figure 3 .
[0088] Step 13: If the ray Ray does not intersect with the triangular patch, fill the current pixel with the background color, and the background color is set to black.
[0089] Step 14: The ray tracing for each screen pixel in the screen is independent. Use the GPU to parallelize Steps 11 to 13 to accelerate the real-time global illumination rendering of the screen image. The pseudocode for ray tracing is
[0090] RayTracing(start, direction, weight, color)
[0091] / * For each pixel point, when RayTracing() is called for the first time, the starting point start is the viewpoint, the direction is the ray direction from the viewpoint to the center of a certain pixel point, the weight is the attenuation weight value of the light intensity, and the color is the color of this pixel * /
[0092] {
[0093] if (weight < MinWeight)
[0094] color = black;
[0095] else
[0096] {
[0097] Calculate the point closest to start among the intersection points of the ray with all triangular facets;
[0098] if (There is no intersection point)
[0099] color = black;
[0100] else
[0101] {
[0102] Ilocal = Calculate the light intensity using the local illumination model at the intersection point;
[0103] Calculate the reflection direction R;
[0104] RayTracing(the closest intersection point, R, weight*Wr, Ir);
[0105] Calculate the refraction direction T;
[0106] RayTracing(the closest intersection point, T, weight*Wt, It);
[0107] color = Ilocal + kr*Ir + kt*It;
[0108] }
[0109] }
[0110] }
[0111] Step 15. When the user's viewpoint position and orientation change, re - perform real - time global illumination rendering on the screen image to obtain a realistic image in real time.
[0112] In summary, by means of the above - mentioned technical solutions of the present invention, real - time global illumination rendering of the virtual cable tunnel three - dimensional scene model can be achieved, effectively improving the efficiency of the global illumination rendering algorithm, reducing the time cost. This method has practical value in computer graphics and can be popularized and used in fields such as virtual reality / augmented reality, mixed reality, reverse engineering, etc. It has the advantages of low algorithm complexity and high rendering efficiency.
[0113] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A real-time global illumination rendering method for a virtual cable tunnel scene model, characterized in that, The following steps are involved: S1 uses a computer to load the panoramic image data and three-dimensional scene model of the cable tunnel scene; S2 uses the panoramic image data to calculate the position and radiation intensity of the light source in the three-dimensional scene model, and then obtains the material properties of the three-dimensional scene model; The calculation of the position and radiation intensity of the light source in the three-dimensional scene model by using the panoramic image data in S2 specifically includes: S21 converts the low dynamic range panoramic image including three channels of R, G, and B in the panoramic image data into a high dynamic range radiance map through inverse color scale mapping; S22 calculates the average value and variance of the three channels R, G, and B in the radiance map, and then calculates the threshold value; S23 generates a single-channel mask with the same width and height as the panoramic image. If the three-channel radiance values of a certain pixel are all higher than the threshold, the pixel at the corresponding position of the single-channel mask is set to white, otherwise it is set to black, and then the white pixels in the lower half of the single-channel mask are removed, and then a breadth-first search is performed to determine the connectivity of the white pixels, and the position of the light source in the panoramic image is obtained, and then the position of the light source in the three-dimensional scene model is calculated; S24, calculating the irradiance of the light source according to the number of pixels, the panoramic image, the radiance map, and the panoramic image solid angle; S3 reads in the triangular facets of the three-dimensional scene model; S4 tracks the light emitted from the viewpoint to the screen pixel, and determines whether the light intersects with the triangle face. If so, the color value of the intersection is calculated as the color value of the screen pixel according to the material properties of the intersection. If not, the background color is filled into the screen pixel, thereby completing the real-time global illumination rendering of the screen image to obtain a realistic screen image.
2. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 1, characterized in that The material attributes of the three-dimensional scene model obtained in S2 specifically include: S25 utilizes the interactive properties between the object surface and the light source, obtains the material properties of the three-dimensional scene model according to the material comparison table, and stores it as a material file.
3. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 1, wherein The S3 specifically includes: S31 reads in the 3D points, 3D point normal vectors, point textures, and triangular facets of the 3D scene model, and reads in the material properties of each triangular facet from a material file; S32 calculates the maximum range of the three-dimensional scene model, and uses an axisymmetric rectangular bounding box to enclose the entire three-dimensional scene model; S33 divides the cuboid bounding box according to a tree data structure, and stores the triangular facets of the three-dimensional scene model in the tree data structure.
4. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 3, wherein The S33 specifically includes: Based on the SAH strategy, the entire rectangular bounding box is divided according to a tree data structure, the tree data structure is a kd-tree, and the triangular facets of the three-dimensional scene model are stored in the leaf nodes of the kd-tree.
5. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 1, wherein In S4, the background color is black.
6. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 1, wherein In the S4, the real-time global illumination rendering of the screen image is completed by GPU parallel processing.
7. The real-time global illumination rendering method for the virtual cable tunnel scene model according to claim 1, wherein The step of obtaining a realistic screen image in S4 specifically includes: When the viewpoint position and orientation change, re - perform real - time global illumination rendering on the screen image.
Citation Information
Patent Citations
Ray tracing method based on GPU
CN106776028A