PDA

View Full Version : texture with transparent color?



bansheeogl
05-16-2005, 05:39 AM
hi i have a texture quad, the texture has a text (says "HELLO") and its background is all black (0,0,0) .. I want the black become transparent how can i do this? so if i put a cube and a quad textured with the text i can see both text and cube.

can this be done easly??

Aeluned
05-16-2005, 06:05 AM
I think you have 3 choices (you'll need an RGBA texture)
1) pre-process your texture, changing all bytes with a color of 0,0,0,x to 0,0,0,0.
2) Use an alpha channel.
3) write a fragment shader that does the texturing and set all fragment's alpha to 0 that sample 0,0,0 from the texture.

bansheeogl
05-16-2005, 06:33 AM
my image exporter exports bitmap 24bits only
i dont think this format can handle alpha data??

so theres no other way? blending etc?

Aeluned
05-16-2005, 07:56 AM
You don't need an RGBA (32-bit) texture for method 3.

You sample the texture, if the color rgb = 0,0,0 don't apply the texture (i.e. the fragment color stays the color of the material).

You'll need a 32-bit (alpha enabled) Pixel Format Descriptor though - but I can't imagine you're not using one those.