Bloom/glare filter?

(Alex) #1

I’m looking for replacement for that plugin:
Mainly to get bloom/glare effect on 32bit images.
Similar filters are currently implemented in Luxrender and Mitsuba: (fast image convolution and bloom filter).
Is it currently possible with G’MIC?

(Jonas Wagner) #2

Can you post a before/after example of the effect you are looking to achieve?

In general bloom is emulated by taking an image, discarding the dark parts, bluring it and then adding the blurred version to the original. This can definitely be done using gimp or gmic. You can also convolve using custom kernels:

(Alex) #3

Sure, this is from luxrender manual.

no bloom:

with bloom:

with glare:

I think, that it indeed works by discarding dark parts (or adjusting exposure) and bluring but several times and combining after. Natron compositing software has bloom filter based on clmg library:

Uses the ‘vanvliet’ and ‘deriche’ functions from the CImg library.

Glare effect can be achieved by rotating, blooming only one axis and rotating back.
Although it’s mainly useful for linear 32bit workflow it can also be for photographers after converting to linear (please correct me if I’m wrong).

(David Tschumperlé) #4

According to the documentation, the bloom filter is “similar to applying ‘Count’ separate Blur filters to the same input image with sizes ‘Size’, ‘Size’’Ratio’, ‘Size’’Ratio’^2, etc., and averaging the results.”, which seems to be simple enough to implement in G’MIC. I’ll probably give a try in the afternoon.
I’d like to see the source of this plug-in for Natron, but so far I didn’t managed to find a link to the source file.

(Jonas Wagner) #5

[quote=“David_Tschumperle, post:4, topic:3202”]
I’d like to see the source of this plug-in for Natron, but so far I didn’t managed to find a link to the source file.

I’m not sure about the benefit of doing ‘sums multiple blurs’ rather than just straight convolution with the resulting impulse.
I guess it’s quicker in a typical real time pipeline.

(David Tschumperlé) #6

Ah right, thanks @Jonas_Wagner, I thought the bloom effect was implemented in a separate file.
I don’t think the idea of summing blur is to be quicker, as the blur method used here is not dependent on the blur size (it uses a recursive implementation which works the same for any variance of the corresponding blur kernel).
I’ll try to understand the code, and make a G’MIC filter from it.

(Sebastien Guyader) #7

Hi David,

If you can also replicate the “Glare” effect, that would be cool, for example for adding star spikes to stars in astrophotography shots. Some scripts exist, but their results were not very convincing to me.


If it were to be physically correct, instead of actually discarding the dark parts, you just apply a low-opacity blur in linear gamma.

(Alex) #9

Wow, thank you!
Here is also code for mitsuba:

Can’t find actual code for luxrender, only managed to find this:

I’d like to add, that original Natron filter doesn’t have rotation option so glare filter has to be done with transform nodes. Natron devs made “glare” node that uses bloom filter couple of times and uses transform, mixing and other nodes.
To do it manually you have to add several pipes consisting of rotate-bloom-"un"rotate and combine them with average node. Bloom needs to be set only in one axis (this is internal bloom option).
Also I’ve seen, that in frishluft flair glow filter or in knoll light factory but I don’t remember where exactly it is possible to define intensity and color for 255 areas.

(David Tschumperlé) #10

I’ve implemented the Bloom filter in G’MIC 2.0.0_pre, should be roughly the same as in Natron.
I’ve put it in Degradations / Blur [bloom].

Let me know if that is useful to you :slight_smile:

(Alex) #11

Thank you! It’s almost perfect. Is it possible that you add two-axis amplitude to generate blur in one direction with lock switch and second slider or something? Without two axis it will not be possible to generate sunstars.

(David Tschumperlé) #12

Yes, it should be possible.
Try to refresh your filters, and see if you get the new option

(Alex) #13

I think, that this option should be similar to array -> tiled isolation.
There are two axes with “keep tiles square” checkbox and larger value matters.
So here maybe two upper sliders x and y amplitude and “isotropic” checkbox (default:on) above “normalize scales”.
What do you think?

I’m also not sure how to do rotation without clipping, so maybe angle is also needed. Then it would be possible to run bloom couple of times with different parameter from custom code. However I don’t know how to apply filter always to original image and sum it at the end.

(David Tschumperlé) #14

Something like this maybe ?

(Alex) #15

It’s perfect imo! Thank you so much!

(Alex) #16

@David_Tschumperle: original code limits number of iterations to 10, but in Natron it’s possible to increase it above 10. With lower ratio and more iterations it’s possible to achieve more realistic results. From what I’ve tested amplitude 1, ratio 1.6 and iterations 20 makes really smooth and nice bloom. Maybe this 10 could be something like soft limit only so it’s still possible to enter larger value manually and set max limit to 100?

Could you also add mix amount slider?

(David Tschumperlé) #17

Yes, I’ll do that.

What this slider is intended to do ?

(Alex) #18

Something like layer opacity control. Current mix mode (add) only applies 100% of effect, but intended use is to apply most of original image and only little of effect. I currently just duplicate original layer, apply effect and set opacity inside Krita (easy workaround), but such slider would speed up workflow.