Dynamic light source space-time importance sampling method based on Markov chain disturbance
By combining reservoir resampling and Markov chain Monte Carlo perturbation techniques, the lighting calculation of dynamic light sources is optimized, solving the problems of flickering artifacts and noise in dynamic light source scenes, and achieving efficient and stable rendering results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies struggle to efficiently screen high-contribution dynamic light source samples within limited computational budgets, making it difficult to balance noise and temporal stability in real-time interactive applications, especially resulting in flicker artifacts in dynamic light source scenarios.
By combining reservoir-based spatiotemporal importance resampling with Markov chain Monte Carlo perturbation, a three-dimensional grid reservoir and Markov chain Monte Carlo method are used to perturb the light source samples, optimize the sample distribution, and reduce temporal artifacts.
It effectively suppresses inter-frame flicker artifacts, improves rendering quality and stability, while maintaining computational efficiency, making it suitable for modern game engines and real-time renderers.
Smart Images

Figure CN121746571A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics processing, and in particular to a dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation. Background Technology
[0002] This section provides only background information relevant to this disclosure and is not necessarily prior art.
[0003] With the ever-increasing demands for visual realism in industries such as gaming, virtual reality, and the metaverse, real-time global illumination has become a key technology for enhancing immersion. In physically based rendering equations, direct lighting calculation is the foundation of global illumination, requiring integration of the incident light contributions from all light source surfaces. For modern game and virtual reality scenes containing large-scale, multi-type dynamic light sources, the number of light sources... The number of light sources is enormous, typically exceeding 100. Traditional Monte Carlo methods require emitting a large number of sampling rays per pixel to control noise, and the computational cost increases with the number of light sources, making it difficult to balance real-time interactive frame rates and visual quality. Therefore, how to efficiently select high-contribution samples from massive dynamic light sources with limited computational budgets (typically only 1-2 samples per pixel per frame) has become a hot topic in this field.
[0004] The main limitation of existing technologies lies in the difficulty of achieving a good balance between computational efficiency, noise suppression, and temporal stability, which restricts the widespread application of high-quality direct lighting in real-time interactive applications. Although optimization techniques such as reservoir-based spatiotemporal importance sampling have been developed to achieve efficient storage and spatiotemporal reuse of sampled light sources by introducing reservoirs and importance sampling, they still have significant shortcomings in handling dynamic light sources, especially the spatiotemporal noise they generate (such as inter-frame flicker artifacts). This is because the core idea is to select the highest quality light source for shading, and its powerful reuse mechanism can lead to the over-reuse of a few high-contribution samples in undersampled environments (such as rapid camera movement), resulting in erroneous reprojection and obvious flicker artifacts in the temporal domain, which seriously affects the visual quality and stability of the rendering results.
[0005] Markov chain Monte Carlo is a classic sampling method that generates samples by constructing a Markov chain with a stationary distribution equal to the target distribution. The Metropolis-Hastings algorithm, in particular, uses a "proposal-acceptance" mechanism to perform random walks near the current sample, thereby increasing the exploratory nature of the samples while maintaining the unbiasedness of the distribution. It has been used in some real-time ray tracing algorithms (such as Metropolis Light Transport) to explore complex ray path spaces. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a direct illumination dynamic light source sampling method that combines reservoir spatiotemporal importance resampling with Markov chain Monte Carlo perturbation. This method aims to resolve the core contradiction in real-time rendering where low dynamic light source sampling efficiency and temporal consistency (flicker, artifact issues) are difficult to achieve simultaneously. This invention utilizes ReSTIR (Responsive Spatiotemporal Importance Resampling) technology to reuse the light source sampling information distribution of historical frames and leverages the ergodicity of Markov chains to efficiently perturb it, effectively suppressing temporal flicker artifacts while maintaining sampling efficiency.
[0007] A dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation includes the following steps:
[0008] Step 1: System initialization and world space mesh construction. The boundary of the 3D mesh is determined based on the world space bounding box of the scene to be rendered, and a uniform 3D mesh covering the scene is constructed. Each mesh cell is associated with a reservoir set, which stores light source sampling information. The light source sample parameters associated with the mesh cell include the position, weight, cumulative weight, and integral contribution weight required to calculate the illumination of the light source sample.
[0009] Step 2: Two-stage spatiotemporal importance resampling. By applying target distribution functions of different precision to the original light pool of the grid cells, the spatiotemporal resampling importance sampling method is applied to perform initial resampling at the grid region granularity and secondary resampling at the specific shading point granularity in turn, to obtain samples that participate in the direct lighting calculation.
[0010] Step 3: Sample optimization. The samples obtained in Step 2 are perturbed using the Markov chain Monte Carlo method to reduce temporal correlation artifacts without disrupting the original sampling distribution, resulting in perturbed samples.
[0011] Step 4: Illumination calculation and output. The samples obtained after the perturbation in Step 3 and their corrected integral contribution weights are used to calculate the direct illumination of the shading points.
[0012] In some embodiments, step 2 includes the following steps:
[0013] Step 2-1: Initial resampling of light sources to the grid, and preliminary screening of light source samples in the original light source pool that have potential contributions to the local space;
[0014] Step 2-2: For the shading points that need to be calculated for direct lighting, the light source samples obtained in Step 2-1 are resampled a second time to obtain samples for calculating direct lighting.
[0015] Steps 2-3: Merge the grid reservoir in the current frame with the corresponding grid reservoir in the historical frames, i.e., resample the reservoir in the spatial and temporal domain, and reuse sample information across frames. The number of historical frames ranges from 3 to 10.
[0016] In some embodiments, step 2-1 includes the following steps:
[0017] Step 2-1-1: Traverse all light sources in the scene and calculate the spatial intersection of their influence range and the mesh cells;
[0018] Step 2-1-2: For each intersecting grid cell, design the target distribution based on the brightness and distance attenuation characteristics of the light source. :
[0019]
[0020] in The brightness of the light source, The distance from the light source to the center of the grid cell;
[0021] Step 2-1-3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation The uniform distribution is used as the target distribution and the proposed distribution. By using a weighted reservoir sampling algorithm, the original light source pools of the grid cells are initially screened, and the obtained light sources are used as candidate samples to update the associated light source samples in the corresponding grid cells.
[0022] The weighted reservoir sampling algorithm described in step 2-1-3 specifically involves processing the candidate sample set. Resampling is performed. On the one hand, this method can decouple the sample information stored during the sampling process from the total number of samples, optimizing the overhead brought by large-scale light source samples; on the other hand, the streaming sampling mechanism of this method enables merging between different reservoirs, improving parallel computing efficiency and supporting more flexible spatiotemporal reuse of samples.
[0023] The specific sampling process is as follows: Maintain a capacity of... reservoir data structure The information stored in this structure includes the currently stored samples. Sample weights Cumulative weights and Monte Carlo integral contribution weights corresponding to the samples During algorithm initialization, set , , .
[0024] For each initial light source candidate sample ( Perform the following steps:
[0025] 1. Calculate the weights ;
[0026] 2. Update cumulative weights ;
[0027] 3. Based on probability Decide whether to use Replace the current sample in the reservoir: Generate random numbers ,like Then set , .
[0028] After the above processing, when there are already k samples, the probability of each sample being selected is:
[0029]
[0030] When on After performing the above process on all M candidate samples, the reservoir structure The samples in the middle are the samples obtained from the resampling importance sampling. By running in parallel The second resampling process yields the sample set. Combining the conditional probabilities of the two-step sampling process, its probability distribution function is:
[0031]
[0032] The above probability distribution function is denoted as the Importance Resampling Probability Density (SIR PDF), and applied to the colored points. The Monte Carlo integral calculation for direct illumination at a given location yields:
[0033]
[0034] The reservoir structure capacity used in this invention is The above formula can be simplified to:
[0035]
[0036] in This refers to the Monte Carlo integral contribution weight corresponding to the sample, which is stored in the reservoir structure.
[0037] In some embodiments, step 2-2 includes the following steps:
[0038] Step 2-2-1: For each colored point, determine the reservoir set corresponding to the colored point through spatial neighborhood query and trilinear interpolation merging;
[0039] Step 2-2-2: Design the target distribution based on the light source's brightness, distance attenuation, and the BRDF properties of the shading points. :
[0040]
[0041] in The point of color is located in the direction of light incidence. , emission direction The BRDF bidirectional reflection distribution function;
[0042] Step 2-2-3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] As the target distribution, the same proposed distribution as in step 2-1-3 is used. By using a weighted reservoir sampling algorithm, candidate samples are resampled twice at the granularity of the colored points to select one representative light source sample for each colored point. and their corresponding integral contribution weights The sampling distribution is close to the integrand to reduce the estimation variance, i.e., reduce noise and improve illumination quality.
[0043] In some embodiments, step 3 specifically includes:
[0044] Step 3-1: with Define a stationary distribution for the current state. ,in As a construction distribution, candidate samples z are generated based on the stationary distribution and the construction distribution; where the set of all initial light sources in the scene is represented as the sample set. The set of light sources associated with the grid after initial resampling is represented as the sample set. After secondary resampling, the associated light source of the colored point is ;
[0045] Step 3-2: Calculate the transfer acceptance rate using the MH algorithm based on the detailed stationary equation.
[0046]
[0047] Generate random numbers ,like Then accept candidate samples, let Otherwise, maintain the original sample and let k is the number of perturbation iterations;
[0048] Step 3-3: Process the received samples After correcting the integral contribution weights, we obtain the integral contribution weights of the perturbed samples:
[0049]
[0050] Where M is the number of sample light sources. The samples used in calculating direct illumination values are used to effectively maintain the temporal continuity of the samples and avoid temporal artifacts caused by overuse of a few samples. Directly applying the spatiotemporal importance resampling framework's inherent sample reuse mechanism can lead to correlation artifacts in the temporal domain. Specifically, when the camera moves rapidly or illumination conditions change dynamically, a few high-contribution light source samples are overused, causing inter-frame flicker artifacts and sample depletion. Furthermore, directly applying random perturbations to the samples obtained from spatiotemporal importance sampling will disrupt the original distribution and deviate from the target distribution. A Markov Chain Monte Carlo perturbation mechanism is introduced for light source sampling to break sample stagnation and enhance temporal exploratory capabilities. Its core principle lies in utilizing the stationary distribution characteristics of Markov Chain Monte Carlo (MCMC) perturbations to ensure that the perturbed sample distribution converges to the target distribution. Or a distribution close to it, thereby perturbing the sample while maintaining unbiasedness and improving issues such as artifacts.
[0051] For each chromatic reservoir sample, MCMC perturbation is performed. The decision to accept the transfer is based on the transfer acceptance probability. The integral contribution weight of the perturbed sample is updated, and the perturbed sample is then passed to the illumination calculation stage.
[0052] The following optimization strategy is used for sample perturbation:
[0053] Single-step perturbation: MCMC perturbation is performed only once per sample per frame, balancing effect and performance. Parallel processing: Utilizing a GPU parallel architecture, perturbation operations on multiple shading points are performed simultaneously. Early termination: A relative threshold η is set; when a sample's contribution weight is lower than η, which is the maximum contribution weight of the local region, it is determined to be a sample with extremely low contribution and the perturbation is skipped.
[0054] In some embodiments, the relative threshold η is 0.02.
[0055] In summary, this invention achieves efficient sample reuse through a spatiotemporal reservoir and ensures uniform exploration in the temporal domain through MCMC perturbation. The combination of these two methods effectively addresses the efficiency and quality bottlenecks in real-time sampling of dynamic light sources. This method requires no pre-computation, can be integrated into mainstream real-time renderers, and significantly improves the visual quality and rendering performance of dynamic lighting.
[0056] Beneficial Effects: Compared with the technical problems existing in the background art, the method of the present invention, by introducing a Markov chain Monte Carlo perturbation mechanism and combining it with a spatiotemporal importance resampling framework, has the following outstanding advantages and positive effects:
[0057] Effectively suppressing temporal artifacts and improving visual stability: Addressing the inter-frame flickering problem caused by the overuse of a few high-contribution samples in existing spatiotemporal importance resampling techniques, this invention utilizes the local random walk characteristic of MCMC to effectively perturb the reuse of temporal samples while maintaining an unbiased sample distribution. This mechanism effectively increases the diversity of the sample set, suppresses the overuse of a few high-contribution light source samples, alleviates artifact problems, and makes the rendering sequence visually more coherent and stable.
[0058] Controllable computational overhead, balancing efficiency and quality: This invention designs MCMC perturbation as a lightweight post-processing module that seamlessly integrates into existing rendering pipelines. By employing a "single-step perturbation" strategy (i.e., performing only one MCMC iteration per pixel per frame) and leveraging GPU parallel architecture for acceleration, it achieves a significant improvement in visual quality with limited additional computational overhead (tested to increase frame time by approximately 5%-15% in typical scenarios), thus realizing a good balance between rendering efficiency and output quality.
[0059] High versatility, easy integration and deployment: The MCMC perturbation module proposed in this invention does not depend on specific scene structures or light source types, and is applicable to point light sources, spotlights, area light sources, etc. Its design is highly decoupled from existing spatiotemporal importance resampling (ReSTIR) pipelines, requiring no modification to the core resampling logic, making it easy to quickly integrate and deploy in various modern game engines and real-time renderers, and has broad applicability.
[0060] To address the limitations of the aforementioned spatiotemporal importance sampling, this solution introduces a perturbation mechanism based on the Markov chain Monte Carlo method to structurally improve the sampling process for dynamic light sources, thereby mitigating flicker artifacts and noise issues. The core principle is to leverage the consistency between the stationary distribution of the Markov chain and the distribution of the spatiotemporal importance sampling target. Without disrupting the original spatiotemporal importance sampling distribution, the solution utilizes the random walk properties of the Markov chain to efficiently perturb the samples.
[0061] In summary, this invention solves the problem of balancing efficiency and temporal consistency in direct illumination dynamic light source sampling by combining reservoir-based spatiotemporal importance sampling with a Markov chain Monte Carlo perturbation strategy. It achieves direct illumination results with lower noise and more stable temporal timing at the same frame rate. This can be integrated into the real-time rendering pipeline of modern game engines, providing a new solution for fields such as games and virtual reality that require highly realistic real-time rendering. Attached Figure Description
[0062] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.
[0063] Figure 1 An overview diagram of the algorithm for the dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation provided by this invention.
[0064] Figure 2 This is a schematic diagram of the specific Markov chain Monte Carlo perturbation process. Detailed Implementation
[0065] 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 a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0066] like Figure 1-2 As shown, the purpose of this invention is to provide a dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation, which can be used to efficiently and with high quality calculate direct illumination of scenes containing large-scale dynamic light sources in real-time rendering pipelines such as game engines. The method includes the following steps:
[0067] Step 1: System Initialization and World Space Grid Construction
[0068] The boundaries of the 3D mesh are determined based on the world-space bounding box of the scene to be rendered. By default, a uniform mesh with a resolution of 16×16×16 covers the entire scene. Each mesh cell is associated with a reservoir set, which stores the light source sampling information for that spatial region. Each reservoir set contains 256 reservoir data structures by default. Each reservoir is used to record the position, weight, cumulative weight, and integral contribution weight required to calculate the illumination for a light source sample.
[0069] Step 2: Perform two-stage spatiotemporal importance resampling
[0070] Step 2-1 iterates through all dynamic light sources in the scene and calculates the spatial intersection of their influence range and the mesh cells. For each intersecting mesh cell, based on the light source's brightness and its distance to the mesh cell center (considering inverse square attenuation), calculate a simplified target probability distribution function (Target PDF): , in The brightness of the light source, The distance from the light source to the center of the grid cell is as described above. The target PDF is used, and the proposal PDF is used, with a uniform distribution. The weighted reservoir sampling (WRS) algorithm is used to update the reservoir set in the corresponding grid cell using this light source as a candidate sample. This stage aims to quickly filter out light source samples that have the potential to contribute to the local space from the large pool of original light sources.
[0071] Step 2-2: For each colored point, determine the reservoir set corresponding to the colored point through spatial neighborhood query and trilinear interpolation merging. Construct a more accurate target distribution function that comprehensively considers the brightness of the light source, distance attenuation, and the BRDF properties of the colored point: ,in The point of color is located in the direction of light incidence. , emission direction The BRDF bidirectional reflectance distribution function is used as the target distribution. The WRS algorithm is then used to resample from the merged candidate sample set to finally select a representative light source sample for the colored point. and their corresponding integral contribution weights .
[0072] Steps 2-3 maintain the grid reservoir status of the most recent 5 frames. After processing the first stage of Step 2 in the current frame, the grid reservoir of the current frame is merged with the grid reservoir at the corresponding position in the historical frames (i.e., reservoir resampling in the spatial domain) to achieve cross-frame reuse of sample information.
[0073] Step 3: Markov Chain Monte Carlo (MCMC) Perturbation
[0074] Step 3-1: Proposal and Disturbance: with Given the current state, let the stationary distribution be... ,in Constructing distributions from simple proposals For example, generate a candidate sample ;
[0075] Step 3-2: Calculate the probability of accepting the transfer using the MH algorithm. Generate random numbers ,like Then accept candidate samples Otherwise, maintain the original sample. .
[0076] Step 3-3 If the sample is accepted After adjusting the integral contribution weights, the integral contribution weights of the perturbed samples are obtained according to the formula:
[0077]
[0078] In summary, this implementation method, through clear steps and specific parameters, elucidates the complete process of combining spatiotemporal importance resampling with Markov chain perturbation to achieve high-quality, high-efficiency direct illumination dynamic light source sampling. The final light source sample obtained after all the above steps is then used. and its corrected contribution weights Calculate the direct illumination value of the colored point: ,in The total illumination contribution of the light source to the shaded points (including visibility testing, etc.) is calculated. The calculation results for all shaded points are combined to obtain a final rendered image. Those skilled in the art can implement this invention using modern graphics rendering APIs (such as DirectX 12 or Vulkan) and GPU parallel computing frameworks based on this description.
[0079] This invention provides a conceptual approach and method for sampling the spatiotemporal importance of dynamic light sources based on Markov chain perturbations. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.
Claims
1. A dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation, characterized in that, Includes the following steps: Step 1: System initialization and world space mesh construction. The boundary of the 3D mesh is determined based on the world space bounding box of the scene to be rendered, and a uniform 3D mesh covering the scene is constructed. Each mesh cell is associated with a reservoir set, which stores light source sampling information. Step 2: Two-stage spatiotemporal importance resampling. By applying target distribution functions of different precision to the original light pool of the grid cells, the spatiotemporal resampling importance sampling method is applied to perform initial resampling at the grid region granularity and secondary resampling at the specific shading point granularity in turn, to obtain samples that participate in the direct lighting calculation. Step 3: Sample optimization. The samples obtained in Step 2 are perturbed using the Markov chain Monte Carlo method to reduce temporal correlation artifacts without disrupting the original sampling distribution, resulting in perturbed samples. Step 4: Illumination calculation and output. The samples obtained after the perturbation in Step 3 and their corrected integral contribution weights are used to calculate the direct illumination of the shading points.
2. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 1, characterized in that, The parameters associated with the light source samples in the grid cell include the position, weight, cumulative weight, and integral contribution weight required to calculate the illumination.
3. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 1, characterized in that, Step 2 includes the following steps: Step 2-1: Initial resampling of light sources to the grid, and preliminary screening of light source samples in the original light source pool that have potential contributions to the local space; Step 2-2: For the shading points that need to be calculated for direct lighting, the light source samples obtained in Step 2-1 are resampled a second time to obtain samples for calculating direct lighting. Steps 2-3: Merge the grid reservoirs in the current frame with the corresponding grid reservoirs in historical frames, i.e., resample the reservoirs in the spatial domain and reuse the sample information across frames.
4. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 1, characterized in that, The number of historical frames ranges from 3 to 10.
5. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 1, characterized in that, Step 2-1 includes the following steps: Step 2-1-1: Traverse all light sources in the scene and calculate the spatial intersection of their influence range and the mesh cells; Step 2-1-2: For each intersecting grid cell, design the target distribution based on the brightness and distance attenuation characteristics of the light source. : in The brightness of the light source, The distance from the light source to the center of the grid cell; Step 2-1-3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation As the target distribution, the uniform distribution is used as the proposal distribution, denoted as . By using a weighted reservoir sampling algorithm, the original light source pools of the grid cells are initially screened, and the obtained light sources are used as candidate samples to update the associated light source samples in the corresponding grid cells.
6. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 5, characterized in that, Step 2-2 includes the following steps: Step 2-2-1: For each colored point, determine the reservoir set corresponding to the colored point through spatial neighborhood query and trilinear interpolation merging; Step 2-2-2: Design the target distribution based on the light source's brightness, distance attenuation, and the BRDF properties of the shading points. : in The point of color is located in the direction of light incidence. , emission direction The BRDF bidirectional reflection distribution function; Step 2-2-3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] As the target distribution, the same proposed distribution as in step 2-1-3 is used. By using a weighted reservoir sampling algorithm, candidate samples are resampled twice at the granularity of the colored points to select one representative light source sample for each colored point. and their corresponding integral contribution weights .
7. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 6, characterized in that, Step 3 specifically includes: Step 3-1: with Define a stationary distribution for the current state. ,in As a construction distribution, candidate samples z are generated based on the stationary distribution and the construction distribution; where the set of all initial light sources in the scene is represented as the sample set. The set of light sources associated with the grid after initial resampling is represented as the sample set. After secondary resampling, the associated light source of the colored point is ; Step 3-2: Calculate the transfer acceptance rate using the MH algorithm based on the detailed stationary equation. Generate random numbers ,like Then accept candidate samples, let Otherwise, maintain the original sample and let k is the number of perturbation iterations; Step 3-3: Process the received samples After correcting the integral contribution weights, we obtain the integral contribution weights of the perturbed samples: Where M is the number of sample light sources. These are samples used to calculate the direct illumination value.
8. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 7, characterized in that, The sample perturbation in step 3 adopts the following optimization strategy: Single-step perturbation: The Markov chain perturbation is performed only once per sample per frame, balancing performance and effectiveness; Parallel processing: Utilizing the GPU's parallel architecture to perform perturbation operations on multiple shading points simultaneously; Early termination: Set a relative threshold η. When the contribution weight of a sample is lower than η, which is the maximum contribution weight of the local region, it is determined to be a sample with extremely low contribution and the perturbation is skipped.
9. The dynamic light source spatiotemporal importance sampling method based on Markov chain perturbation according to claim 8, characterized in that, The relative threshold η is 0.02.