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

Author Topic: Question about Drawable colouring  (Read 2238 times)

0 Members and 2 Guests are viewing this topic.

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Question about Drawable colouring
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question about Drawable colouring
« Reply #1 on: May 23, 2009, 02:55:53 pm »
Quote
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 = ?
...
Laurent Gomila - SFML developer

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Question about Drawable colouring
« Reply #2 on: May 23, 2009, 06:25:41 pm »
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)

Quote from: "Laurent"
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Question about Drawable colouring
« Reply #3 on: May 24, 2009, 12:52:55 pm »
According to your description, i.e. that a component is kept if it is multiplied by 0, it would rather give that:
Quote
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
Quote
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?
Laurent Gomila - SFML developer

 

anything