Page 1 of 1

Texture Transparency

Posted: Sun Dec 09, 2012 11:11 pm
by Samuel
This is probably a dumb question, but is there a way to turn a color transparent on a texture. For example if you create a blue background with a red circle in the middle.
Can you turn that blue transparent so you only see the circle?
I know you can have transparent textures. If you load a image that already has alpha on it, but I'm not sure if you can turn a texture color transparent after its been created or loaded.
I do this with sprites all the time, but I've never seen it done with textures.

Re: Texture Transparency

Posted: Mon Dec 10, 2012 4:31 am
by Shield
First, I have no idea about what's possible with PB's engine, I never used it and I will never use it.
However if I wanted to do what you describe, I'd use a pixel shader to change the colors.

Re: Texture Transparency

Posted: Mon Dec 10, 2012 9:23 am
by Comtois
Look at CreateTexture2.pb in your folder Examples\3D. It does exactly what you are looking for.

or here if you need to play with shaders.

Re: Texture Transparency

Posted: Mon Dec 10, 2012 6:32 pm
by Samuel
Thank you, Comtois. That example was exactly what I was looking for.
I thought I looked through all the examples, but I guess I'm blind because I don't remember seeing that one.