Hi,
I've been taking a few stabs at implementing thresholding for bloom, as requested in issue #631.
The straight forward method is to apply a threshold before blurring and then add this to the base image weighted by bloom amount. This however adds energy and isn't very physical.
The correct method is to use a sharp, almost delta-like, but very wide filter, ie with long non-zero lobe(s). This then has to be used with a very large radius. No thresholding is involved, instead one would use the bloom radius to control this. This method is also easy to implement but is horribly slow, unless we use FFT I guess which would be somewhat more involved.
I've managed to make a slightly hackish method using variable-width filters where the filter width is determined based on the ratio between the pixel Y and the threshold Y (as determined as a fraction of the maximum Y). The hackish part is that the method for selecting the filter width is fairly arbitrary. So far this seems to work well for thresholds above 0.4, but can lead to artifacts when using lower thresholds. May be related to my code though. It's also fast since only a small fraction of the pixels are filtered using wide filters. However it needs more testing.
I'd like some feedback as to what we should go for. If we go the FFT route (if possible) then the FFT library/routines can be used for other things, I recall there were some mantis tasks which would also need FFT.
I've attached some images using my "hack". The bloom amount was set very high to emphasize the effect.
