SFML community forums

Help => General => Topic started by: Pixel_Outlaw on July 29, 2014, 08:37:21 am

Title: Additive blending with a twist...
Post by: Pixel_Outlaw on July 29, 2014, 08:37:21 am
I think most here are familiar with additive blending. This is just addition of colors' components to simulate light.

        RED  (255, 0, 0)
+     BLUE (0,     0, 255)
-----------------------
= MAGENTA (255, 0, 255)


It can be used to make things glow when they overlap.

However I find that there are interesting cases, when one channel maxes out and the result is no lighter:
BLUE (0, 0, 255) + BLUE (0, 0, 255) = BLUE (0, 0, 255)

Ideally it would be nice if some of that extra could bleed over proportionately into the other channels
BLUE (0, 0, 255) + BLUE (0, 0, 255) = LIGHT BLUE (128, 128, 255)

Is there a known color mode of blending that describes this?

I don't think SFML has a way to do a custom blending like this but my idea is to not just blend RGB but to add to the overall light "intensity" as colors are added.




Title: Re: Additive blending with a twist...
Post by: Laurent on July 29, 2014, 08:59:12 am
You're right, SFML can't help you with this unconventional blending mode.

But the way you want to do it is strange, if you add blue to blue to blue to blue... you end up with white? ???