Removing Cycles Fireflies

5

This article will cover a much-needed addition to Blender’s up-and-coming photo-realistic renderer, Cycles. You’ll learn about the new “Clamp” parameter (added in 2.63), what it does, and how to use it.

You will need Blender 2.63 or later to use this feature.
Download the latest version from www.blender.org.

Amongst all the excitement over B-Mesh, you may have missed a small feature that snuck quietly into the latest release. It’s exceedingly simple to use and provides a fast way to get rid of fireflies in Cycles without using any type of post-processing.

What Are Fireflies?

Fireflies...

So, to begin, if you’ve ever used glass or glossy materials in Cycles (with caustics turned on, of course) and rendered more than about ten passes, you will have encountered fireflies. And not the fun type that you put in jars, either. These fireflies are overly bright pixels — one of the quirks of Cycles’ light-simulating algorithms — and just generally mess up your entire scene. Unlike noise, which clears up more the longer you render, fireflies don’t go away. Although each individual firefly usually disappears after about a hundred passes, by then, other fireflies have taken its place.

A casual observer might ask you why your image has those “specks”. They really shouldn’t be there, after all. They’re just plain ugly. Real photographs have a small amount of noise, but you won’t find such fireflies in them. Fireflies turn attention away from your artwork and towards nasty artifacts.

I’ve spent a great deal of time trying (or, as Yoda, would say, doing not) to remove them with compositing, but to no avail. They wouldn’t go away. The closest I got was by using GIMP‘s despeckle filter, but that eroded the image a bit, making it only slightly less of an eyesore than with the large firefly population.

My coder-mind began cooking up ideas on how to keep pixels brighter than a user-defined threshold from being added into the image (on a per-pass basis). My rational mind told myself I didn’t know anything about submitting patches, let alone writing C code!

After downloading a pre-release SVN build and playing around with it a bit, I was shocked to notice that my idea (I’d never even told anyone about it) had been implemented! I guess great minds think alike? πŸ™‚

Using Clamp

Clamp off (0.00) -- fireflies abound

Here’s the important part of this article — if you’re only going to read half, read this half.

Blender 2.63 makes it ridiculously easy to remove fireflies. Let’s look at how Blender handles color to use the “Clamp” value most efficiently.

If you’re unfamiliar with High Dynamic Range (HDR) lighting, basically it stores high-precision RGB (red, blue, and green) values for each pixel, so unlike most image formats, which store RGB values from 0 to 255 (as that is the greatest range of details you’ll find in screens currently), HDR formats store values from 0.0000000 to 1.0000000. This is what Blender uses internally.

Clamp at 1.00 -- too low for this scene

Cycles, as noted here, likes to return values greater than 1.000. If you look at fireflies’ color values in Blender’s image editor, you’ll notice just how extremely overblown they are — some have values greater than 100!

So you figure you’ll just clip it at 1.000 and be done with fireflies forever, right? Well, not so fast… Cycles may sometimes return values greater than 1.000 for some non-firefly pixels, so you’ll need to experiment with your own scenes as to what cut-off value would be best. Usually anywhere from 1.0 to 2.0 will serve your scene well and exclude fireflies from your renders.

Clamp at 1.50 -- a good value for this scene

Well, that’s all there is to it. As I said, it’s really easy! It doesn’t even add anything on to render times. All you need is a basic understanding of how Blender deals with color, some experimentation, and you’re set.

A big thank you to Blender developer Brecht van Lommel for adding this simple yet incredibly useful feature!

Thanks for reading — leave your comments below.

5 Comments on Removing Cycles Fireflies

  1. Julianne said:

    Will this remove the fireflies from my gem scene too? And if it will, should I make the ‘clamp’ value higher since the gems have a lot of sparkly reflectiony stuff?

  2. Austeregrim said:

    So, fireflies are caustics. That when you use a glass object, the light from the scene is being reflected and refracted, and they actually belong in the scene.

    The randomness of these caustics is because you haven’t sampled them out long enough with cycles rendering. It is actually light that belongs, and would make your render more realistic if you’re using glass materials… for reflections and refractions of light.

    Clamping can remove the fireflies for those who are impatient or don’t care. But if you want a scene with realistic reflections from your glass materials, leave them in, and render them out.

    • Peter said:

      Well, in some scenes I’ve had as many fireflies after 1000 passes as I did at 100. The noise was clearing up, but the fireflies were not. Then again, I’m not the best at lighting, and I’ve heard that bad lighting can increase the amount of fireflies one gets.

      Clamping can remove the fireflies for those who are impatient or don’t care.

      That’s probably me in most cases. πŸ˜›

      Thanks for reading!

  3. K said:

    How to find Clamp settings?
    Where do I find it?

Comments are closed.