Diffuse global illumination method and system based on sparse distance field and voxelization

By using sparse distance fields and voxelization methods to optimize light probe updates, the problems of high computational overhead and strong hardware dependence in existing technologies are solved, and efficient and compatible dynamic diffuse global illumination effects are achieved.

CN119091028BActive Publication Date: 2025-09-30ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411166780.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2025-09-30
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

Existing dynamic diffuse global illumination methods have high computational cost and strong hardware dependence when dealing with complex lighting scenes. They cannot meet the needs of real-time interaction and dynamic changes, and the effect is poor in multi-light source scenes.

Method used

Using the sparse distance field and voxelization method, a sparse global distance field is constructed to voxelize the scene, cascaded light probes and state machines are used to optimize the update of light probes, and trilinear interpolation is combined to calculate the lighting effect.

Benefits of technology

It achieves efficient lighting calculation without relying on dedicated hardware platforms, improves lighting quality and coverage, reduces invalid probe updates, and improves performance and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119091028B_ABST
    Figure CN119091028B_ABST
Patent Text Reader

Abstract

The present invention discloses a diffuse global illumination method and system based on sparse distance fields and voxelization, comprising: constructing a sparse distance field, voxelizing a scene, constructing a state machine for a lighting probe, using the distance field to perform ray tracing to obtain radiance, performing a mixing process on the radiance to obtain irradiance, applying lighting through the lighting probe, and finally realizing dynamic diffuse global illumination. The use of sparse distance fields and voxelized scene expressions solves the dependence of such algorithms on dedicated ray tracing hardware, and the present invention performs many effective optimizations to help the system run efficiently. Therefore, the present invention analyzes the dynamic diffuse global illumination algorithm and adopts a distance field ray tracing method that does not rely on a specific hardware acceleration structure, thereby realizing the use of distance fields for ray tracing to obtain radiant brightness in the dynamic diffuse global illumination algorithm, improving the operating efficiency, and enabling the algorithm to be applied in a real-time rendering environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of global illumination, and in particular to a diffuse global illumination method and system based on sparse distance field and voxelization. Background Art

[0002] In recent years, research on dynamic diffuse global illumination (DGI) has emerged from the ongoing pursuit of photorealistic rendering in computer graphics. With the advancement of computing power and the diversification of graphics processing requirements, the application of real-time rendering technology has become increasingly widespread, including but not limited to video games, virtual reality, filmmaking, and architectural visualization. In these applications, the fidelity of lighting effects is a key factor influencing user experience and visual quality. Traditional static lighting models often struggle to handle complex lighting scenarios and meet the demands of real-time interactivity and dynamic changes. Recent DGI methods have their own limitations, including failing to account for occlusion and visibility when approximating lighting effects and requiring specific hardware acceleration, which prevents them from being fully applicable across all platforms. To address these issues, we propose a hardware-independent, physically accurate, and performance-controlled real-time DGI solution.

[0003] Global illumination has always been a hot research topic in graphics. Over the years, many different approaches have emerged, the earliest of which are ray tracing and path tracing. Ray tracing is a method for calculating lighting and shadows by simulating the path of light rays starting from the camera and tracing their propagation path in the scene. Path tracing is an extension of ray tracing, which uses random sampling to trace the multiple reflection paths of light rays in the scene, gradually accumulating lighting information. Both essentially simulate the propagation of light paths, so they require a lot of computational overhead. Although ray tracing has entered the real-time field with the advent of many hardware acceleration structures, it is still not possible to enable ray tracing on most consumer-grade hardware.

[0004] The Reflective Shadow Map (RSM) method draws on shadow technology. Reflective Shadow Maps are based on the concept of traditional shadow maps but expand upon the information they store. Traditional shadow maps only store depth information, while RSMs not only store depth but also record the color and direction of reflected light. This additional information is used to calculate indirect lighting, resulting in more realistic rendering. By obtaining a depth map from the camera's perspective and a depth map from the light's perspective, the camera's perspective determines whether each pixel is illuminated by a light source. RSMs record the direction and intensity of light rays projected into the scene, enabling efficient calculation of indirect lighting. During rendering, the reflected light information recorded in the RSM is used to calculate the indirect lighting received by each pixel. By traversing the light source pixels in the RSM and projecting their reflected light onto other pixels in the scene, the indirect lighting contribution is calculated. This method was used in early video games, but it has several drawbacks. First, it fails to account for visibility, as each pixel in the RSM method represents a light source, making the use of shadow maps prohibitively expensive. Furthermore, the RSM method is not suitable for global illumination with multiple light sources.

[0005] Light Propagation Volumes (LPV), LPV generates realistic lighting effects by propagating lighting information in a volume grid, simulating multiple reflections and scattering of light in the scene. This method voxelizes the scene and uses the idea of ​​RSM to inject direct lighting into the surface of the object, and then propagates it based on the voxelized information of the scene, and iterates continuously. During rendering, the shading point is rendered using the radiance in the grid volume. Because LPV uses a voxelization method, it solves the visibility problem to a certain extent, but light leakage will still occur in the same grid volume. When the grid volume granularity is reduced, the light leakage will be reduced, but the complexity and storage during propagation become unsolvable problems. Summary of the Invention

[0006] In view of the deficiencies of the prior art, the present invention aims to provide a diffuse global illumination method and system based on sparse distance fields and voxelization.

[0007] The object of the present invention is achieved through the following technical solution: a diffuse global illumination method based on sparse distance field and voxelization, comprising the following steps:

[0008] S1. Construct a sparse global distance field;

[0009] S2. voxelize a scene that requires global illumination, voxelize the scene through a rasterization process, and record the albedo map, self-luminous information, and direct illumination information of the scene;

[0010] S3, injecting the direct lighting information obtained in step S2 into the direct lighting voxelized 3D texture;

[0011] S4. In the scene, place light probes around the camera center using a cascaded light probe placement method to generate four light probe spaces with different probe spacings.

[0012] S5. offset the origin of the light probe space according to the current viewing direction to obtain more lighting information;

[0013] S6. Construct a state machine for the light probes, eliminate unnecessary updates of the light probes through the state machine, reposition the light probes, perform distance field ray tracing on the light probes that need to be updated to obtain voxel surface information and update the radiance texture; and blend the radiance texture to obtain irradiance information.

[0014] S7. Shade the scene according to the irradiance information obtained in step S6, search for light probes around the shading point in the light probe space, and perform trilinear interpolation calculation to obtain the color of the shading point.

[0015] Furthermore, step S1 specifically comprises: first, pre-generating a high-precision mesh distance field for each mesh under offline conditions; then, synthesizing the mesh distance fields in the scene into a low-precision global distance field in real time; and in subsequent distance field ray tracing, after the low-precision global distance field is quickly traced around the mesh, switching to the high-precision mesh distance field for tracing.

[0016] Furthermore, in step S2, voxelizing the scene requiring global illumination includes the following steps:

[0017] Creating a three-dimensional texture that stores voxel information, the three-dimensional texture including a diffuse voxel texture, a luminous voxel texture, and an illuminated voxel texture; wherein the voxel resolution is set to 128×128×128, and four three-dimensional textures are created when creating the voxel three-dimensional texture, and the four three-dimensional textures together constitute a four-level cascade texture;

[0018] Execute the geometry shader to voxelize the mesh, calculate the normal of each triangle face, and select the normal with the largest component as the principal axis as the projection direction; when performing conservative rasterization later, expand the three sides of the triangle face;

[0019] The voxelized pixel shader is executed to calculate the coordinates in the voxel texture of each surface and update the texture information, including the albedo map, self-illumination information, and direct lighting information.

[0020] Furthermore, the placement of the lighting probes in step S4 is specifically as follows: a 4-cascade lighting probe space is used, the number of probes inside the probe space is the same, and the probe spacing in probe spaces of different levels is different to ensure the global lighting quality near the observation point. The closer the lighting probe space is to the observation point, the smaller the distance between the probes; as the level of the lighting probe space increases, the spacing between the probes increases.

[0021] Furthermore, the step S5 is specifically as follows:

[0022] Calculate the intersection point of the observation direction vector and the light probe space, calculate the distance from the observation point to the intersection point based on the intersection point, and take 0.3 times the distance from the observation point to the intersection point as the adjustment distance;

[0023] Move the origin of the Light Probe Space towards the viewing direction by a distance equal to 0.15 times the longest of the three dimensions of the Probe Space.

[0024] Furthermore, in step S6, constructing a state machine for the illumination probe includes:

[0025] Probe inactive state: indicates that the probe is a valid probe that needs to be sampled, but the probe is not updated; the probe marked in this state is farther away from the geometry than the distance between probes, or the probe is inside the geometry;

[0026] Probe Activated Status: When this probe is updated, it is marked as activated;

[0027] Probe active state: In this state, the probe budget is set in a frame to evenly distribute the overhead; a portion of the probes are updated in each frame using round-robin requests, marking the requested portion of probes as active;

[0028] Probe dormant state: No ray tracing updates are performed on this probe, but it is sampled. Probes behind the camera are marked in this state. The probe budget is set within a frame to evenly distribute the overhead. Round robin requests are used to update a subset of probes each frame, and probes not in the requested subset are marked in this state.

[0029] Furthermore, in step S6, repositioning the illumination probe is specifically performed as follows:

[0030] For probes located inside the wall, the probes are determined by the probe state machine to be not sampled during shading, resulting in a reduction in the amount of information available for the shading point, and the probes are moved outside the wall;

[0031] For probes located near the wall surface, distance field detection is performed on 27 points in the surrounding 3×3×3 space. The detection content is the distance from the sampling detection point to the nearest object surface. The point with the largest distance field among the 27 points is selected as the new position of the original probe to move away from the wall surface.

[0032] Furthermore, in step S6, distance field ray tracing is performed on the probe as follows:

[0033] Select the number of rays to be traced by each probe, and divide the number of rays to be traced by each probe into four levels, namely 96, 128, 192, and 256 rays;

[0034] Perform distance field ray tracing to obtain information about the hit point; sample the hit point information in the voxelized 3D texture, and ultimately record the information in the lighting probe, which includes the radiance and distance information of the point.

[0035] Furthermore, in step S6, the radiance texture is mixed as follows:

[0036] Determine the state of the light probe. If the probe is inactive or dormant, skip the mixing phase. If it is in other states, enter the irradiance update process.

[0037] The specific process of updating irradiance is as follows: when mixing in a certain sampling direction of the probe, the radiance information of each direction collected in the probe is merged, and at the same time, the normal unit vector n and the sampling direction w are combined according to the Lambert cosine theorem. j Perform dot multiplication to calculate the weight value dot(n,ω j ), will be from position p, direction w j The radiance L(p,ω j ) and weight value dot(n,ω j ) is multiplied to get the contribution value in that direction, and finally the irradiance Texel(n) at that location is calculated:

[0038]

[0039] Where N represents the number of sampling times.

[0040] A diffuse global illumination system based on sparse distance fields and voxelization, including the following modules:

[0041] Distance Field Construction Module: Constructs a distance field system based on the pre-processed mesh high-precision distance field and the sparse low-precision global distance field, which is used to calculate the distance from a point to the nearest surface during distance field ray tracing.

[0042] Voxelization building block: Implements a voxelization system based on the rasterization process and triangle expansion process, which is used to query scene lighting information at the hit point of distance field ray tracing;

[0043] Probe state machine module: Builds a state machine and sets the probe state based on the probe's location and recent activation information to determine whether the probe is updated and sampled, reducing time overhead.

[0044] Distance Field Ray Tracing Module: Performs ray tracing based on distance fields, replacing dedicated hardware ray tracing and enabling ray tracing capabilities without dedicated ray tracing hardware platforms.

[0045] Probe repositioning module: Adjustments are made based on the probe's position. For probes located near the wall surface, a distance field is detected for 27 points in a 3×3×3 space around the probe. The detection content is the distance from the sampled probe point to the nearest object surface. The point with the largest distance in the distance field is selected as the new position of the original probe to move away from the surface. For probes located inside the wall, the probe state machine will determine that they are not sampled during shading, resulting in a reduction in the amount of information available for the shading point. For such probes, the probe is moved outside the wall to obtain better lighting effects during shading.

[0046] Probe radiance mixing module: Mixing is performed according to a certain sampling direction of the probe, that is, the radiance information collected in the probe in various directions needs to be merged to calculate the irradiance of the probe in various directions;

[0047] Shading module: The sampling space of the shading point is composed of the 8 nearest probes, and the irradiance at the shading point is calculated by trilinear interpolation. Finally, the color is calculated by a physically based shading model.

[0048] The beneficial effects of the present invention are:

[0049] The present invention introduces a sparse global distance field to implement distance field ray tracing on a platform that does not support dedicated ray tracing hardware, and has high platform compatibility.

[0050] The present invention expresses the scene through voxels, so that the lighting information of the scene objects can be quickly queried.

[0051] The present invention achieves better lighting effect and coverage size for the space within the observation field of view by slightly displacing the probe space according to the observation direction, thereby improving the lighting quality.

[0052] The present invention adopts a multi-level cascade probe placement method to achieve a larger global illumination coverage area without sacrificing the global illumination quality near the observation point, and at the same time has different update rates for the illumination probe space of different probe levels to obtain better performance.

[0053] The present invention constructs a state machine for illumination probes and combines multiple approaches to reduce updates of invalid probes, thereby achieving better performance in probe updates and subsequent processes. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 is a flow chart of the method of the present invention;

[0055] Figure 2 Constructing a sparse global distance field diagram for the scenario of the present invention;

[0056] Figure 3 Construct a voxel representation schematic for the scene of the present invention;

[0057] Figure 4 This is a schematic diagram of the placement of the cascade illumination probes of the present invention;

[0058] Figure 5 This is a schematic diagram of shifting the probe space according to the observation direction according to the present invention;

[0059] Figure 6 This is a schematic diagram of the repositioning of the illumination probe of the present invention;

[0060] Figure 7 It is a system flow chart of the present invention. DETAILED DESCRIPTION

[0061] The present invention will be described in detail below based on the accompanying drawings and preferred embodiments. The purpose and effects of the present invention will become more apparent. The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.

[0062] The present invention provides a feasible solution for diffuse global illumination system based on multiple optimization methods such as sparse distance field and voxelization.

[0063] like Figure 1 As shown, an embodiment of the present invention provides a diffuse global illumination method based on sparse distance field and voxelization, comprising the following steps:

[0064] 1. Construct a sparse global distance field.

[0065] like Figure 2As shown, a high-precision mesh distance field is first pre-generated offline for each mesh. Then, a low-precision global distance field is synthesized in real time from the mesh distance fields in the scene. In subsequent distance field ray tracing, the mesh's surroundings can be quickly traced using the low-precision global distance field. Ray tracing then switches to the high-precision mesh distance field when ray tracing reaches the mesh's surroundings. This hybrid approach balances storage overhead with the accuracy of ray tracing results.

[0066] 2. Perform voxel expression on scenes that require global illumination, voxelize the scenes through a rasterization process, and record the albedo map, self-luminous information, and direct lighting information of the scenes.

[0067] like Figure 3 As shown in the figure, the following process is used to voxelize the scene:

[0068] 2.1. During initialization, a 3D texture is created to store voxel information, including a diffuse voxel texture, an illuminating voxel texture, and an illuminated voxel texture. The voxel resolution is set to 128×128×128, and cascaded texture technology is used. Therefore, when creating the voxel 3D texture, three additional 3D textures are created to form a four-level hierarchical texture.

[0069] 2.2. The geometry shader that performs voxelization of the mesh computes the normal for each triangle face and selects the principal axis as the projection direction based on the maximum component of the normal. Furthermore, subsequent conservative rasterization requires the three edges of the triangle face to be expanded. The purpose of conservative rasterization is to prevent holes in the voxelized surface.

[0070] 2.3. Execute the voxelized pixel shader to calculate the coordinates of each face in the voxel texture and update the texture information. The updated information includes the albedo map, self-illumination information, and direct lighting information of the scene.

[0071] 3. Inject direct lighting information into the direct lighting voxelized 3D texture.

[0072] 4. In the scene, light probes are placed in a cascaded manner around the observation center to generate four light probe spaces with different probe spacings.

[0073] like Figure 4 As shown, when placing Light Probes, a 4-level cascade Light Probe Space is implemented. The number of probes within each space is the same, but the spacing between probes in different levels of Probe Spaces varies. To ensure global illumination quality near the observation point, the distance between probes in Light Probe Spaces closer to the observation point is reduced. Conversely, as the number of Light Probe Spaces increases, the spacing between probes increases.

[0074] 5. Offset the origin of the Light Probe Space based on the current viewing direction to obtain more lighting information.

[0075] 6. Construct a state machine for the Light Probes, using the state machine to cull unnecessary updates to the Light Probes, such as when there are no shaded objects near the probes; reposition the Light Probes, and then perform distance field ray tracing on the Light Probes that need to be updated to obtain voxel surface information and update the radiance texture; and blend the radiance texture to obtain irradiance information.

[0076] like Figure 5 As shown, the origin of the light probe space is offset according to the current viewing direction to obtain more lighting information, as follows:

[0077] First, calculate the intersection point of the viewing direction vector and the light probe space, calculate the distance ViewOriginToHitPoint from the viewing point to the intersection point based on the intersection point with the light probe space, and take 0.3 times of this distance as the adjustment distance.

[0078] Adds the distance from the origin of the Light Probe space towards the viewing direction.

[0079] The state machine of the probe is constructed as follows:

[0080] DDGI_PROBE_STATE_INACTIVE state (probe inactive state): This means that it is not a valid probe to sample and will not be updated. Probes marked in this state are generally because the probe is too far away from the geometry, or the probe is stuck inside the geometry (even after repositioning attempts to move it).

[0081] DDGI_PROBE_STATE_ACTIVATED state: When this probe is updated, it is marked as activated. This means that it was recently activated and its information is temporally relevant, so an attempt will be made to update the probe (even if it is on the back of the camera).

[0082] DDGI_PROBE_STATE_ACTIVE state (probe active state): In this state, the probe budget is set in a frame to evenly distribute the overhead. A portion of the probes are updated in each frame using round-robin requests. Therefore, the probes in the requested portion will be marked as active.

[0083] DDGI_PROBE_STATE_SLEEP state (probe sleep state): No ray tracing updates are performed on this probe, but sampling is performed. Probes behind the camera are marked in this state. To evenly distribute the overhead, the probe budget is set within a frame. A round-robin request is used to update a subset of probes each frame; probes not in the requested subset are marked in this state.

[0084] like Figure 6 As shown, the probe relocation operation is as follows:

[0085] For probes located inside the wall, they will be determined by the probe state machine as not being sampled during shading, resulting in a reduction in the amount of information available for the shading point. For such probes, the choice is to move the probe outside the wall.

[0086] For probes located near the surface of a wall, distance field detection is performed on 27 points in the surrounding 3×3×3 space. The detection content is the distance from the sampling detection point to the nearest object surface. The point with the largest distance in the distance field among the 27 points is selected as the new position of the original probe to move away from the surface.

[0087] Distance Field Ray Tracing for Probes is as follows:

[0088] Select the number of rays to be traced for each probe. This can be selected as needed on platforms with different configurations. There are four levels: 96, 128, 192, and 256 rays.

[0089] Perform distance field ray tracing to obtain the hit point information. The hit point information is sampled in the voxelized 3D texture, which contains information such as the point's radiance and distance, and is ultimately recorded in the light probe.

[0090] The probe collection data is mixed as follows:

[0091] Determine the state of the light probe. If it is in DDGI_PROBE_STATE_INACTIVE or DDGI_PROBE_STATE_SLEEP state, skip the blending phase. In other states, you can enter the irradiance update phase.

[0092] The specific process of updating irradiance is as follows: when mixing in a certain sampling direction of the probe, the radiance information of each direction collected in the probe is merged, and at the same time, the normal unit vector n and the sampling direction w are combined according to the Lambert cosine theorem. j Perform dot multiplication to calculate the weight value dot(n,ω j ), will be from position p, direction w j The radiance L(p,ω j ) and weight value dot(n,ω j) is multiplied to get the contribution value in that direction, and finally the irradiance Texel(n) at that location is calculated:

[0093]

[0094] Where N represents the number of sampling times.

[0095] 7. Shade the scene, search for 8 light probes around the shading point in the light probe space, and perform trilinear interpolation to obtain the color of the shading point.

[0096] like Figure 7 As shown, an embodiment of the present invention further provides a diffuse global illumination system based on sparse distance fields and voxelization, which includes the following modules:

[0097] Distance Field Construction Module: Constructs a distance field system based on the pre-processed mesh high-precision distance field and the sparse low-precision global distance field. It is used to calculate the distance from a point to the nearest surface during distance field ray tracing.

[0098] Voxelization building block: Implements a voxelization system based on the rasterization process and triangle expansion process, which is used to query scene lighting information at the hit point of distance field ray tracing.

[0099] Probe state machine module: Builds a state machine based on the probe's location, recent activation, and other information, sets the probe state, and is used to determine whether the probe is updated and sampled, reducing time overhead.

[0100] Distance Field Ray Tracing Module: Performs ray tracing based on distance fields, replacing dedicated hardware ray tracing and enabling ray tracing capabilities without dedicated ray tracing hardware platforms.

[0101] Probe Repositioning Module: Adjustments are made based on the probe's position. For probes near the wall surface, a distance field is detected for 27 points within a 3×3×3 space around the probe. The distance from the sampled probe point to the nearest surface is measured. The point with the largest distance in the distance field is selected as the new probe position, moving it further away from the surface. Probes located inside the wall are not sampled by the probe state machine during shading, reducing the amount of information available for the shading point. For these probes, the probe is moved outside the wall to achieve better lighting effects during shading.

[0102] Probe radiance mixing module: Mixing is performed according to a certain sampling direction of the probe, that is, the radiance information collected in the probe in various directions needs to be merged to calculate the irradiance of the probe in various directions

[0103] Shading module: The sampling space of the shading point is composed of the 8 nearest probes, and the irradiance at the shading point is calculated by trilinear interpolation. Finally, the color is calculated by a physically based shading model.

[0104] Those skilled in the art will understand that the foregoing descriptions are merely preferred embodiments of the invention and are not intended to limit the invention. Although the invention has been described in detail with reference to the foregoing examples, those skilled in the art will still be able to modify the technical solutions described in the foregoing examples or substitute equivalents for some of the technical features therein. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the invention shall be included within the scope of protection of the invention.

Claims

1. A diffuse global illumination method based on sparse distance fields and voxelization, characterized in that: The following steps are involved: (S1) Constructing a sparse global distance field; (S2) voxelizing a scene requiring global illumination, voxelizing the scene through a rasterization process, and recording an albedo map, self-luminous information, and direct illumination information of the scene; (S3) injecting the direct lighting information obtained in step (S2) into the direct lighting voxelized three-dimensional texture; (S4) in the scene, placing light probes around the camera center using a cascaded light probe placement method to generate four light probe spaces with different probe spacings; (S5) offsetting the origin of the light probe space according to the current viewing direction to obtain more lighting information; (S6) constructing a state machine for the light probe, eliminating unnecessary updates of the light probe through the state machine, repositioning the light probe, and performing distance field ray tracing on the light probe that needs to be updated to obtain voxel surface information and update the radiance texture; Mixing the radiance texture to obtain irradiance information; The step of constructing a state machine for the illumination probe includes: Probe inactive state: indicates that the probe is a valid probe that needs to be sampled, but the probe is not updated; the probe marked in this state is farther away from the geometry than the distance between probes, or the probe is inside the geometry; Probe Activated Status: When this probe is updated, it is marked as activated; Probe active state: In this state, the probe budget is set in a frame to evenly distribute the overhead; a portion of the probes are updated in each frame using round-robin requests, marking the requested portion of probes as active; Probe dormant state: no ray tracing updates are performed on this probe, but it is sampled; probes behind the camera are marked in this state; the probe budget is set in one frame to evenly distribute the overhead; a round-robin request is used to update a portion of the probes each frame, and probes that are not in the requested portion are marked in this state; Repositioning the light probe is specifically as follows: For probes located inside the wall, the probes are determined by the probe state machine to be not sampled during shading, resulting in a reduction in the amount of information available for the shading point, and the probes are moved outside the wall; If the probe is located near the wall surface, a distance field detection is performed on 27 points in a 3×3×3 space around the probe. The detection content is the distance between the sampled probe point and the nearest object surface. The point with the largest distance in the distance field is selected as the new position of the original probe to move away from the wall surface. (S7) Shading the scene according to the irradiance information obtained in step (S6), searching for light probes around the shading point in the light probe space, and performing trilinear interpolation calculation to obtain the color of the shading point.

2. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: The step (S1) specifically comprises: first, pre-generating a high-precision mesh distance field for each mesh under offline conditions; then, synthesizing the mesh distance fields in the scene into a low-precision global distance field in real time; and in subsequent distance field ray tracing, after the low-precision global distance field is quickly traced around the mesh, switching to the high-precision mesh distance field for tracing.

3. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: In the step (S2), voxelizing the scene requiring global illumination includes the following steps: Creating a three-dimensional texture that stores voxel information, the three-dimensional texture including a diffuse voxel texture, a luminous voxel texture, and an illuminated voxel texture; wherein the voxel resolution is set to 128×128×128, and four three-dimensional textures are created when creating the voxel three-dimensional texture, and the four three-dimensional textures together constitute a four-level cascade texture; Execute the geometry shader to voxelize the mesh, calculate the normal of each triangle face, and select the normal with the largest component as the principal axis as the projection direction; when performing conservative rasterization later, expand the three sides of the triangle face; The voxelized pixel shader is executed to calculate the coordinates in the voxel texture of each surface and update the texture information, including the albedo map, self-illumination information, and direct lighting information.

4. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: In step (S4), the lighting probes are placed in a specific manner as follows: a 4-cascade lighting probe space is used, wherein the number of probes in each probe space is the same, and the probe spacing in different levels of probe spaces is different, so as to ensure the global illumination quality near the observation point, and the distance between probes in the lighting probe space closer to the observation point is smaller; As the number of levels in the Light Probe Space increases, the spacing between probes increases.

5. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: The step (S5) is specifically as follows: Calculate the intersection point of the observation direction vector and the light probe space, calculate the distance from the observation point to the intersection point based on the intersection point, and take 0.3 times the distance from the observation point to the intersection point as the adjustment distance; Move the origin of the Light Probe Space in the viewing direction by an amount equal to 0.15 times the longest of the three dimensions of the Probe Space.

6. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: In the step (S6), distance field ray tracing is performed on the probe as follows: Select the number of rays to be traced by each probe, and divide the number of rays to be traced by each probe into four levels, namely 96, 128, 192, and 256 rays; Perform distance field ray tracing to obtain information about the hit point; sample the hit point information in the voxelized 3D texture, and ultimately record the information in the lighting probe, which includes the radiance and distance information of the point.

7. The diffuse global illumination method based on sparse distance field and voxelization according to claim 1, characterized in that: In the step (S6), the radiance texture is mixed as follows: Determine the state of the light probe. If the probe is inactive or dormant, skip the mixing phase. If it is in other states, enter the irradiance update process. The specific process of updating the irradiance is as follows: when mixing in a certain sampling direction of the probe, the radiance information of each direction collected in the probe is merged, and the normal unit vector is updated according to the Lambert cosine theorem. and sampling direction Perform dot multiplication to calculate the weight value , will be from the position ,direction The radiance obtained at and weight value Multiply to get the contribution value in that direction, and finally calculate the irradiance at that location : ; Where N represents the number of sampling times.

8. A diffuse global illumination system based on sparse distance fields and voxelization, characterized in that: Includes the following modules: Distance Field Construction Module: Constructs a distance field system based on the pre-processed mesh high-precision distance field and the sparse low-precision global distance field, which is used to calculate the distance from a point to the nearest surface during distance field ray tracing. Voxelization building block: Implements a voxelization system based on the rasterization process and triangle expansion process, which is used to query scene lighting information at the hit point of distance field ray tracing; Probe state machine module: Builds a state machine and sets the probe state based on the probe's location and whether it has been recently activated. This is used to determine whether the probe is updated and sampled, reducing time overhead. Distance Field Ray Tracing Module: Performs ray tracing based on distance fields, replacing dedicated hardware ray tracing and enabling ray tracing capabilities without dedicated ray tracing hardware platforms. Probe repositioning module: Adjustments are made based on the probe's position. For probes located near the wall surface, a distance field is detected for 27 points in a 3×3×3 space around the probe. The detection content is the distance from the sampled probe point to the nearest object surface. The point with the largest distance in the distance field is selected as the new position of the original probe to move away from the surface. Probes located inside the wall will be determined by the probe state machine as not being sampled during shading, resulting in a reduction in the amount of information available for the shading point. For such probes, the probe is moved outside the wall. Probe radiance mixing module: Mixing is performed according to a certain sampling direction of the probe, that is, the radiance information collected in the probe in various directions needs to be merged to calculate the irradiance of the probe in various directions; Shading module: The sampling space of the shading point is composed of the 8 nearest probes, and the irradiance at the shading point is calculated by trilinear interpolation. Finally, the color is calculated by a physically based shading model.

Citation Information

Patent Citations

  • Illumination rendering method and device, equipment and storage medium

    CN117876572A

  • Method and device for realizing real-time global illumination of mobile terminal

    CN118365773A