<p>Recently I feel a bit confused about one-sample model MIS. One sample model MIS can be found here in <a href="https://graphics.stanford.edu/courses/cs348b-03/papers/veach-chapter9.pdf" rel="nofollow noreferrer">Veach 1997. 9.2.4 The one-sample model</a>, and this one-sample model is widely used in the opensource renderers, for example: the combination of BSDF sampling and emitter sampling in mitsuba2/3 and pbrt, path connection in BDPT for mitsuba and pbrt, etc. Basically, the estimator is:</p>
<p><span class="math-container">$$
\frac{w_I(X)f(X)}{c_Ip_I(X)}
$$</span>
<span class="math-container">$c_I$</span> is the discrete PMF for choosing <span class="math-container">$I$</span>th sampling strategy, <span class="math-container">$p_I(·)$</span> is the PDF for the <span class="math-container">$I$</span>th sampling strategy. This is reasonable, since I can easily prove that with several unbiased estimator, the one-sample model is unbiased. Here I present a simple case where balance heuristic is used:</p>
<p><span class="math-container">$$
\mathbb{E}\left(\frac{w_I(X)f(X)}{c_I p_I(X)}\right) = \int\frac{\frac{p_1(X)}{p_1(X)  + p_2(X)}f(X)}{p_{c_1} p_{1}(X)}\times \left(p_{c_1} p_1(X)\right) + \frac{\frac{p_2(X)}{p_1(X) + p_2(X)}f(X)}{p_{c_2} p_{2}(X)}\times \left(p_{c_2} p_2(X)\right)dX = \int \frac{p_1(X) + p_2(X)}{p_1(X) + p_2(X)}f(X) dX= \int f(X) dX
$$</span></p>
<p>My problem is:</p>
<ul>
<li><p>From the opensource renderers, I find that the one-sample model used in them <strong>only samples via one strategy (other strategies have zero probability to get sampled)</strong>. For example:</p>
<ul>
<li>In path tracer NEE, we only use emitter sampling (and we don't actually sample BSDF when doing NEE). This can be found in pbrt-v3 and mitsuba2/3.</li>
<li>In BDPT path connection, we only sample &quot;once&quot; and calculate the weight for that exact path.</li>
</ul>
</li>
<li><p>Is this correct for one specific strategy to have zero probability to be sampled? I know that <span class="math-container">$p_{c_I}$</span> in the nominator and denominator will cancel each other out, but it still doesn't feel right.</p>
</li>
<li><p>If I use balance heuristic, the estimator can actually be simplified when we only use one strategy to sample (the corresponding discrete PMF is 1):</p>
</li>
</ul>
<p><span class="math-container">$$
\frac{\frac{p_1(X)}{p_1(X) + p_2(X)}f(X)}{p_{1}} = \frac{f(X)}{p_1(X) + p_2(X)} &lt; f(X) / p_1(X)
$$</span>
My problem for the eqn above is: Can I say that using one-sample MIS with heuristic will produce smaller mean-value than the original Monte Carlo estimator? Since I know that the original estimator is unbiased, doesn't this indicate that the one-sample MIS which samples via only one strategy is biased? Did I misunderstand anything here?</p>

CC BY-SA 4.0
2023-07-02T11:30:40.320Z
It should be unbiased since you have the probability for picking this specific strategy out of all also included in there. As an example imagine having to pick between sampling the diffuse and specular part of a brdf. You can do a biased coinflip in order to pick one or the other, that's what the $c_i$ accounts for. The combination weights $w_i$ can also be anything as long as they sum to 1. As far as variance goes, note that if you have a low probability sample then $\frac{1}{p_1}$ explodes, but $\frac{1}{p_1+p_2}$ doesn't necessarily, essentially resulting in lower variance.
lightxbulb
CC BY-SA 4.0
2023-07-02T12:08:57.700Z
My point is, I have two strategies but one of the strategy has zero probability to be sampled. Then the resulting estimator will be $\frac{f(x)}{p_1(x) + p_2(x)}$, which is always less than $f(x) / p_1(x)$ but both are unbiased. This contradiction confuses me.
Enigmatisms
CC BY-SA 4.0
2023-07-02T12:28:36.620Z
I don't think you are allowed a zero probability. Even just for $p_1$ and $p_2$ you are allowed to have zero probability only over a set of measure zero.
lightxbulb
CC BY-SA 4.0
2023-07-02T12:47:29.013Z
I think this is what's done in NEE. For example, in the path tracer of pbrt-v3, when one interaction point is decided, we directly connect it with a light source. Yet, in the code, they only do emitter sampling and no BSDF/phase function sampling. I think this would mean that BSDF/phase function sampling have zero probability to be sampled. The code can be found [here: pbrt-v3/core/integrator.cpp-line119-EstimateDirect](https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/integrator.cpp#L119C58-L119C58), actually this is also true for mitsuba2/3.
Enigmatisms
CC BY-SA 4.0
2023-07-02T12:52:02.917Z
They have multiple cases, and there is no discrete pmf here as far as I can see. If the light is a Dirac delta then you cannot sample it with bsdf, so then you're essentially just sampling with $p_2$, it's equivalent to setting $p_1=0$ since tge weight is then just $1$. In the cases where it's standard sampling I believe they combine NEE with non-zero probability strategies. That is, I don't think they ever have $c_i = 0$.
lightxbulb
CC BY-SA 4.0
2023-07-02T13:10:45.250Z
Thanks for you reply, and yes, I know they don't have discrete pmf, and suppose they do have no zero probability strategy, then can I do something like this: for example, I have two ways to sample mean free path in a scattering medium, but actually I don't want to use the 2rd sampling strategy to generate samples. I generate the distance sample only with the 1st strategy but still evaluate the result using MIS and pretending that the probability for the 2rd strategy is extremely low but non-zero. This way, the formula won't be mathematically invalid and I can use MIS, too. Is this correct?
Enigmatisms
CC BY-SA 4.0
2023-07-02T13:19:51.953Z
What would be the purpose of that? If you want to use only a single strategy then you cannot use MIS. Similar to how they do not use MIS for Dirac deltas.
lightxbulb
CC BY-SA 4.0
2023-07-03T03:01:39.367Z
Oh, yeah, Dirac deltas. I think you are right, thanks a lot.
Enigmatisms
<rendering><mathematics><sampling><pbr><importance-sampling>
One-sample model Multiple Importance Sampling with balance heuristic
Enigmatisms
# One-sample model Multiple Importance Sampling with balance heuristic

(Asked by: username_0 on 2023-07-02)

Recently I feel a bit confused about one-sample model MIS. One sample model MIS can be found here in [Veach 1997. 9.2.4 The one-sample model](https://graphics.stanford.edu/courses/cs348b-03/papers/veach-chapter9.pdf), and this one-sample model is widely used in the opensource renderers, for example: the combination of BSDF sampling and emitter sampling in mitsuba2/3 and pbrt, path connection in BDPT for mitsuba and pbrt, etc. Basically, the estimator is:

$$
\frac{w\_I(X)f(X)}{c\_Ip\_I(X)}
$$
$c\_I$ is the discrete PMF for choosing $I$th sampling strategy, $p\_I(·)$ is the PDF for the $I$th sampling strategy. This is reasonable, since I can easily prove that with several unbiased estimator, the one-sample model is unbiased. Here I present a simple case where balance heuristic is used:

$$
\mathbb{E}\left(\frac{w\_I(X)f(X)}{c\_I p\_I(X)}\right) = \int\frac{\frac{p\_1(X)}{p\_1(X) + p\_2(X)}f(X)}{p\_{c\_1} p\_{1}(X)}\times \left(p\_{c\_1} p\_1(X)\right) + \frac{\frac{p\_2(X)}{p\_1(X) + p\_2(X)}f(X)}{p\_{c\_2} p\_{2}(X)}\times \left(p\_{c\_2} p\_2(X)\right)dX = \int \frac{p\_1(X) + p\_2(X)}{p\_1(X) + p\_2(X)}f(X) dX= \int f(X) dX
$$

My problem is:

* From the opensource renderers, I find that the one-sample model used in them **only samples via one strategy (other strategies have zero probability to get sampled)**. For example:

  + In path tracer NEE, we only use emitter sampling (and we don't actually sample BSDF when doing NEE). This can be found in pbrt-v3 and mitsuba2/3.
  + In BDPT path connection, we only sample "once" and calculate the weight for that exact path.
* Is this correct for one specific strategy to have zero probability to be sampled? I know that $p\_{c\_I}$ in the nominator and denominator will cancel each other out, but it still doesn't feel right.
* If I use balance heuristic, the estimator can actually be simplified when we only use one strategy to sample (the corresponding discrete PMF is 1):

$$
\frac{\frac{p\_1(X)}{p\_1(X) + p\_2(X)}f(X)}{p\_{1}} = \frac{f(X)}{p\_1(X) + p\_2(X)} < f(X) / p\_1(X)
$$
My problem for the eqn above is: Can I say that using one-sample MIS with heuristic will produce smaller mean-value than the original Monte Carlo estimator? Since I know that the original estimator is unbiased, doesn't this indicate that the one-sample MIS which samples via only one strategy is biased? Did I misunderstand anything here?

**Tags:** rendering, mathematics, sampling, pbr, importance-sampling

> **Comments:**
> **username_1**: It should be unbiased since you have the probability for picking this specific strategy out of all also included in there. As an example imagine having to pick between sampling the diffuse and specular part of a brdf. You can do a biased coinflip in order to pick one or the other, that's what the $c_i$ accounts for. The combination weights $w_i$ can also be anything as long as they sum to 1. As far as variance goes, note that if you have a low probability sample then $\frac{1}{p_1}$ explodes, but $\frac{1}{p_1+p_2}$ doesn't necessarily, essentially resulting in lower variance.  
> **username_0**: My point is, I have two strategies but one of the strategy has zero probability to be sampled. Then the resulting estimator will be $\frac{f(x)}{p_1(x) + p_2(x)}$, which is always less than $f(x) / p_1(x)$ but both are unbiased. This contradiction confuses me.  
> **username_1**: I don't think you are allowed a zero probability. Even just for $p_1$ and $p_2$ you are allowed to have zero probability only over a set of measure zero.  
> **username_0**: I think this is what's done in NEE. For example, in the path tracer of pbrt-v3, when one interaction point is decided, we directly connect it with a light source. Yet, in the code, they only do emitter sampling and no BSDF/phase function sampling. I think this would mean that BSDF/phase function sampling have zero probability to be sampled. The code can be found [here: pbrt-v3/core/integrator.cpp-line119-EstimateDirect](https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/src/core/integrator.cpp#L119C58-L119C58), actually this is also true for mitsuba2/3.  
> **username_1**: They have multiple cases, and there is no discrete pmf here as far as I can see. If the light is a Dirac delta then you cannot sample it with bsdf, so then you're essentially just sampling with $p_2$, it's equivalent to setting $p_1=0$ since tge weight is then just $1$. In the cases where it's standard sampling I believe they combine NEE with non-zero probability strategies. That is, I don't think they ever have $c_i = 0$.  
> **username_0**: Thanks for you reply, and yes, I know they don't have discrete pmf, and suppose they do have no zero probability strategy, then can I do something like this: for example, I have two ways to sample mean free path in a scattering medium, but actually I don't want to use the 2rd sampling strategy to generate samples. I generate the distance sample only with the 1st strategy but still evaluate the result using MIS and pretending that the probability for the 2rd strategy is extremely low but non-zero. This way, the formula won't be mathematically invalid and I can use MIS, too. Is this correct?  
> **username_1**: What would be the purpose of that? If you want to use only a single strategy then you cannot use MIS. Similar to how they do not use MIS for Dirac deltas.  
> **username_0**: Oh, yeah, Dirac deltas. I think you are right, thanks a lot.  

---

## 0 answers

