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

Author Topic: Color blending problem with shaders  (Read 1118 times)

0 Members and 1 Guest are viewing this topic.

ast

  • Newbie
  • *
  • Posts: 20
    • View Profile
Color blending problem with shaders
« on: April 02, 2015, 09:25:49 pm »
Hello all,

I have done some experimenting with SFML and shaders. The goal is to make a sprite to be surrounded with a colored glowing light. Following the example in 

http://thedaftdev.com/entry-13-SFML-and-shaders.-.html


I manage to get the shader working. I draw first all sprites and a green background to a RenderTexture, from which I take the drawn texture with getTexture() and make it a sprite. Then I draw this sprite to RenderWindow using the shader and blendMode BlendAdd. This all works well but the glowing light is supposed to be red but when it is blended with green background it appears to be yellow. With black background the light is red. This is all fine, the colors are numbers and add up like that, but the question is, how I can make the light to be the color I want regardless of the background? I am sure this is a well known problem and has good answers already, but they seem to be hard to find.

Thanks for the great library, SFML is awesome!

Regards,
ast

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Color blending problem with shaders
« Reply #1 on: April 02, 2015, 09:32:53 pm »
Not directly related to your question, but I was reminded of this when I saw it:   :D

 

anything