Glow along path

Hello,

What is the best method to add glow along a path in Juce?
For example to achieve something like this :

https://ibb.co/HXQkN0P

Thanks

There’s the juce::GlowEffect class:

https://docs.juce.com/master/classGlowEffect.html

It applies to images, so you’d have to render your path to an image first, then apply the effect, then draw the image.

If you do that for all objects, I guess that eats tons of ressources, am I wrong?

It’s all done on the CPU so yeah it will be quite sluggish if you’re updating the effect very often.

If the effects aren’t likely to change then you should use juce::Component::setBufferedToImage() on the components in which the effect is being drawn which may help.

@jules : Jules, any idea of what would be the best optimized way to do that please? :wink:

you could create just 2 images, one with the pure lines and one where you have down- and then upscaled that image back to normal with highResamplingQuality because that will make it hella blurred. the normal line-image would be transparent in the background so that you can easily dial in the amount of glow by setting the opacity of the other image that sits below it without having to recalculate glow amounts or skipping through arrays of a lot of images

Yes but this seems very ressource hungry Mrugalla

idk, i think it would only require to down- and upscale once, save that into a new image and then only draw them on top of each other with different opacity settings. that usually doesn’t eat too much cpu or ram imo, but if you feel like it does you could also work with openGL

I’ve recently made a UI for a new plugin with lots of glow.
What I did was stroking a path using a gradient ellipse.

bigKnob
Screenshot 2021-05-13 at 15.22.46
Screenshot 2021-05-13 at 15.22.59
Screenshot 2021-05-13 at 15.23.17

2 Likes

Hello @jesusginard

Seems interesting, do you have some basic code example please, not sure what you mean by “stroking a path”?

Thanks

sorry to bring up such an old topic, but could you assist me with applying something like you did here for the path, this is exactly what Im looking for but Im blocked