# How to reduce fireflies in Cycles?

I often use Cycles' built in Glass BSDF shader to achieve realistic refraction effects, but in many cases, it seems that Cycles' glass caustics creates an unfortunately large number of fireflies (pixels that are abnormally bright relative to their surroundings). In some models of mine, even when I render for 3000 or more samples/pixel, my final image is still covered in fireflies. While I can improve this in many cases by increasing the total amount of light available in the scene, this loses a lot of the potency of the refractive effects I'm looking for, especially in scenes with low light levels.

So my question is, how can I reduce the amount of fireflies while using Cycles' caustics without sacrificing the quality of the refractive effects?

Note: I am aware that Cycles' caustics will perform much better once Cycles has full support for bidirectional path-tracing, but it looks unlikely that that will become a reality any time soon, unfortunately.

• This is not exactly related, but if you are rendering animations with Cycles, consider animating the Seed Value in the render panel. This will get rid of the static noise pattern and make the noise/fireflies less noticeable, or at least easier to filter out with a good temporal denoiser. – Mike Pan Jul 16 '13 at 22:07
• – cegaton Oct 9 '17 at 14:28

As mentioned on the Reducing Noise in Cycles Wiki Page you could try Filter Glossy or other techniques listed there.

If you're rendering a static image you can use the Seed value for Cycles to save a couple versions of an image and use the data from the second to remove fireflies from the first. See discussion and an example image of that here

I recall a few techniques for this. As mentioned by futurehack you can render twice with low samples using different seed values which puts the fireflies in different locations, when mixed together the fireflies get cancelled out.

An example of two renders with 10 samples and different seed values -

Turning up the filter glossy value (in light paths panel) can help.

Over at CGCookie you may find help with Sebastian's tutorial on reducing caustic noise. To summarize, for the glossy material you can use the 'Is Diffuse Ray' from a Light path node to choose between a glossy or diffuse material. This allows you to still get indirect lighting with 'No Caustics' turned on in the light paths while reducing noise.

I think the most helpful will probably be using the bilateral blur by Bartek. This tutorial gets a bit more in depth with compositing but essentially discusses different ways to define a mask that can be input into a bilateral blur node and which render passes can be blurred and combined for the best result. The determinator input of the bilateral blur node is used to define the edges of the area that gets blurred. This lets you limit the blur to specific areas that for example have fireflies.

• While I don't see BlenderCookie disappearing any time soon adding a short summary is a valid point. – sambler Jul 16 '13 at 7:56
• If you're going to kill all caustics with compositing or using the light paths you may as well just disable Caustics in the render settings completely. – Greg Zaal Aug 19 '13 at 10:29
• @sambler I know this was a while ago, but most links to Blender Cookie are now broken because of their CGC 5 upgrade so it shows that it can happen. – TARDIS Maker Oct 14 '15 at 17:45

If you have fireflies (bright pixels) one option is to use the 'Clamp' option. It can be found in the render settings within the 'Sampling' panel.

The Clamp option will clamp brightness of individual samples (not pixels) to a value set. Value of 0 is disabled.

You will need to adjust the value to suit your scene, a value of 2.0 may be a good start. Too high setting and the firefly will not be eliminated but too low setting and any highlights of your image will be cut off.

Experiment with the value until you can find the highest value which still eliminates the firefly.

The brightness of the firefly sample may be several (or 100x) times brighter than any other in the render. The firefly sample may be only one of the many samples which average to make up the pixel. This is why, in many cases you can cut off the firefly sample without damaging the rest of the image.

• Since I'm working in a low-light setting, the clamp option effectively eliminates all of the highlights from the Glass caustics. I was aware of the clamp option, and I agree that it's really useful, but unfortunately not in my particular circumstances. – Gwen Jul 10 '13 at 23:50

One of the most effective measures against fireflies, especially in scenes with caustics or non-glossy reflections, is to increase the size of the light sources. For example, a sun with a size of .1 will produce significantly less noise and fireflies (and travel through glass a lot better) than a sun with a size of .01. Relevant here is not the absolute size but the view factor, so moving the light closer to your scene but keeping it at a constant size will have the same effect.

At the same time, of course, increasing the lamp size will make shadows softer and might not be what you want in a scene, but it is good to know the correlation so that you can find a sweet spot between the amount of noise and the desired look.

It can be necessary to render the whole scene without the object that has a glass material, and a small light source -- and then re-render the part of the scene with the glass object, with a bigger light source, different sampling settings and a higher total number of samples. Because this will then be a border render and limited in area, it will render a lot faster. Mixing the two renders later is often easily possible with a painted mask in the Blender Compositor or using external software. The only case in which such a solution is not possible or not helpful is when a big part of the scene contains, or is affected by, your glass material.

If you aren't relying on the caustics for something in your render, you can use the Light Path node and it's IsCameraRay output to make that material simply look like glass, but behave differently during path tracing (E.g. Transparent Shader). So it'll look just like a glass shader, but light passing through it will think it's transparent. Here's a tutorial to that effect

Also, once Thomas Dinges' GSoC branch is done and merged, you'll be able to control light bounces per light and per shader, so you could make only certain lights contribute to caustics, or make the glass material only use 3 bounces to reduce some mad number of bounces causing random fireflies.

• The IsCameraRay technique is good, but just to note that if really don't want any caustics, you can disable them in Properties > Render Settings > Light Paths. – gandalf3 Aug 9 '13 at 16:24

You could use the clamp value which can be used to keep samples from returning higher than a certain value. (located in Properties > Render > Sampling)
As most of the time fireflies are much brighter than the rest of the image, this can work reasonably well.

• While the clamp option is generally very useful, it doesn't solve the situation that I'm working with. My particular model has very low light levels, and turning on the clamp setting unfortunately seems to remove the highlights entirely – Gwen Jul 10 '13 at 23:57
• Note that the interface for clamp value has changed in recent versions of blender. Now you can use different settings for clamp direct and indirect. For fireflies I use clamp indirect. Be careful not to use values lower than 1.0 (unless you are going for specific effects), as that will have an impact on the brightness of reflections. Experiment a bit to find what value suits your scene. – cegaton Feb 27 '16 at 2:02

In your specific case, I recommend using Filter Glossy to reduce the fireflies caused by the Glass material as you mentioned. If you want to make a more radical test, you can turn Caustics off and see if that alone will get rid of your fireflies. If that is the case, filtering off the excessive gloss should fix your problem.

If it doesn't, maybe what you need is a larger source of light. Or maybe just bump up your samples. How many are you using for the final render?

Also, have you tried lighting the scene with an HDRI environment?

One last thing: I don't recommend using clamp, because that's kind of a harsh and brute force method. I only do it as a last resource.

As of Blender 2.79, we have the denoiser to work with. I my experience, even if it takes away a tiny bit of detail, most fireflies and noise get removed and the result looks more photorealistic. I could render scenes at 3 times less samples, especially when using 4 digit samples amounts and it looks pretty much the same.

It is supposed to work better and cleaner than the clamp function.

Here a video that introduces the feature: https://www.youtube.com/watch?v=oSZ3C5OTU2E

Here is a link to an article that is specifically for defeating fireflies. It's quick and efficient. Enjoy!

Here are the summarized points:

1. Use bigger light sources

3. Use "Multiple Importance Sampling" for HDRs

4. Use 'Filter Glossy'

5. Check "No Caustics"

6. Use "Clamping"

7. More Samples

https://www.blenderguru.com/articles/7-ways-get-rid-fireflies?rq=fireflies

• Can you please summarise the key points in the link. We don't like link only answers here. – Sazerac Jun 12 at 1:27