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

Author Topic: How might I implement a "subtraction" blend mode?  (Read 1323 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
How might I implement a "subtraction" blend mode?
« on: January 05, 2011, 09:23:54 am »
While looking through the SFML tutorials, I've noticed that it offers some blending modes. I was wondering if it is possible to create a blending mode that subtracts the values of the source from the destination? Is there a way to do this for a Sprite? I know an entire shader can be written but is there a way to do such a thing for just one Sprite object? I'm trying to create the effect of transparent material layers that darken. Something like how stacking colored plastic sunglasses lenses gives a darker result.  8)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How might I implement a "subtraction" blend mode?
« Reply #1 on: January 05, 2011, 09:27:56 am »
There's no such a blending mode in SFML, but you can get the same result by drawing a semi-transparent black sprite -- the more opaque, the darker.
Laurent Gomila - SFML developer

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
How might I implement a "subtraction" blend mode?
« Reply #2 on: January 05, 2011, 10:39:05 am »
Thanks Laurent.

I just wanted to make sure that I wasn't missing something.

 

anything