Thursday, February 5, 2015

Bloom post filter


People ask me questions about support for various post-processing effects. In general, post processing of resulting image is simple thing: take the image and render it again as texture with post filter shader enabled. The first post filter was CRT shader, but here I had unsolved problem with shader itself. Recently I requested to make bloom filter. I found a simple open source bloom shader, which implements some custom algorithm. It works like this:

The shader has no controls, blurs almost everything and produces very strong bloom effect. Demo video:

The shader is good for demonstration, but practically unusable due to highly overexposed result. I started to dig deeply. I found that theoretical article explaining how bloom should work. Proper bloom post-filter is multi-pass; cite: "Take the input image and create a thresholded version of it, setting pixels below a specific threshold to black. Then blur the result and add it to the original image". Practical implementation for blur and blend is taken from devmaster.net. The result is much softer and the colors are much more natural than with the previous variant:

It also has lots of settings to adjust the result for your taste. Demo video will be available later.