少女祈祷中...

Multiple Importance Sampling Estimator

The estimator is defined as:

$$ \text{estimator} = \sum_{i=1}^{n} \left[ \frac{1}{\text{num\_samples\_strategy}_i} \sum_{j=1}^{\text{num\_samples\_strategy}_i} \left( \frac{\text{weight\_function}(i, X_{i,j}) \cdot \text{target\_function}(X_{i,j})}{\text{probability\_density}(i, X_{i,j})} \right) \right] $$

Where:

  • $ n $: Total number of sampling strategies
  • $ \text{num\_samples\_strategy}_i $: Number of samples taken using strategy $ i $
  • $ X_{i,j} $: The $ j $-th sample generated by strategy $ i $
  • $ \text{weight\_function}(i, X_{i,j}) $: Weight function for strategy $ i $ and sample $ X_{i,j} $
  • $ \text{target\_function}(X_{i,j}) $: The target function we aim to estimate
  • $ \text{probability\_density}(i, X_{i,j}) $: Probability density function of strategy $ i $ at $ X_{i,j} $

Conditions for Unbiasedness

To ensure that the estimator is unbiased, the following two conditions must be satisfied:

Condition 1

$$ \sum_{i=1}^{n} \text{weight\_function}(i, x) = 1 \quad \text{for all} \, \text{target\_function}(x) \neq 0 $$

Condition 2

$$ \text{weight\_function}(i, x) = 0 \quad \text{if and only if} \, \text{probability\_density}(i, x) = 0 $$

Common Choices for the Weight Function

Uniform Weights

$$ \text{weight\_function}(i, x) = \frac{1}{n} $$

Binary Weights

$$ \text{weight\_function}(i, x) = \begin{cases} 1 & \text{if certain condition is met} \\ 0 & \text{otherwise} \end{cases} $$

Balance Heuristic

$$ \text{weight\_function}(i, x) = \frac{\text{probability\_density}(i, x)}{\sum_{k=1}^{n} \text{probability\_density}(k, x)} $$

Power Heuristic

$$ \text{weight\_function}(i, x) = \frac{\text{probability\_density}(i, x)^\beta}{\sum_{k=1}^{n} \text{probability\_density}(k, x)^\beta} $$

Balance Heuristic Explained

The balance heuristic ensures the weights are normalized based on the relative importance of each sampling strategy. The formula is:

$$ \text{weight\_function}(i, x) = \frac{\text{probability\_density}(i, x)}{\sum_{k=1}^{n} \text{probability\_density}(k, x)} $$

Where:

  • $ \text{probability\_density}(i, x) $: Probability density of strategy $ i $ at sample $ x $.
  • $ \sum_{k=1}^{n} \text{probability\_density}(k, x) $: Sum of all strategies’ probability densities at $ x $.

Explanation:

  • Numerator: The contribution of strategy $ i $ to the sample $ x $, based on its probability density.
  • Denominator: The total contribution of all strategies at $ x $, ensuring the weights are normalized across all strategies.

This approach balances the influence of each strategy on the final estimate, depending on the relative density contributions.

Sampling Strategy Coverage and Unbiasedness

  1. Condition: $\text{weight\_function}(i, x) = 0 \iff \text{probability\_density}(i, x) = 0$

    • This condition states that:

      • If a particular sampling strategy $i$ cannot generate a sample point $x$ (i.e., $\text{probability\_density}(i, x) = 0$),
      • Then the weight assigned to $x$ by that strategy must also be zero (i.e., $\text{weight\_function}(i, x) = 0$).
    • In simpler terms: Only strategies capable of generating a sample point $x$ contribute to its weight.

  2. Do All Paths Need to Be Covered by All Strategies?

    • The idea that all possible paths (samples) must be covered by every sampling strategy to ensure unbiasedness seems overly strict.
    • In reality:
      • Unbiasedness only requires that every path $x$ can be generated by at least one sampling strategy, not necessarily by all strategies.
  3. Using Partially Covering Strategies

    • “Can we use sampling strategies that do not cover all possible paths?”
      • The answer is yes, as long as the following condition for unbiasedness is satisfied:
        • Every path $x$ must be generable by at least one sampling strategy.
        • For strategies unable to generate certain paths, their probability density and corresponding weights must be zero.

Next Event Estimation (NEE)

The Fundamental Problem

  • Light source sampling works well for direct lighting.
  • However, path tracing primarily deals with indirect lighting.
  • Indirect lighting means every surface could act as an indirect light source.
  • This makes it challenging to apply light source sampling directly, as there are infinitely many potential light sources.

NEE’s Solution

  • At each shading point, use two strategies together:
    1. BRDF Sampling: To find directions for indirect lighting.
    2. Light Source Sampling: To directly sample known light sources at each hit point.
  • The essence is to separate direct lighting and indirect lighting.
  • Key insight: Indirect lighting is essentially future direct lighting from other bounces.

Workflow Example (Single Area Light Scene)

After a view ray hits a point P:

  1. Compute Direct Lighting:

    • Directly sample the light source.
    • Calculate the contribution from the light source to point P.
  2. Compute Indirect Lighting:

    • Use BRDF sampling to select a new direction.
    • Repeat the NEE process (recursively) at the new hit point.
  3. Final Result:

    • Direct lighting contribution + Indirect lighting contribution.

Optimization of Hemisphere Sampling

  • Light source sampling handles the part of the hemisphere corresponding to the light source projection.
  • BRDF sampling handles other directions that may contribute to indirect lighting.
  • This division makes sampling more efficient.

Implementation Highlights

  • Recursively apply NEE in path tracing.
  • Perform light source sampling at each hit point.
  • Add the results of light source sampling and recursive hemisphere sampling.
  • Use BRDF importance sampling to select directions for indirect lighting.

Advantages

This method effectively combines the strengths of BRDF sampling and light source sampling, enhancing rendering efficiency and accuracy.

Efficient Path Tracing (NEE) with the Balance Heuristic

Core Idea

  • Combine light source sampling and BRDF sampling at every bounce.
  • Do not choose one method over the other; use both techniques simultaneously for better results.

Key Steps in the Process

  • Light Source Sampling:
    • Always performed at each bounce to gather direct light contributions.
  • BRDF Sampling:
    • Used to determine indirect lighting.
    • Indirect BRDF samples can be treated as direct BRDF samples for the next bounce.

The Role of the Balance Heuristic

  • Compute probabilities for samples chosen by both techniques.
  • Use the balance heuristic to assign proper multiple importance sampling (MIS) weights to each contribution.
  • Ensures a fair balance between the contributions of light source sampling and BRDF sampling.

Challenges and Solutions

  • Different Evaluation Times:
    • BRDF sample contributions are calculated when hitting an emitting surface.
    • Light source sampling contributions are computed one bounce earlier.
  • Proper MIS Weight Application:
    • When using a BRDF sample to compute direct light for the previous bounce:
      • Ensure that the MIS weight from the previous bounce is applied to the calculated emittance.
      • Track relevant properties of the previous bounce to apply the correct computations one bounce later.