transparent color how?
How do I tell OpenGL which color in my bitmaps (textures) to consider transparent?
_________karx11erxVisit my Descent site or see my case mod.
quote: Original post by Anonymous Poster
Would you please tell me how you solved the problem?
You shoud loop trough all of your picture''s pixels and serch for the one''s that are suposed to be transparent, when you find them you yust increase alpha value to 1.0f - and that''s it
P.S.
Don''t forget that doing this requires for your image to be in RGBA format not RGB !
Red Drake
That''s all well and good, but is there any way to create a "semi-transparent" pixel within a bmp? In RGBA format, you should be able to set a range of alpha values per pixel. So what if I want some pixels to be only 50% transparent. I should use an alpha value of 0.5f for them. But this doesn''t work for me. It seems like I can only achieve full opacity or full transparency (0.0f or 1.0f alpha) for a pixel. It makes things look really weird with anti-aliased bmps. And dithering is just cheating. We''re not in the 80''s anymore, I should be able to achieve this without dithering. Let''s say I''m using the bmp as a texture.
So the question boils down to: How can I display RGBA format bmps (or tgas) with semi-transparent pixels?
So the question boils down to: How can I display RGBA format bmps (or tgas) with semi-transparent pixels?
THE swoish
quote: Original post by psycho-babble
That''s all well and good, but is there any way to create a "semi-transparent" pixel within a bmp? In RGBA format, you should be able to set a range of alpha values per pixel. So what if I want some pixels to be only 50% transparent. I should use an alpha value of 0.5f for them. But this doesn''t work for me. It seems like I can only achieve full opacity or full transparency (0.0f or 1.0f alpha) for a pixel. It makes things look really weird with anti-aliased bmps. And dithering is just cheating. We''re not in the 80''s anymore, I should be able to achieve this without dithering. Let''s say I''m using the bmp as a texture.
So the question boils down to: How can I display RGBA format bmps (or tgas) with semi-transparent pixels?
How about storing RGBA format in your TGA file - tough this will not help if you hawe errors with previous method - you shoud realy try downloading new drivers for your grap. card becouse if you can''t display semi-transparent pixel''s somthing is terably wrong.
Red Drake
June 17, 2004 09:12 AM
No, the card has no problem displaying them. I've played plenty of games that get it right. I just can't seem to create the effect myself using OGL. There's nothing wrong with the way I write my files. There's nothing wrong with the way I read my files. I make an RGBA texture and I think I'm getting the right alpha test, but the pixels are never semi-transparent. They are either fully opaque or fully transparent. I'm just not doing the code right.
June 17, 2004 09:19 AM
Enable blending, alpha testing and blending are two diff things,
alpha testing kills all pixels that doesn't pass the test.
alpha testing kills all pixels that doesn't pass the test.
Alpha Testing is a binary process which either renders a pixel or doesn't depending on the fragment's alpha value. You want to be using Alpha Blending which produces an output pixel which is a function of the existing pixel from the framebuffer and the incomming fragment and can therefore be used to simulate translucency.
Enigma
Enigma
For a game, the easiest way would be to store textures in an RGB bitmap and define the "transparent color". For instance, Sid Meyer's Civilization (if you look at the graphics files) uses purple as the transparent color.
Just create your textures in 24 bit format, interpret some constant color (such as pitch black) as a transparent pixel and create the alpha channel based on that.
Just create your textures in 24 bit format, interpret some constant color (such as pitch black) as a transparent pixel and create the alpha channel based on that.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement