Texture Transparency

Everything related to 3D programming
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Texture Transparency

Post 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.
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Texture Transparency

Post 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.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Texture Transparency

Post 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.
Please correct my english
http://purebasic.developpez.com/
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Texture Transparency

Post 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.
Post Reply