A real-time dynamic rendering method based on multi-layer light ray tracing and cache cooperation
By combining multi-layer ray tracing and caching, and integrating software and hardware ray tracing, the lighting calculation and memory management were optimized, solving the lighting problem of real-time dynamic rendering of energy plants and achieving efficient and realistic lighting effects.
Patent Information
- Application Number
- CN202511156629.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-19
AI Technical Summary
Existing technologies struggle to achieve real-time, high-quality lighting rendering for energy plants. Traditional global illumination methods are computationally expensive, and dynamic lighting changes can lead to incorrect lighting states. Therefore, existing methods cannot achieve high-quality dynamic lighting effects.
It employs a real-time dynamic rendering method that combines multi-layer ray tracing and caching, integrating software and hardware ray tracing. It processes static and dynamic objects through a hybrid ray tracing mode, utilizes global distance field and hardware acceleration capabilities to optimize lighting calculations, employs virtual paging technology to manage memory, uses adaptive probes to collect indirect lighting information, and incrementally updates the cache to balance performance and image quality.
It enables real-time, high-quality lighting rendering of energy plant scenes, improves the real-time and dynamic nature of rendering, optimizes memory usage, reduces hardware resource requirements, and ensures natural and realistic lighting effects.
Smart Images

Figure CN120747329B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of three-dimensional rendering of energy field stations, in particular to a real-time dynamic rendering method based on multi-layer light ray tracing and cache cooperation. BACKGROUND
[0002] Energy field stations (such as wind farms, photovoltaic power stations, oil drilling platforms, etc.) usually contain complex dynamic equipment and environment, and need to render the influence of real-time lighting changes (such as day and night alternation, weather changes) on equipment. In the field of computer graphics, it has always been an important research goal to achieve realistic lighting effects, and in the three-dimensional management and monitoring of energy field stations, real-time and high-quality lighting rendering is crucial for accurately simulating and evaluating environmental lighting conditions, equipment layout, and safety monitoring.
[0003] In the prior art, traditional global lighting methods have many limitations. In the past, global lighting in most games was mainly handled through an offline process called "light map baking", which has a very high computational cost and is difficult to achieve real-time calculation. Using CPU Lightmass or GPU Lightmass for light map baking can provide high-quality static lighting, but the construction time is long, which severely limits the dynamic nature of three-dimensional rendering. Moreover, any operation that significantly changes indirect lighting will cause errors in the lighting state. To meet the needs of dynamic scenes, some methods rely on low-quality lighting based on irradiance probes and approximate global lighting effects such as ambient occlusion. However, these methods cannot achieve the quality comparable to baked lighting. Therefore, the present application proposes a real-time dynamic rendering method based on multi-layer light ray tracing and cache cooperation to solve the problems mentioned above. SUMMARY
[0004] The present application aims to provide a real-time dynamic rendering method based on multi-layer light ray tracing and cache cooperation to solve the problems mentioned in the background.
[0005] To solve the above technical problems, the technical solution adopted by the present application is:
[0006] A real-time dynamic rendering method based on multi-layer light ray tracing and cache cooperation, comprising the following steps:
[0007] Step 1, convert the scene grid of the energy field station into a voxelized grid, and generate a global distance field (SDF), and generate grid surface data at the same time;
[0008] Step 2, combine a hybrid light ray tracing mode containing software light ray tracing (based on SDF) and hardware light ray tracing (based on triangle geometry) to process static and dynamic objects respectively, balance the calculation accuracy and performance, and perform initial lighting sampling;
[0009] Step 3, capture the scene surface material properties, store as a texture atlas, and manage memory through virtual paging to reduce redundant calculations and pre-capture static lighting information;
[0010] Step 4, deploy adaptive probes in screen space and world space to collect indirect lighting information, optimize lighting calculation efficiency through importance sampling, and optimize the distribution of indirect lighting and noise suppression;
[0011] Step 5, use an incremental update mechanism to dynamically update the surface cache and radiation cache based on a priority queue, adjust the refresh frequency according to visibility and timestamp, and prioritize refreshing high-frequency visible areas;
[0012] Step 6, select the ray tracing mode according to the hardware capability, fuse direct light, indirect light and cache data, output the final rendering frame, and ensure the balance of performance and picture quality under different configurations.
[0013] The further improvement of the technical scheme of the application is that the step 1 specifically comprises:
[0014] The scene grid of the energy field station is imported into the graphics engine, the vertices, facets, materials and texture coordinates are parsed, the grid unit consistency is checked, the coordinate system is ensured to match the engineering requirements, and topological optimization and degenerate triangle filtering are performed.
[0015] The KD-Tree acceleration structure is used to divide the grid space, and the voxelized grid of the energy field station is generated, the center point coordinates of each voxel unit of the voxelized grid are calculated, the KD-Tree is used to query the nearest surface point, if the distance is less than half of the diagonal length of the voxel, it is marked as an internal voxel, and each voxel unit stores spatial coordinates and geometric association information, wherein the partition axis is selected based on the surface area heuristic (SAH) to divide the grid space, and the leaf nodes of the KD-Tree store the triangle index list, and the internal nodes store the partition plane information, so as to accelerate the subsequent nearest surface query of voxelization;
[0016] Based on the voxel center points of the voxelized grid, the distance from each point to the nearest grid surface is calculated to generate a global distance field (SDF), and a hierarchical optimization method is used to optimize the storage structure of the global distance field to improve the query efficiency and reduce the memory occupation;
[0017] A mesh surface data (Mesh Card) is generated for each grid to record the material properties, lighting sampling position and direction information of the grid surface, which is used for subsequent lighting calculation and provides accurate spatial query basis.
[0018] The further improvement of the technical scheme of the present application is that the step 2 specifically comprises:
[0019] The three-dimensional scene of the energy station is analyzed, static objects and dynamic objects are distinguished, and light tracing modes are assigned according to the characteristics of the objects: static objects use software light tracing (based on global distance field (SDF)), and dynamic objects use hardware light tracing;
[0020] For static objects, initial light sampling is performed using software light tracing technology based on global distance field, and for dynamic objects, hardware light tracing based on triangle geometry is enabled, and the hardware acceleration capability of the RTX card is used to perform high-precision reflection and dynamic grid rendering, to ensure that the lighting effect of the dynamic objects is real and efficient;
[0021] The lighting data obtained by software light tracing and hardware light tracing is integrated, for each pixel, the lighting contribution from static objects (software light tracing) and dynamic objects (hardware light tracing) is combined to generate a unified lighting sampling result, seamlessly fusing the lighting data of the two modes.
[0022] The further improvement of the technical scheme of the present application is that the step 3 specifically comprises:
[0023] For each grid surface in the scene of the energy station, its material properties are captured, including albedo, normal, self-luminous and other key information, and the scene is divided into MxM uniform units, each unit stores the material of a grid, and then the material properties are encoded into a texture atlas, that is, a plurality of small textures are combined into a large texture atlas, to reduce the overhead of texture switching, wherein each unit of the texture atlas corresponds to the material properties of a grid surface, and the material properties are stored in the atlas through UV mapping;
[0024] Virtual paging technology is adopted to divide the texture atlas into a plurality of virtual pages, each page containing part of the texture data;
[0025] Using the captured material properties and the texture atlas, light calculation is performed on the scene at a plurality of preset viewing angles, static lighting information is pre-calculated, and the calculation result of the static lighting information is stored as a lighting cache, to ensure that the pre-captured lighting information can be quickly loaded at runtime.
[0026] The further improvement of the technical scheme of the present application is that the process of dividing the texture atlas into a plurality of virtual pages by using virtual paging technology is:
[0027] Based on the merged texture atlas, UV mapping is used to assign UV coordinates to each mesh surface, ensuring that its material properties can be correctly stored in the texture atlas, and through a virtual paging technique, combined with the memory capacity and rendering requirements, the size of each virtual page is determined, and then the texture atlas is divided into multiple virtual pages, each page contains part of the texture data, and there can be overlapping areas between pages to avoid boundary problems;
[0028] An index is created for each virtual page to record its location and range in the texture atlas, and metadata is stored for each page, including the resolution, offset, and whether it has been loaded into the memory information, at runtime, according to the current view and rendering requirements, the virtual pages that need to be loaded are detected, and the required virtual pages are loaded from the disk to the memory, when the page is no longer needed, it is unloaded from the memory to release the memory space;
[0029] When the renderer needs to access certain texture data, check if the virtual page where the texture data is located has been loaded into the memory, if the page is not loaded, request to load the page and store it in the cache, when the camera moves or the view changes, the virtual pages that need to be loaded are detected again, according to the new view requirements, new pages are loaded and old pages are unloaded, to ensure that only the texture data currently needed is loaded into the memory.
[0030] The further improvement of the technical scheme of the application is that the step 4 specifically comprises:
[0031] Adaptive probes are deployed in screen space (Screen Space) and world space (World Space), and the number and position of the probes are dynamically adjusted according to the scene complexity and object distribution, wherein the screen space probe is used to capture the indirect lighting effect at close range, and the world space probe is used to capture the global lighting information at long distance, and an initial probe grid of the screen space is generated, and at the same time, the probe layout of the world space is loaded, and then the probe is initialized, and its sampling range and resolution are set;
[0032] The importance sampling technique is used to optimize the lighting collection process of the probe, and the probe collects indirect lighting information from different directions, including ambient light, reflected light and shadow, to obtain comprehensive lighting effects, wherein the importance sampling allocates sampling points according to the expected importance of lighting contribution, and preferentially samples the area that has a greater impact on the final lighting effect;
[0033] Based on the obtained comprehensive lighting effect, the indirect lighting data collected by the screen space and world space probes is fused to generate a unified lighting field, and filtering and noise reduction algorithms are applied to further optimize the lighting data and reduce the noise caused by insufficient sampling or sparse probe distribution.
[0034] A further improvement to the technical solution of the present invention is that the process of obtaining the comprehensive lighting effect is as follows:
[0035] The distribution of light sources, material properties of objects, and geometric structures in the energy station scenario are analyzed, and an importance function is defined in combination with the light contribution factors including light intensity, direction, and distance.
[0036] Sampling points are generated according to the defined importance function. The distribution of sampling points should be proportional to the value of the importance function, that is, more sampling points are generated in the region with a higher importance function value. A random number generator is used to generate sampling points to avoid artifacts that may be introduced by regular sampling. Then, probes are used to collect indirect lighting information from different directions, including ambient light, reflected light and shadows.
[0037] For each sampling point, the incident light intensity, bidirectional reflection distribution function, and the angle between the sampling point's direction and the surface normal are analyzed to calculate their contribution to the illumination. Then, the illumination contributions of all sampling points are integrated to obtain the overall illumination effect.
[0038] A further improvement to the technical solution of the present invention is that the expression of the importance function is as follows:
[0039] ;
[0040] In the formula, The value of the importance function indicates the direction. The importance of light contribution, The incident light intensity represents the direction of illumination. The light intensity reaching the surface, Let be the cosine of the angle of incidence, and represent the direction of incidence. Angle with surface normal cosine value, The distance between the light source and the surface;
[0041] The expression for the contribution to illumination is as follows:
[0042] ;
[0043] ;
[0044] In the formula, For the first The illumination contribution of each sampling point For the first The incident light intensity at each sampling point It is a two-way reflection distribution function. For the first The cosine value of the incident angle at each sampling point. The direction of incidence. is the outgoing direction (view direction), is the differential reflected radiance, representing the reflected radiance from direction observed by the observer, is the differential incoming radiance, representing the incoming radiance from direction arriving at the surface, is the incoming angle, representing the incoming direction with the surface normal;
[0045] The expression of the integrated lighting effect is as follows:
[0046] ;
[0047] In the formula, is the integrated lighting effect, is the lighting contribution of the th sampling point, is the importance function value of the th sampling point, is the total number of sampling points, is the index of the sampling point, is the lighting contribution of the th sampling point,
[0048] Further improvement of the technical scheme of the present application is that the step 5 specifically comprises:
[0049] In the energy field station scene, according to the region visibility and the lighting change frequency, a priority queue is created to manage the update tasks of the surface cache and the radiation cache, and the priority of each cache unit is allocated according to the visibility and the time stamp, wherein the surface cache adopts a pre-capture mechanism, which is used to capture the grid material properties (albedo, normal, self-luminous, etc.) from multiple angles, store them as texture atlas (Atlas), and dynamically manage the memory through virtual paging (Virtual Page); the radiation cache includes a screen space radiance cache and a world space radiance cache, the screen space radiance cache is used to down-sample the indirect lighting, combine with the full-resolution material data, reduce the noise and improve the performance, and the world space radiance cache is used to distinguish the near-field and far-field lighting, trace more samples for the far light, and optimize the indoor scene (such as the sky light penetrating through a small window);
[0050] In each frame rendering, the cache unit with the highest priority is selected from the priority queue for updating, and the surface cache and the radiation cache are updated gradually according to the priority order in the queue, the high-frequency visible region is refreshed preferentially, and the lighting data of the high-frequency visible region is ensured to be the latest;
[0051] According to the current view and rendering requirements, the priority of the cache unit in the priority queue is dynamically adjusted, the visibility and timestamp of each cache unit are re-evaluated, and the position of the cache unit in the queue is adjusted, for the area newly entering the field of view, the visibility changes from 0 to 1, and the priority is improved, so that the cache update always keeps consistent with the current view requirements, and the performance and data accuracy are balanced.
[0052] Further improvement of the technical scheme of the present application is that the step 6 specifically comprises:
[0053] The ray tracing capability of the current hardware is detected, and an adaptive ray tracing mode is selected, wherein if the hardware supports RTX acceleration, the hardware ray tracing is enabled to process high-precision reflection and shadow of dynamic objects, and if the hardware does not support RTX acceleration, the software ray tracing based on the global signed distance field (SDF) is completely relied on, and the static objects are always processed by the software ray tracing, so as to balance the performance and picture quality.
[0054] According to the ray tracing mode, the light data of different sources is dynamically mixed, the direct light, the indirect light and the cache data are fused, for each pixel, the light contribution from the static objects (software ray tracing) and the dynamic objects (hardware ray tracing) is fused, and the global distance field of the voxelized grid is used to accelerate the ray tracing, and the material properties and the light sampling positions recorded by the mesh card are used.
[0055] The fused light data is applied to each pixel of the scene, the final color value of each pixel is analyzed according to the material properties and the light model, the anti-aliasing and filtering processing are performed on the fused light data, the color correction and adjustment are performed on the rendering result, the brightness, the contrast and the saturation of the color are adjusted according to the light condition and the material characteristics of the scene, so as to ensure that the final image is color-accurate and meets the expected effect, and then the final rendering frame is generated according to the processed light data, the rendering result is output to the screen, and the rendering result is saved as an image file, so that the whole rendering process is completed, and the rendering effect meets the actual demand of the energy station scene.
[0056] Due to the adoption of the above technical scheme, the present application has the following technical progress compared with the prior art:
[0057] 1. The present application provides a real-time dynamic rendering method based on multi-layer ray tracing and cache cooperation, which combines the advantages of software ray tracing and hardware ray tracing by mixing ray tracing modes, and can process the light changes in dynamic scenes in real time, the software ray tracing uses the global distance field to quickly respond to the intersection query of light and scene, which is suitable for complex static scenes, and the hardware ray tracing uses the hardware acceleration capability of the RTX graphics card to process high-precision reflection and shadow of dynamic objects, so as to ensure that the light effect can be updated in real time in the dynamic scene, improve the real-time and dynamic of rendering, and meet the demand of the energy station scene for real-time dynamic rendering.
[0058] 2. This invention provides a real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration. By employing virtual paging technology, it can effectively manage memory resources and reduce redundant calculations. The virtual paging technology divides the texture atlas into multiple virtual pages, dynamically loading and unloading the required pages according to the current view and rendering needs, avoiding loading the entire texture atlas, thereby optimizing memory usage. This not only improves rendering efficiency but also reduces the demand on hardware resources, enabling the method to run efficiently even in resource-constrained environments. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0060] Figure 1 This is a schematic diagram of the workflow of the present invention;
[0061] Figure 2 This is a schematic diagram of the method flow of the present invention. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] Example 1, such as Figure 1 , Figure 2 As shown, this invention provides a real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration, comprising the following steps:
[0064] Step 1, convert the scene mesh of the energy station into a voxelized mesh, generate a global signed distance field (SDF) to support fast ray tracing, and generate mesh surface data (Mesh Card) to provide a spatial query basis for subsequent lighting calculations. Import the scene mesh of the energy station into the graphics engine, parse the vertices, faces, materials, and texture coordinates, check the consistency of the mesh units, ensure that the coordinate system matches the engineering requirements, and perform topology optimization and degenerate triangle filtering. For topology optimization, use MeshLab to repair non-manifold edges and isolated vertices. For degenerate triangle filtering, calculate the area of the triangle and remove the faces with an area less than the preset threshold. The graphics engine supports common energy station model formats such as FBX, OBJ, glTF, etc. Use KD-Tree acceleration structure to divide the mesh space and generate a voxelized mesh of the energy station. For each voxel unit of the voxelized mesh, calculate the center point coordinates, use KD-Tree to query the nearest surface point, and mark it as an internal voxel if the distance is less than half the diagonal length of the voxel. Each voxel unit stores spatial coordinates and geometric association information. Spatial coordinates are voxel center points, and geometric associations are the index of the nearest surface point, normal, and material ID (mapped from the original mesh). Based on the surface area heuristic (SAH), select the partition axis for mesh space division, and use KD-Tree leaf nodes to store triangle index lists and internal nodes to store partition plane information to accelerate subsequent nearest surface queries during voxelization. Based on the voxel center points of the voxelized mesh, calculate the distance from each point to the nearest mesh surface to generate a global signed distance field (SDF). SDF can quickly respond to ray intersection queries with the scene, support fast ray tracing, and optimize the storage structure of the global distance field using a hierarchical approach to improve query efficiency and reduce memory usage. Generate mesh surface data (Mesh Card) for each mesh to record material properties, lighting sampling location and direction information on the mesh surface for subsequent lighting calculations and provide accurate spatial query basis.
[0065] The calculation formula of the voxel unit center point coordinates is as follows:
[0066] ;
[0067] ;
[0068] ;
[0069] where, is the coordinate of the mesh origin, indicating the starting position of the voxelized mesh, is the size of each voxel unit, is the size of the voxel unit in the direction, is the index of the voxel unit in the mesh, indicating the position of the voxel unit in the mesh position in the direction, is the coordinate of the voxel center point;
[0070] The formula for calculating the distance of each voxel center point to the nearest grid surface is as follows:
[0071] ;
[0072] In the formula, is the coordinate of the point on the grid surface, used to calculate the nearest distance of the voxel center point to the grid surface, is the set of all points on the grid surface, which is the set of vertices of a triangular mesh, represents the minimum value operation, represents the calculation of the Euclidean distance of the voxel center point to the grid surface point , is the distance of the voxel center point to the nearest grid surface, used to generate the global distance field;
[0073] Step 2, combine the hybrid light tracing mode containing software light tracing (based on SDF) and hardware light tracing (based on triangular geometry), process static and dynamic objects respectively, balance the calculation accuracy and performance, conduct initial light sampling, analyze the three-dimensional scene of the energy field station, distinguish static objects (buildings, fixed equipment, etc.) and dynamic objects (such as rotating wind turbine blades, moving maintenance vehicles, etc.), and assign light tracing modes according to the characteristics of the objects: static objects use software light tracing (based on global distance field (SDF)), dynamic objects use hardware light tracing (based on triangular geometry), to balance the calculation accuracy and performance, ensure efficient operation under different hardware configurations, for static objects, use software light tracing technology based on global distance field for initial light sampling, global distance field can quickly respond to intersection query of light and scene, support fast light tracing, especially suitable for processing complex scenes, for dynamic objects, enable hardware-accelerated light tracing based on triangular geometry, use the hardware acceleration capability of RTX graphics card for high-precision reflection and dynamic mesh rendering, ensure that the lighting effect of dynamic objects is real and efficient, integrate the lighting data obtained by software light tracing and hardware light tracing, for each pixel, combine the lighting contribution from static objects (software light tracing) and dynamic objects (hardware light tracing) to generate unified light sampling results, seamlessly integrate the lighting data of the two modes, at the same time, combine the voxelized grid and mesh surface data to further optimize the lighting effect, ensure that the lighting effect of the entire scene is natural, real and efficient, among them, use the global distance field (SDF) of the voxelized grid to accelerate light tracing, use the material properties and light sampling positions recorded by the mesh surface data (Mesh Card) to provide accurate spatial query basis;
[0074] The expression for the unified lighting sample result is as follows:
[0075]
[0076]
[0077]
[0078] wherein is the unified lighting sample result, is the lighting contribution of the static object at point in direction , is the incoming light, i.e. the lighting intensity arriving at point from direction , is the bidirectional reflectance distribution function (BRDF) describing the reflection properties at point from direction to direction , is the incoming direction, is the outgoing direction, is the incoming angle, i.e. the angle between and the surface normal, is the set of all possible incoming directions, is the lighting contribution of the dynamic object at point in direction ;
[0079] Step 3, capture the scene surface material properties, store as a texture atlas, and manage memory through virtual paging, reduce redundant calculation, pre-capture static lighting information, for each mesh surface in the energy station scene, capture its material properties, including albedo, normal, self-illumination and other key information, and divide the scene into MxM uniform units, each unit stores the material of a mesh, and then encode the material properties into a texture atlas, that is, combine multiple small textures into a large texture atlas to reduce the overhead of texture switching, wherein each unit of the texture atlas corresponds to the material properties of a mesh surface, the material properties are stored in the atlas through UV mapping, the virtual paging technology is used to divide the texture atlas into multiple virtual pages, each page contains part of the texture data, at runtime, the required virtual pages are dynamically loaded and unloaded according to the current view and rendering requirements, to reduce memory occupation and avoid loading the entire texture atlas, while ensuring that only the required texture data is loaded into the video memory, thereby optimizing memory usage, using the captured material properties and texture atlas, perform lighting calculation on the scene at multiple preset viewpoints, pre-calculate static lighting information, and store the calculation results of the static lighting information as a lighting cache to ensure that the pre-captured lighting information can be quickly loaded at runtime, reducing the burden of real-time calculation, and ensuring that the preset viewpoints can uniformly cover the entire scene, avoiding missing lighting information in some areas.
[0080] In addition, the process of dividing the texture atlas into multiple virtual pages using the virtual paging technology is as follows:
[0081] Based on the merged texture atlas, UV mapping is used to assign UV coordinates to each mesh surface, ensuring that its material properties can be correctly stored in the texture atlas, and through a virtual paging technique, the size of each virtual page is determined in combination with the video memory capacity and rendering requirements, and then the texture atlas is divided into multiple virtual pages, each page contains part of the texture data, and there can be overlapping areas between pages to avoid boundary problems, an index is created for each virtual page to record its location and range in the texture atlas, and metadata is stored for each page, including the resolution, offset, and whether it has been loaded into the video memory information, at runtime, according to the current view and rendering requirements, the virtual pages that need to be loaded are detected, and the required virtual pages are loaded from the disk to the video memory, and when the page is no longer needed, it is unloaded from the video memory to release the video memory space, wherein the resolution refers to the resolution of the page, the offset refers to the offset of the page in the texture atlas, and the loading state refers to whether the page has been loaded into the video memory, when the renderer needs to access a certain texture data, it is checked whether the virtual page where the texture data is located has been loaded into the video memory, if the page is not loaded, the page is requested to be loaded and stored in the cache, the cache uses the LRU (Least Recently Used) strategy to manage the loading and unloading of the page, when the camera moves or the view changes, the virtual pages that need to be loaded are re-detected, and according to the new view requirements, new pages are loaded and old pages are unloaded, ensuring that only the texture data currently needed is loaded into the video memory;
[0082] Step 4, deploy adaptive probes in screen space and world space to collect indirect lighting information, optimize lighting calculation efficiency through importance sampling, and optimize the distribution and noise suppression of indirect lighting;
[0083] Step 5, use an incremental update mechanism to dynamically update the surface cache and the radiation cache based on a priority queue, adjust the refresh frequency according to visibility and timestamp, and refresh high-frequency visible areas first to balance performance and data accuracy;
[0084] Step 6, select a ray tracing mode according to hardware capabilities, combine direct light, indirect light, and cache data, and output the final rendering frame to ensure performance and image quality balance under different configurations.
[0085] Embodiment 2, as shown in Figure 1 , Figure 2 on the basis of embodiment 1, the application provides a technical solution: preferably, step 4 specifically includes:
[0086] Adaptive probes are deployed in screen space and world space to dynamically adjust the number and position of probes according to the scene complexity and object distribution, wherein the screen space probes are used to capture the indirect lighting effects at close distances, and the world space probes are used to capture the global lighting information at long distances, and an initial probe grid in the screen space is generated, while the probe layout in the world space is loaded to initialize the probes, set their sampling range and resolution, and ensure that the key areas of the energy station scene are covered, the deployment rule of the screen space probes is to generate probes according to the screen space depth buffer and normal buffer when rendering each frame, and one probe is deployed in every N×N pixel area in the screen space, the deployment rule of the world space probes is to divide the energy station into multiple areas, independently deploy probes in each area, and increase the probe density in the object dense area, the importance sampling technique is used to optimize the lighting collection process of the probes, and the probes collect indirect lighting information from different directions, including ambient light, reflected light and shadow, to obtain the comprehensive lighting effect, wherein the importance sampling allocates sampling points according to the expected importance of lighting contribution, preferentially samples the areas that have greater impact on the final lighting effect, thereby improving the sampling efficiency and reducing the waste of computing resources, based on the obtained comprehensive lighting effect, the indirect lighting data collected by the screen space and world space probes are fused to generate a unified lighting field, through data fusion, the lighting effects in different areas of the scene are ensured to be naturally transitioned, avoiding the problem of lighting discontinuity caused by uneven distribution of probes, and filtering and noise reduction algorithms are applied to further optimize the lighting data and reduce the noise caused by insufficient sampling or sparse distribution of probes;
[0087] In addition, the process of obtaining the comprehensive lighting effect is as follows:
[0088] The light source distribution, object material properties and geometric structure in the energy station scene are analyzed, and an importance function is defined by combining the lighting contribution factors including lighting intensity, directionality and distance, wherein the higher the intensity of the light source, the greater its contribution to lighting, the smaller the angle between the direction of the light source and the surface normal, the greater its contribution to lighting, and the closer the distance between the light source and the surface, the greater its contribution to lighting, sampling points are generated according to the defined importance function, the distribution of the sampling points should be proportional to the value of the importance function, i.e. more sampling points are generated in the areas with higher importance function values, and a random number generator is used to generate the sampling points to avoid artifacts that may be introduced by regular sampling, and then indirect lighting information from different directions, including ambient light, reflected light and shadow, is collected by the probes, for each sampling point, the incident lighting intensity, bidirectional reflectance distribution function and the angle between the direction of the sampling point and the surface normal are analyzed, the contribution of the sampling point to lighting is calculated, and the lighting contributions of all sampling points are integrated to obtain the comprehensive lighting effect;
[0089] The expression of the importance function is as follows:
[0090] ;
[0091] where, is the value of the importance function, indicating the importance of the illumination contribution from direction is the incident illumination intensity, indicating the illumination intensity arriving at the surface from direction is the cosine value of the incident angle, indicating the cosine value of the angle between the incident direction and the surface normal, reflecting the alignment degree between the light and the surface normal, with the value range of [0, 1], when (i.e., the light is completely aligned with the surface normal), ; when , is the distance between the light source and the surface, indicating the distance from the light source to the surface, the square of the distance is used to attenuate the illumination intensity, conforming to the physical inverse square law, the farther the distance, the smaller the value, indicating that the illumination intensity decreases with the increase of the distance; The expression of the illumination contribution is as follows:
[0092]
[0093] ;
[0094] ;
[0095] where, is the illumination contribution of the th sampling point, is the incident illumination intensity of the th sampling point, is the bidirectional reflectance distribution function (BRDF), indicating the reflection characteristics from the incident direction to the exit direction , is the cosine value of the incident angle of the th sampling point, is the incident direction, is the exit direction (observation direction), is the differential reflected illumination intensity, indicating the reflected illumination intensity observed from direction , is the differential incident illumination intensity, indicating the illumination intensity arriving at the surface from direction , is the incident angle, indicating the angle between the incident direction and the surface normal, when When the light ray is completely aligned with the surface normal, the reflection is the strongest; when the light ray is parallel to the surface, the reflection is the weakest; and when the light ray is perpendicular to the surface, the reflection is intermediate. ;
[0096] The expression of the integrated lighting effect is as follows:
[0097] ;
[0098] In the formula, is the integrated lighting effect, is the lighting contribution of the i-th sampling point, is the importance function value of the i-th sampling point, is the total number of sampling points, is the index of the sampling point, is the importance function value of the i-th sampling point.
[0099] Step 5 specifically includes:
[0100] In the energy station scene, according to the regional visibility and the light change frequency, a priority queue is created to manage the update tasks of the surface cache and the radiance cache, and the priority of each cache unit is allocated according to the visibility and the timestamp, and the cache unit with high priority will be updated first, so that the cache data of the key region is always kept up-to-date, while the overall performance is optimized, wherein the surface cache adopts a pre-capture mechanism, which is used to capture the grid material properties (albedo, normal, self-illumination, etc.) from multiple angles and store them as texture atlas (Atlas), and the memory is dynamically managed through virtual paging (Virtual Page), only simple geometries (such as independent walls, floors) are supported, and complex meshes (such as rooms with furniture) need to be split into independent meshes, otherwise it will cause lighting errors (manifested as pink uncovered areas); the radiance cache includes screen space radiance cache and world space radiance cache, the screen space radiance cache is used to downsample the indirect lighting, combined with full-resolution material data, to reduce noise and improve performance, and the world space radiance cache is used to distinguish near-field and far-field lighting, more samples are traced for far-field light, and indoor scenes (such as sky light penetrating through small windows) are optimized, in each frame rendering, the cache unit with the highest priority is selected from the priority queue for updating, and according to the priority order in the queue, the surface cache and the radiance cache are updated gradually, the surface cache is updated at most 1024x1024 pixels (direct light) and 512x512 pixels (indirect light) per frame, according to the "last use time-last update time" sorting, the high-frequency visible area is refreshed first, to ensure that the lighting data of the high-frequency visible area is the latest, and at the same time, a certain number of cache units are updated per frame to avoid excessive consumption of computing resources and unnecessary calculations, wherein the update frequency is dynamically adjusted according to the visibility and the timestamp, according to the current view and the rendering requirement, the priority of the cache unit in the priority queue is dynamically adjusted, the visibility and the timestamp of each cache unit are re-evaluated, and the position of the cache unit in the queue is adjusted, for the region newly entering the field of view, the visibility changes from 0 to 1, the priority is improved, and the cache update is always consistent with the current view requirement, balancing the performance and the data accuracy;
[0101] Step 6 specifically comprises:
[0102] Detect the ray tracing capability of the current hardware, select the appropriate ray tracing mode, if the hardware supports RTX acceleration, enable hardware ray tracing to process high-precision reflection and shadow of dynamic objects, if not, completely rely on software ray tracing based on global distance field (SDF), at the same time, static objects always use software ray tracing, to balance performance and picture quality, according to the ray tracing mode, dynamically mix light data from different sources, fuse direct light, indirect light and cache data, for each pixel, fuse the light contribution from static objects (software ray tracing) and dynamic objects (hardware ray tracing), and use the global distance field of voxelized grid to accelerate ray tracing, use the material properties and light sampling position recorded by mesh card to provide accurate spatial query basis, ensure natural and realistic lighting effect, apply the fused lighting data to each pixel of the scene, analyze the final color value of each pixel according to the material properties and lighting model, and perform anti-aliasing and filtering on the fused lighting data, use Gaussian filtering algorithm to reduce noise and jaggies in lighting data, improve image quality, make the rendering result more smooth, perform color correction and adjustment on the rendering result, adjust the brightness, contrast and saturation of the color according to the lighting conditions and material characteristics of the scene, ensure the color accuracy of the final image and meet the expected effect, and then generate the final rendering frame according to the processed lighting data, output the rendering result to the screen, at the same time, save it as an image file, complete the whole rendering process, ensure that the rendering effect meets the actual needs of the energy station scene.
[0103] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any skilled person in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration, characterized in that, Includes the following steps: Step 1: Convert the scene mesh of the energy station into a voxelized mesh and generate a global distance field, while also generating mesh surface data; Step 2: Combining a hybrid ray tracing mode that includes both software and hardware ray tracing, process static and dynamic objects separately, and perform initial lighting sampling, specifically including: The 3D scene of the energy station is analyzed to distinguish between static and dynamic objects, and ray tracing modes are assigned according to the characteristics of the objects: software ray tracing is used for static objects, and hardware ray tracing is used for dynamic objects. For static objects, initial lighting sampling is performed using software ray tracing technology based on global distance field. For dynamic objects, hardware ray tracing based on triangle geometry is enabled, and high-precision reflection and dynamic mesh rendering are performed using the hardware acceleration capabilities of RTX graphics cards. The lighting data obtained from software ray tracing and hardware ray tracing are integrated. For each pixel, the lighting contributions from static and dynamic objects are combined to generate a unified lighting sampling result, thus fusing the lighting data from the two modes. Step 3: Capture the surface material properties of the scene, store them as a texture atlas, and manage memory through virtual paging. Pre-capture static lighting information, specifically including: For each grid surface in the energy station scene, its material properties are captured, and the scene is divided into M×M uniform units. Each unit stores the material of a grid, and then the material properties are encoded into a texture atlas, that is, multiple small textures are merged into a large texture atlas. Each unit of the texture atlas corresponds to the material properties of a grid surface. The material properties are stored in the atlas through UV mapping. Virtual pagination technology is used to divide the texture atlas into multiple virtual pages, each containing a portion of the texture data; Using captured material properties and texture atlases, lighting calculations are performed on the scene from multiple preset viewpoints. Static lighting information is pre-calculated, and the calculation results of the static lighting information are stored as a lighting cache. The process of dividing the texture atlas into multiple virtual pages using virtual pagination technology is as follows: Based on the merged texture atlas, UV mapping is used to assign UV coordinates to each mesh surface. By using virtual paging technology, combined with video memory capacity and rendering requirements, the size of each virtual page is determined, thereby dividing the texture atlas into multiple virtual pages, each containing a portion of texture data. An index is created for each virtual page to record its position and extent in the texture atlas. At the same time, metadata is stored for each page, including the page's resolution, offset, and whether it has been loaded into video memory. At runtime, based on the current view and rendering requirements, the virtual pages that need to be loaded are detected, and the required virtual pages are loaded from the disk into video memory. When a page is no longer needed, it is unloaded from video memory to release video memory space. When the renderer needs to access a certain texture data, it checks whether the virtual page containing the texture data has been loaded into video memory. If the page is not loaded, it requests to load the page and stores it in the cache. When the camera moves or the view changes, it re-detects the virtual page that needs to be loaded. Based on the new view requirements, it loads the new page and unloads the pages that are no longer needed, ensuring that only the texture data that is currently needed is loaded into video memory. Step 4: Deploy adaptive probes in screen space and world space to collect indirect lighting information and optimize lighting calculation efficiency through importance sampling; Step 5: Adopt an incremental update mechanism to dynamically update the surface cache and radiation cache based on a priority queue, and adjust the refresh frequency according to visibility and timestamp; Step 6: Select the ray tracing mode according to the hardware capabilities, merge direct light, indirect light and cached data, and output the final rendered frame.
2. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration according to claim 1, characterized in that: Step 1 specifically includes: The scene mesh of the energy station is imported into the graphics engine, the vertex, face, material and texture coordinates are parsed, and topology optimization and degenerate triangle filtering are performed. For topology optimization, MeshLab is used to repair non-manifold edges and isolated vertices. For degenerate triangle filtering, the triangle area is calculated and faces with an area smaller than a preset threshold are removed. The KD-Tree acceleration structure is used to divide the grid space and generate a voxelized grid for the energy station. For each voxel cell of the voxelized grid, the coordinates of the center point are calculated. The nearest surface point is queried using KD-Tree. If the distance is less than half the length of the voxel's diagonal, it is marked as an internal voxel. Each voxel cell stores spatial coordinates and geometric association information. The dividing axis is selected heuristically based on the surface area to divide the grid space. The leaf nodes of KD-Tree store the triangle index list, and the internal nodes store the dividing plane information. Based on the voxel center points of the voxelized mesh, the distance from each point to the nearest mesh surface is calculated to generate a global distance field. At the same time, a hierarchical approach is adopted to optimize the storage structure of the global distance field. Generate mesh surface data for each mesh, recording the material properties, lighting sampling location, and direction information of the mesh surface.
3. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration according to claim 1, characterized in that: Step 4 specifically includes: Adaptive probes are deployed in screen space and world space, and the number and position of probes are dynamically adjusted according to scene complexity and object distribution. Screen space probes are used to capture indirect lighting effects at close range, while world space probes are used to capture global lighting information at long range. An initial probe mesh is generated in screen space, and the probe layout in world space is loaded to initialize the probes and set their sampling range and resolution. The importance sampling technique is used to optimize the illumination collection process of the probe, and the probe is used to collect indirect illumination information from different directions, including ambient light, reflected light and shadow, to obtain the comprehensive illumination effect. The importance sampling assigns sampling points according to the expected importance of the illumination contribution. Based on the obtained comprehensive lighting effect, the indirect lighting data collected by the screen space and world space probes are fused to generate a unified lighting field. At the same time, filtering and noise reduction algorithms are applied to further optimize the lighting data.
4. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration as described in claim 3, characterized in that: The process of obtaining the overall lighting effect is as follows: The distribution of light sources, material properties of objects, and geometric structures in the energy station scenario are analyzed, and an importance function is defined in combination with the light contribution factors including light intensity, direction, and distance. Sampling points are generated based on the defined importance function and a random number generator is used to generate sampling points. Then, probes are used to collect indirect lighting information from different directions, including ambient light, reflected light, and shadows. For each sampling point, the incident light intensity, bidirectional reflection distribution function, and the angle between the sampling point's direction and the surface normal are analyzed to calculate their contribution to the illumination. Then, the illumination contributions of all sampling points are integrated to obtain the overall illumination effect.
5. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration according to claim 4, characterized in that: The expression for the importance function is as follows: ; In the formula, The value of the importance function. The incident light intensity, Let cosine be the angle of incidence. The distance between the light source and the surface; The expression for the contribution to illumination is as follows: ; ; In the formula, For the first The illumination contribution of each sampling point For the first The incident light intensity at each sampling point It is a two-way reflection distribution function. For the first The cosine value of the incident angle at each sampling point. The direction of incidence. The direction of launch. The differential reflected light intensity The differential incident light intensity Angle of incidence; The expression for the overall lighting effect is as follows: ; In the formula, To achieve a comprehensive lighting effect, For the first The illumination contribution of each sampling point For the first The importance function value of each sampling point The total number of sampling points. For the index of the sampling point, For the first The importance function value of each sampling point.
6. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration according to claim 1, characterized in that: Step 5 specifically includes: In the energy station scenario, a priority queue is created based on regional visibility and the frequency of illumination changes to manage the update tasks of surface cache and radiation cache. Priority is assigned to each cache unit based on visibility and timestamp. The surface cache uses a pre-capture mechanism to capture mesh material properties from multiple angles, store them as texture atlases, and dynamically manage memory through virtual paging. The radiation cache includes screen space emissivity cache and world space emissivity cache. The screen space emissivity cache is used to downsample indirect illumination, and the world space emissivity cache is used to distinguish between near-field and far-field illumination. During each frame rendering, the highest priority cache unit is selected from the priority queue for updating, and the surface cache and radiation cache are updated step by step according to the priority order in the queue, with priority given to refreshing high-frequency visible areas; Based on the current view and rendering requirements, the priority of cache units in the priority queue is dynamically adjusted, the visibility and timestamp of each cache unit are re-evaluated, and their position in the queue is adjusted. For newly entered areas, the visibility is changed from 0 to 1, and their priority is increased, so that cache updates are always consistent with the current view requirements.
7. The real-time dynamic rendering method based on multi-layer ray tracing and caching collaboration according to claim 1, characterized in that: Step 6 specifically includes: The system detects the ray tracing capabilities of the current hardware and selects the appropriate ray tracing mode. If the hardware supports RTX acceleration, hardware ray tracing is enabled to handle high-precision reflections and shadows of dynamic objects. If it does not support RTX acceleration, software ray tracing based on the global distance field is used entirely. Meanwhile, software ray tracing is always used for static objects. According to the ray tracing mode, lighting data from different sources are dynamically mixed, and direct light, indirect light and cached data are fused. For each pixel, the lighting contributions from static and dynamic objects are fused, and the global distance field of the voxelized mesh is used to accelerate ray tracing. Material properties and lighting sampling positions recorded by mesh surface data are used. The fused lighting data is applied to each pixel of the scene. Based on material properties and lighting models, the final color value of each pixel is analyzed. Anti-aliasing and filtering are performed on the fused lighting data. Color correction and adjustment are performed on the rendering results. Based on the lighting conditions and material characteristics of the scene, the brightness, contrast and saturation of the colors are adjusted. Finally, based on the processed lighting data, the final rendering frame is generated, the rendering result is output to the screen, and it is also saved as an image file, completing the entire rendering process.
Citation Information
Patent Citations
Illumination rendering method and device, terminal and storage medium
CN116672706A
Real-time rendering optimization method based on ray tracing
CN119722902A