<p>Disclaimer: I am assuming that you are implementing a classical Monte Carlo estimator.</p>
<h2>The Problem</h2>
<p>Discarding samples will change PDF of your sampling technique. You are cutting off part of the sampled domain where PDF is non-zero, which effectively leads to a trimmed version of the original PDF but implicitly re-normalized so the remaining part integrates to 1. If you don't adjust the directly evaluated PDF accordingly, it will lead to a biased estimator.</p>
<p>Practically speaking, implicit re-normalization increases the actual sampling PDF <span class="math-container">$p^{new}$</span>, and if you use <span class="math-container">$p^{old}&lt;p^{new}$</span> in your computations instead, the resulting Monte Carlo estimator will yield brighter values than it should:</p>
<p><span class="math-container">$$
\frac{f(x)}{p^{old}(x)} &gt; \frac{f(x)}{p^{new}(x)}
$$</span></p>
<h2>A solution</h2>
<p>Since adjusting the PDF isn't an easy thing to do, you will most likely need to <strong>treat the under-surface samples as valid but with zero contribution</strong>. Whether you handle this within your BRDF/BSDF or elsewhere in the renderer is your design decision.</p>
<p>Zero-contribution samples will, obviously, introduce some inefficiency in your renderer.</p>
<h2>A better solution</h2>
<p>You can improve the efficiency of your estimator by using a better sampling technique which tries to avoid creating samples under the surface. In case of the GGX normal distribution, there have been proposed some solutions by Eric Heitz | Eugene d’Eon in paper <a href="http://www.eugenedeon.com/project/importance-sampling-microfacet-based-bsdfs-using-the-distribution-of-visible-normals/" rel="nofollow noreferrer">Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals</a>. I believe there was one improved version of this technique (other that the one mentioned in the &quot;Related Work&quot; section) but I cannot recall the name of it. Maybe someone else can add it here...</p>

CC BY-SA 4.0
2020-09-10T02:42:34.650Z
I've wrestled a little bit with this issue myself but never came to a good conclusion. What would be the effect of reflecting the below hemisphere samples via the surface normal (e.g. flip the normal for that case) ?
PaulHK
CC BY-SA 4.0
2020-09-10T11:09:05.693Z
@PaulHK, that's a very good question. Reflecting your samples will change the actual shape of the PDF, not just scale as for cutting samples. You would have to adjust PDF evaluation (which should be doable), but it will degrade the importance sampling somehow for grazing angles. It's a matter of practical testing to find out which approach is better.
ivokabel
CC BY-SA 4.0
2020-09-11T17:41:45.143Z
I suppose if the reflected ray starts from a small distance/epsilon above the surface the ray would re-collide with the same surface, albeit from a more scattered incoming angle.
PaulHK
CC BY-SA 4.0
2020-09-09T16:47:00.620Z
2020-09-09T17:16:22.673Z
2020-09-09T17:16:22.673Z
ivokabel
<p>I generate random directions from the pdf of D term in GGX BRDF. On the picture, white dots are new directions and the cross is the light direction, with roughness = 1. What should I do with the directions that are generated below the hemisphere? Should and can I just discard them?</p>
<p><a href="https://i.sstatic.net/UUAaT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UUAaT.png" alt="Sampled directions" /></a></p>

<raytracing><pathtracing><brdf><ggx>
What should I do when a new sampled direction is below a normal oriented hemisphere?
Gregory Ginzburg
# What should I do when a new sampled direction is below a normal oriented hemisphere?

(Asked by: username_0 on 2020-09-09)

I generate random directions from the pdf of D term in GGX BRDF. On the picture, white dots are new directions and the cross is the light direction, with roughness = 1. What should I do with the directions that are generated below the hemisphere? Should and can I just discard them?

[![Sampled directions](https://i.sstatic.net/UUAaT.png)](https://i.sstatic.net/UUAaT.png)

**Tags:** raytracing, pathtracing, brdf, ggx


---

## 1 answers

### Answer by username_1 on 2020-09-09. Score: 2 | Accepted answer

Disclaimer: I am assuming that you are implementing a classical Monte Carlo estimator.

## The Problem

Discarding samples will change PDF of your sampling technique. You are cutting off part of the sampled domain where PDF is non-zero, which effectively leads to a trimmed version of the original PDF but implicitly re-normalized so the remaining part integrates to 1. If you don't adjust the directly evaluated PDF accordingly, it will lead to a biased estimator.

Practically speaking, implicit re-normalization increases the actual sampling PDF $p^{new}$, and if you use $p^{old}<p^{new}$ in your computations instead, the resulting Monte Carlo estimator will yield brighter values than it should:

$$
\frac{f(x)}{p^{old}(x)} > \frac{f(x)}{p^{new}(x)}
$$

## A solution

Since adjusting the PDF isn't an easy thing to do, you will most likely need to **treat the under-surface samples as valid but with zero contribution**. Whether you handle this within your BRDF/BSDF or elsewhere in the renderer is your design decision.

Zero-contribution samples will, obviously, introduce some inefficiency in your renderer.

## A better solution

You can improve the efficiency of your estimator by using a better sampling technique which tries to avoid creating samples under the surface. In case of the GGX normal distribution, there have been proposed some solutions by Eric Heitz | Eugene d’Eon in paper [Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals](http://www.eugenedeon.com/project/importance-sampling-microfacet-based-bsdfs-using-the-distribution-of-visible-normals/). I believe there was one improved version of this technique (other that the one mentioned in the "Related Work" section) but I cannot recall the name of it. Maybe someone else can add it here...

> **Comments:**
> **username_2**: I've wrestled a little bit with this issue myself but never came to a good conclusion. What would be the effect of reflecting the below hemisphere samples via the surface normal (e.g. flip the normal for that case) ?  
> **username_1**: @username_2, that's a very good question. Reflecting your samples will change the actual shape of the PDF, not just scale as for cutting samples. You would have to adjust PDF evaluation (which should be doable), but it will degrade the importance sampling somehow for grazing angles. It's a matter of practical testing to find out which approach is better.  
> **username_2**: I suppose if the reflected ray starts from a small distance/epsilon above the surface the ray would re-collide with the same surface, albeit from a more scattered incoming angle.  

---

