How to add a selective glow effect that works with dark colors too?

Hello, I am attempting to create an effect where certain line materials or sprite materials can glow. The problem is that most of the examples I have found are relying on intense colors to create a glow effect (similar to real life), where instead I want any color to be able to glow. For instance, in CSS, you can use a shadow to basically add a border glow to any object, even if that “glow” is black. Using an example like this, you could never make a color like black bloom as far as I have tried. And if you lowered the threshold enough so that even black could glow, then any color would also be able to glow making things non-selective.
Does anyone know of any method such that I can achieve a selective glow effect similar to how it’d be done with CSS? I know that’s an odd ask, but it’s the best example I can think of where you can make any color glow.

If you are crazy enough, you could try:

  • fake bloom effect (it may have any color, lighter or darker than the rest of the scene). An example of fakeness: https://codepen.io/boytchev/full/ExdmvxE
  • be negative – use the bloom on the inverted scene (so the dark object is bright and the bloom is bright), then again invert it (thus the bloom becomes dark).
1 Like

That’s beautiful, but with thousands of objects I’m certain that’d turn my computer into an aluminum puddle :joy:

I see, you are not crazy enough. A third approach is to start with a bloom shader and modify it. Maybe playing with blending modes could make dark bloom?

BTW, inverting the colors of a scene does not care about the number of objects drawn. The fake bloom, unfortunately, cares. A lot.

That might work, but it definitely feels like trying to wrangle the bloom shader to do something it isn’t originally meant to do. I guess I’m looking for a shader which applies to an object, doesn’t modify the object itself but instead mixes the surrounding pixels with a combination of its base color and the color of the background behind it. Perhaps this has a different name than bloom?