Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Additive blending with a twist...  (Read 1340 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Additive blending with a twist...
« 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.





Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Additive blending with a twist...
« Reply #1 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? ???
Laurent Gomila - SFML developer