<p>If your bunny is purely specular, then sampling the light directly at the shade point would give no contribution since the specular BSDF is a delta BSDF. It generally evaluates to zero for any direction other than the mirror direction. If it was a glossy BSDF, then it might be possible that the pdf value could be very small so that the monte-carlo estimator <span class="math-container">$\frac{f(X)}{P(X)}$</span> just explodes (which is generally the source of fireflies i.e having a very small pdf and the function is large).</p>

<p>If it was a mirror direction, then you should just see a black bunny for direct illumination and just the reflection of the surrounding scene for multiple bounces. Multiple bounces from the specular bunny should not be cause fireflies, because if you're sampling based on cosine term at the matte surface, the estimator becomes <span class="math-container">$\frac{L_i(X)f_r(X)\cos(\theta_i)}{\text{pdf}(\theta_i)}$</span>, where <span class="math-container">$\theta_i$</span> is the sampled direction using BSDF sampling at the matte surface. The pdf and the <span class="math-container">$\cos(\theta_i)$</span> should cancel out each other perfectly. However since you're using a point light, you can never sample from the BSDF since the light is a delta light and needs an explicit connection. Hence the pdf for the estimator would be 1 all the time. The only way for large values to creep up are in the numerator. So I would suggest you to check the values by increasing bounce one by one to see when the problems start creeping in.</p>

CC BY-SA 4.0
2018-11-15T03:42:40.713Z
2018-11-15T03:42:40.713Z
sriravic
<p>I'm testing my path tracer for specular surfaces. Images rendered with my own code have very noisy appearance, and I think they look like variance.</p>

<p>I use point light and the bunny is of mirror material, walls are matte. If it is the problem with sampling, how should I modify the program. To my understanding, point lights are specially handled and thus the sampling results should be a constant value. So I don't think the noise is caused by light sampling. So could there be any bugs?</p>

<p>When only matte material exists in the scene, there are also variance, but not that bad, and global illumination effects are visible. So what could the problem?</p>

<blockquote>
  <p>specular bunny:</p>
</blockquote>

<p><a href="https://i.sstatic.net/PLlZu.jpg" rel="noreferrer"><img src="https://i.sstatic.net/PLlZu.jpg" alt="enter image description here"></a></p>

<blockquote>
  <p>matte bunny:</p>
</blockquote>

<p><a href="https://i.sstatic.net/LH2Ei.jpg" rel="noreferrer"><img src="https://i.sstatic.net/LH2Ei.jpg" alt="enter image description here"></a></p>

<p>For the specular bunny image, spp is 4. Since it is a point light, wi is directly set to the vector between point light and intersection point when calculating direct illumination, so there is actually no "sampling". When computing scattering directions, BRDF is matte when intersecting the wall, and BRDF is specular reflection when the ray hit the bunny.</p>

<p>Matte BRDF is cosine weighted sampled, while specular reflection just use the perfect reflection direction.</p>

CC BY-SA 4.0
2018-11-13T07:23:09.993Z
Do the fire flies get darker after more samples or are they stuck at white? That would suggest a NAN has been output.
PaulHK
CC BY-SA 4.0
2018-11-13T14:23:28.190Z
@PaulHK Yes they get darker but still exists. Does that suggest anything?
jinglei
<raytracing><pathtracing><sampling>
High variance in path tracing specular objects
jinglei
# High variance in path tracing specular objects

(Asked by: username_0 on 2018-11-12)

I'm testing my path tracer for specular surfaces. Images rendered with my own code have very noisy appearance, and I think they look like variance.

I use point light and the bunny is of mirror material, walls are matte. If it is the problem with sampling, how should I modify the program. To my understanding, point lights are specially handled and thus the sampling results should be a constant value. So I don't think the noise is caused by light sampling. So could there be any bugs?

When only matte material exists in the scene, there are also variance, but not that bad, and global illumination effects are visible. So what could the problem?

> specular bunny:

[![enter image description here](https://i.sstatic.net/PLlZu.jpg)](https://i.sstatic.net/PLlZu.jpg)

> matte bunny:

[![enter image description here](https://i.sstatic.net/LH2Ei.jpg)](https://i.sstatic.net/LH2Ei.jpg)

For the specular bunny image, spp is 4. Since it is a point light, wi is directly set to the vector between point light and intersection point when calculating direct illumination, so there is actually no "sampling". When computing scattering directions, BRDF is matte when intersecting the wall, and BRDF is specular reflection when the ray hit the bunny.

Matte BRDF is cosine weighted sampled, while specular reflection just use the perfect reflection direction.

**Tags:** raytracing, pathtracing, sampling

> **Comments:**
> **username_1**: Do the fire flies get darker after more samples or are they stuck at white? That would suggest a NAN has been output.  
> **username_0**: @username_1 Yes they get darker but still exists. Does that suggest anything?  

---

## 1 answers

### Answer by username_2 on 2018-11-15. Score: 5

If your bunny is purely specular, then sampling the light directly at the shade point would give no contribution since the specular BSDF is a delta BSDF. It generally evaluates to zero for any direction other than the mirror direction. If it was a glossy BSDF, then it might be possible that the pdf value could be very small so that the monte-carlo estimator $\frac{f(X)}{P(X)}$ just explodes (which is generally the source of fireflies i.e having a very small pdf and the function is large).

If it was a mirror direction, then you should just see a black bunny for direct illumination and just the reflection of the surrounding scene for multiple bounces. Multiple bounces from the specular bunny should not be cause fireflies, because if you're sampling based on cosine term at the matte surface, the estimator becomes $\frac{L\_i(X)f\_r(X)\cos(\theta\_i)}{\text{pdf}(\theta\_i)}$, where $\theta\_i$ is the sampled direction using BSDF sampling at the matte surface. The pdf and the $\cos(\theta\_i)$ should cancel out each other perfectly. However since you're using a point light, you can never sample from the BSDF since the light is a delta light and needs an explicit connection. Hence the pdf for the estimator would be 1 all the time. The only way for large values to creep up are in the numerator. So I would suggest you to check the values by increasing bounce one by one to see when the problems start creeping in.


---

