PDA

View Full Version : Turning specific color in Texture into transparency



sacredPenguin
02-10-2005, 12:19 AM
Hi,

I've a question. How can i define that a specific color in a texture is transparent. Example: I've got a texture with the white character R on it and it has got a purple backgroud. now i don't want the purple part to be visible, i'd like it to be transparent.

Can somebody help???

Pleyse excuse my really bad english ;)

samv
02-10-2005, 12:53 AM
Short answer: use an alpha channel.

Long(ish) answer: Create the texture in RGBA format. Set the A value to 255 to mean visible and 0 to mean completely transparent. Enable ALPHA_TEST. Set AlphaFunc to GREATER, 0.5 (and/or enable BLEND and set BlendFunc to SRC_ALPHA, ONE_MINUS_SRC_ALPHA in case you want semi-transparent parts too). Make sure TexEnv for that texture is set to REPLACE or you will have to think about setting Color4 in a sensible way too.