<p>I'm using a renderer developed by other people, and I found there are fireflies. It is strange that in a completely diffuse scene, there are still fireflies presented.</p>

<p>To my understanding, I think it is possible to have fireflies in diffuse scene depending on what sampling strategy I use. For example, if I use a very small area light, and the probability of hitting the light by sampling the BRDF will be very small, resulting in an extremely large radiance value. (I'm not sure because I also heard that fireflies will not appear in complete diffuse scene, so correct me if I'm wrong!)</p>

<p>I'm trying to locate the bug, if there are any, or improve the program, if the fireflies come with some reason. But after googling for a while, most things I found was how to fight fireflies, other than clearly analyzing where they come from.</p>

<p>I was wondering if anyone knows any good materials, or if you could kindly summarize a bit. </p>

<p>I'm particularly interested in the sources of the fireflies related to the sampling strategies, BRDF sampling, light sampling or MIS.</p>

<p>I also think fireflies should be considered separately with <strong>noise</strong>, since they also seem to be caused by numerical stability (from <a href="https://en.wikipedia.org/wiki/Fireflies_(computer_graphics)" rel="noreferrer">Wiki</a>).</p>

CC BY-SA 4.0
2019-03-25T09:41:33.333Z
Does the renderer use NEE aka Next Event Estimation or Explicit Direct Light Sampling? Because from the looks of it, it doesn't. And that's prolly the biggest reason. If you use NEE, you don't have to worry about the probability of hitting a light source based on the BRDF. What you heard might possibly be true for NEE renderers. Since I can't think of any way a NEE implemented renderer will produce fireflies in a completely diffuse scene
gallickgunner
CC BY-SA 4.0
2019-03-25T16:13:47.327Z
@gallickgunner Hi thanks for the comment. Yes I spent lot time reading some materials yesterday and might have figured out some thing.. But first could you explain what is the difference between NEE and Explicit Direct Light Sampling? Because from my understanding I think NEE is just doing DI explicitly, instead of waiting for the renderer to find a hit on emitters..
AccM
CC BY-SA 4.0
2019-03-25T16:16:11.663Z
Yeah you understood correctly. Both are the same thing.
gallickgunner
CC BY-SA 4.0
2019-03-25T16:20:34.283Z
@gallickgunner What I learned is that, for diffuse surfaces, we only consider BRDF sampling in intermediate vertices, and do light sampling at the last path vertex. If we use NEE, even if we use a point light, the pdf of light sampling would be 1.0, therefore, no small pdf would occur along the entire path and thus there will not be extremely highlight (fireflies). So I summarize a bit: fireflies will only appear when there are glossy materials. (please correct me if wrong!)
AccM
CC BY-SA 4.0
2019-03-25T17:31:14.697Z
The pdf would be zero for any direction choosen randomly. It's 1 for the direction that is specifically shot at the point light source. And yes afaik, there won't be any fireflies in a diffuse scene if you use NEE.
gallickgunner
CC BY-SA 4.0
2019-03-25T20:42:59.777Z
Can you post an image to illustrate what you mean and some code/pseudo-code for the relevant part to sampling/scattering?
lightxbulb
<pathtracing><brdf><sampling><noise>
Where do "fireflies" come from?
AccM
# Where do "fireflies" come from?

(Asked by: username_0 on 2019-03-24)

I'm using a renderer developed by other people, and I found there are fireflies. It is strange that in a completely diffuse scene, there are still fireflies presented.

To my understanding, I think it is possible to have fireflies in diffuse scene depending on what sampling strategy I use. For example, if I use a very small area light, and the probability of hitting the light by sampling the BRDF will be very small, resulting in an extremely large radiance value. (I'm not sure because I also heard that fireflies will not appear in complete diffuse scene, so correct me if I'm wrong!)

I'm trying to locate the bug, if there are any, or improve the program, if the fireflies come with some reason. But after googling for a while, most things I found was how to fight fireflies, other than clearly analyzing where they come from.

I was wondering if anyone knows any good materials, or if you could kindly summarize a bit.

I'm particularly interested in the sources of the fireflies related to the sampling strategies, BRDF sampling, light sampling or MIS.

I also think fireflies should be considered separately with **noise**, since they also seem to be caused by numerical stability (from [Wiki](https://en.wikipedia.org/wiki/Fireflies_(computer_graphics))).

**Tags:** pathtracing, brdf, sampling, noise

> **Comments:**
> **username_1**: Does the renderer use NEE aka Next Event Estimation or Explicit Direct Light Sampling? Because from the looks of it, it doesn't. And that's prolly the biggest reason. If you use NEE, you don't have to worry about the probability of hitting a light source based on the BRDF. What you heard might possibly be true for NEE renderers. Since I can't think of any way a NEE implemented renderer will produce fireflies in a completely diffuse scene  
> **username_0**: @username_1 Hi thanks for the comment. Yes I spent lot time reading some materials yesterday and might have figured out some thing.. But first could you explain what is the difference between NEE and Explicit Direct Light Sampling? Because from my understanding I think NEE is just doing DI explicitly, instead of waiting for the renderer to find a hit on emitters..  
> **username_1**: Yeah you understood correctly. Both are the same thing.  
> **username_0**: @username_1 What I learned is that, for diffuse surfaces, we only consider BRDF sampling in intermediate vertices, and do light sampling at the last path vertex. If we use NEE, even if we use a point light, the pdf of light sampling would be 1.0, therefore, no small pdf would occur along the entire path and thus there will not be extremely highlight (fireflies). So I summarize a bit: fireflies will only appear when there are glossy materials. (please correct me if wrong!)  
> **username_1**: The pdf would be zero for any direction choosen randomly. It's 1 for the direction that is specifically shot at the point light source. And yes afaik, there won't be any fireflies in a diffuse scene if you use NEE.  
> **username_2**: Can you post an image to illustrate what you mean and some code/pseudo-code for the relevant part to sampling/scattering?  

---

## 0 answers

