SFML community forums
Help => Graphics => Topic started by: nitram_cero on May 23, 2009, 02:45:12 pm
-
Is there a way in SFML or OpenGL to make the colouring (i.e. SetColor) to affect more the blacker texels instead of the whiter ones?
I get that by default is some sort of: result_texel=src_texel * color
and I'm looking for something like: result_texel=((1,1,1,1) -s rc_texel) * color
Is there a way? thanks!
-MartÃn
-
and I'm looking for something like: result_texel=((1,1,1,1) -s rc_texel) * color
This formula is wrong: even if you multiply by a neutral color, your texels will be modified (inverted).
You should give more details about what you want to achieve:
white * white = ?
red * white = ?
white * black = ?
red * black = ?
...
-
Common behaviour:
any color * white = same color
any color * black = black
white * red = red
black * red = black
red * blue = black
Wanted behaviour:
any color * white = white
any color * black = same color
white * red = white
black * red = red
red * blue = red
---------------------
R: result component (R, G or B)
T: texture pixel component (R, G or B)
C: assigned color component (R, G or B)
Default is:
R = T * C/255
What I was looking for:
R = T * (1.0 - C/255)
even if you multiply by a neutral color, your texels will be...
If multiplied by medium-gray, it yields the same result as the default behaviour.
-
According to your description, i.e. that a component is kept if it is multiplied by 0, it would rather give that:
any color * white = black
any color * black = same color
white * red = black
black * red = red
red * blue = magenta
According to your formula, R = T * (1 - C), it would give that
any color * white = black
any color * black = same color
white * red = cyan
black * red = black
red * blue = red
So it's still not clear for me :)
What effect do you want to achieve?