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?
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? 🙂
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.
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.
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.