Forum

How to change colors of a texture?

hi vvvvorums,

how can i control the colors of a file texture seperate ?
like r g b channels, but with fading ? or interpolate from color to grayscale ?

i cannot think of a way other than using a pixelshader. with such a shader it would be rather straightforward since you get access to the rgba components of each pixel and can do with it whatever you want.

ah. you could have your texture prepared twice. once in color. once in grayscale. displayed on quads on top of each other (blendmode: blend) and then adjust the alpha color component of the upper quad.

or enter a spread with three slices (red, green + blue) to your graphics primitive. use blend mode. the colors add up to white, but you can change the alpha of the three colors individually.

pixel shaders and color matrix transforms would be preferred though
(if your card supports it)

hi mr. Oschatz,
your solution doesn’t work with my :-P graphics chip,
but this one:

same as yours but i use Blend (EX9.Renderstate Advanced) instead with #0000bb:Alpha Blending: 1 , #0000bb:Source Blend Mode: SrcAlpha , #0000bb:Destination Blend Mode: SrcAlpha and i don’t change the alpha values but R,G,B on each slice.

the technique should work with any graphics card, but i most likely explained some detail wrong. you just probably got it right.

also quite fun to connect a spread to the translation of the three images to simulate some obsolete video projectors…

ps. amazing güllerührer you have hidden here on the wiki… :)