Exponential Glow


first post; new to the therapee - I love it!

My background is in vfx and one thing we use in vfx all the time is glow. I love glow and it would be great to be able to create one in RawTherapee.

First question: Is there already a glow and I missed it?

The basic way to add glow is to blur the image and adding it back again.
The better more natural looking glow got an exponential falloff, which can be achieved by “stacking” multiple blurs with different blur sizes.

I only have a little bit of coding experience, but I want to help making this. Maybe it’s great way to get more into C++ coding and start contributing to RawTherapee.

A starting point would be a fast blur, which I guess is already implemented.
Question: What would be a suitable blur implementation? Is there an existing blur for this?


We never say no to that :smiley:
There is no simple glow module in RT currently, but I suspect it would be possible to create a similar effect through the use of other tools. Some creativity would be required, maybe using Wavelets? In any case, feel free to experiment with adding code.

We never say no to that :smiley:

I really appreciate this attitude. RawTherapee is such an awesome project. How could I missed it so long. <3
I have to learn/read much more about it and study the source code.


In compositing exponential Blurs (or their approximations) combine several gaussian blurs with different half width and strength to generate the exponential kernel. It would surprise me if there isn’t an analytic way of doing this (or a better and faster approximation). Or go from linear-light to logarithmic and convolve with a triangular(1D)/conic(2D) blur kernel?

Hmm. Yeah it would be useful to figure out if there is a way to have a single blur kernel, as opposed to a bunch of separate kernels - although I guess it depends on if it’s sequential or parallel? If parallel, probably easy to precalculate a “single pass” kernel. If sequential - well it might be more difficult since precalculating the kernel would probably result in a kernel with HUGE dimensions.

Is there a good description somewhere of exactly what “exponential glow” is mathematically?

I once implemented a better gaussian blur bloom module for darktable but it never got merged. It used blur in linear brightness space, and let you individually set radius and opacity for each color channel.

In any case, for large radius blurs in Filmulator I use a 7-pass repeated box blur. It’s simply more stable than the infinite-impulse-response ones, which lose accuracy at large radii.

Hm, that’s surprisingly hard to find. I always assumed that the resulting 2D-PSF was not a gaussian (or an approximation of it using multiple sequential box-blur passes in subsequent x and y direction) but a rotationally symmetric exponential decay. The Video above seems to suggest this too.

I found this paper from 2000/2001 which talks about it. Basu and Su (2000)
(The 2Dpsf’s they plot don’t show rotational symmetry though which I find weird and frankly…wrong!?)

Blurring in a non-linear brightness space is not energy conserving and should produce artefacts. Has been done out of lazyness too many times. Every simple USM algo does this and I would object against it.
Surprising that it did not get merged, faster and better and in linear-light should be the bees knees.

Also, there is this nice paper comparing gaussian blur approximations, their quality and speed: Getreuer (2013)
Funnily the Alvarez-Mazorra method at lower orders, has a 1D psf that looks a lot like an exponential decay (but is also not rotationally symmetric).

It would have needed an awkward cherry-pick, I was trying to get filmulation into darktable at the time.

It would be absolutely trivial to do again now. I made it on a whim, and the results were great, letting you get a beautiful warm glow for portraits.


Might not be so bad, perhaps exponentially expanding kernel sizes of a gaussian blur in iteration. Multiply and then log, similar to some retinex algorithm. Example in g’mic:

blur_exp : skip ${1=1.6},${2=5}
  repeat $! l[$>] lim={im},{iM} sub {im-1}
    repeat $2 +b[0] {exp($>*$1)} mul[-2,-1] done log n $lim
  endl done

Needs a bit of ranges fixing but that can be handled…

Edit: fixed as per comment from @afre below

1 Like

Minor typo l[$>]?

Minor tidbit: quasi-gaussian has preferential blur on the horizontal and vertical axes, so I typically use the true gaussian. The speed difference is negligible.

1 Like

If the iop plugin api hasn’t changed, maybe you can just drop this file into the latest darktable…

(also wow that was a long time ago)

Over at steakunderwater.com (Compositing Forum. They use Fusion) a guy (Midgardsormr) Made an exponential glow.
First he states:
People ask for an exponential glow all the time. The available macro is slow, and it’s something I’ve been eyeing for a while as a Fuse project. I don’t have the best eye, though, so I thought I’d open it up for commentary. Attached is the current state of my fuse. It’s significantly faster than the macro. Fusion’s blur method is really good; I experimented with scaling the input image down prior to blurring, as the macro does, and as is suggested in a few articles on HDR bloom effects for games, but the two scales took longer than the blur itself.
(Thread: https://www.steakunderwater.com/wesuckless/viewtopic.php?f=17&t=3275 Seems you have to be logged in )
Those are the Adjustments one can make to the glow:
Mode : The Exponential mode spreads faster and generally has a less intense core.

Threshold : Values below the low end of the Threshold will not glow. Values above the high end will glow with maximum strength. There is a gradual falloff of glow strength from high to low.

Gain : Pre-process on the source image. This occurs after the threshold.

Source Saturation : Pre-process on the source image. It doesn’t affect the actual source image, but it does modify the color that is used to perform the blurs.

Glow Saturation : Strength of a progressive desaturation of the glow—colors will become more or less intense with each iteration.

Glow Size : The initial blur kernel size. X and Y glow kernels can be unlocked and adjusted separately if desired.

Iterations : The number of glows to perform.

Falloff : The rate at which the brightness of the glow decreases.

Gradient : The glow can be recolored with this control. The first iteration will be the color of the left edge, and the final iteration will add the color of the right edge. The gradient is additive, so you may not wind up with exactly the colors you’re expecting.

Glow Only : Turns off the Merge onto the original source image, leaving only the glows.

com.MuseVFX.XGlow.zip (5.3 KB)


1 Like

Ha ha, the site has an interesting name for its forum.


Speaking of which, @Reptorian is a sucker for replicating filters.

1 Like

There is absolutely no shortage in the compositing world of people implementing their own version of it. For Nuke there is the same plethora of people going for this. I understand it, the end result looks much better than a simple gaussian blur.

The Basu and Su paper above is the only one I found which kind of tries to rationalize why it might look better (the argument goes a bit in the direction of ‘it looks more constant when changing the viewing scale and we see that in the fourier spectrum of the first derivative of the image there is some self-similarity to the fourier spectrum of the image itself’).

The Fusion user base is small, but full of nice and humble people! :smiley:

just in case anyone is interested, I’ve added a “Glow” mode to the smoothing filter of ART, based on ideas discussed in this thread. (It required just a few lines of code, so I thought “why not”?).
Here’s a little demo – I’m not sure how physically accurate it is, but it seems it can produce a nice effect on portraits… (well, also an ugly one, depending on how you use it :slight_smile:



You can also - as pointed out by @Thanatomanic , use Wavelet.

For example, in “Local adjustments” - “wavelet”… you can use “Bur by levels” with a curve.
You can adjust the level of detail to blur, as you wish, from the thinnest to the thickest; from the thickest to the thinnest, or otherwise, and of course associated or not with deltaE, or a mask.


…if you really want to analytically describe the effect of scattering in the medium, you’d be looking for eugene’s time quantised diffusion: http://www.eugenedeon.com/project/qd/

which explains why it’s important to use a sum of gaussians.


I tried to follow your tips but can’t get anything glowy looking using a build from this morning. Any further hints?

Nice one!
So it’s physically more accurate to use an exponential glow if one is mimicking real world scattering. What a neat result. Thanks for digging this up!