Prevention is better than post processing with a script like this, know your cycles settings.
- don’t have an emitter emit pure white (1.0, 1.0, 1.0, 1.0)
- avoid using any value at 100% (1.0 out of 1.0 or 255 of 255 etc…)
- if you can clamp, clamp.
- light your scene in a realistic way, read up on studio / set lighting techniques.
- read the tool tips in the render panel, they will tell you a lot about the parameters themselves
- using a complex material node will slow down processing. Unless it is deliberate - simplify.
- understand every part of your node setup, if you can eliminate a node without noticing. do.
If you have firefly infested images you would like to donate, I am accepting image examples for calibration. Images don’t need to be big - or even full originals -, but they do need to be at least 9px by 9px with the firefly in the center so i can sample the nearest neighbours. Preferably not jpeg/jpg. png/tiff/tga are fine and welcome.
script in progress:
download link on github
The speed of the script is a function of how many ‘fireflies’ it finds.
In strict mode, if a pixel has a bounding pixel that is beyond a strength of (rgba= .97, .97, .97, 1.0) then the pixel is rejected and not considered to be a firefly. With strict mode set to False, any number of bounding pixels may be bright.
The method as it stands is naive, the more examples you can send me - the better the algorithm can be trained.
- Around the last line the script looks for ‘pixeltest4’ , replace that with your image name.
- Hit run script
- Click the image in the image editor so it updates.
- bugfixed, but i welcome examples of failure!
- added filenotfound handler, will prompt in the console / terminal for user input ( if interactive )
- added a switch to disable interactive mode for batch processing
- added a strict mode to reject pixels with bright neighbours as fireflies
- set default to strict mode, interactive, non-debug
- could be a bit smarter about colour mixing, take into account the most common colour
- i’m itching to refactor and do things much simpler.
- The first image is described here as a bug report, if for whatever reason you have a similar issue and don’t want to rerender - this script will fix your image.
This is with strict mode set to False, it removes even touching bright spots.
With strict mode on, bright pixels that touch other bright pixels are not considered fireflies