Archived

This topic is now archived and is closed to further replies.

eckax

Transparency and setting alpha component

Recommended Posts

eckax    122
Hello I think I have figured alpha blending out pretty much. I need to have a texture with a color in the texture with an alpha value of zero? Then I set the blendstates and then I have alpha blending! It works for me at least, but another question is how do I set the alpha component in the texture, I have used the DxTex tool up to this point where I have made the original picture in photoshop and then made the same picture but with a black color in the background and a white color for everything that will be visible. Then I copied this onto the alphasurface of the texture. Is this what everyone else is doing? Can I somehow set the alpha component in photoshop or any other writing progam?? BTW, my card doesn''t seem to support the D3DFMT_A1R5G5B5 format. I want my program to be in 16 bits but the only format I can use is D3DFMT_R5G6B5. This though doesn''t seem to have an impact on my alpha blending. Just trying to sort out some things so I can fully understand alpha blending --------------------------------------------- These are not the droids you''re looking for ---------------------------------------------

Share this post


Link to post
Share on other sites
DrunkenHyena    805
G''day!

Photoshop can export PNGs which have an alpha component in them. Just make your image in photoshop with transparency the way you want it then export.

Alternately you can use a format like BMP if you just want a colour key (all black is transparent) and use D3DXCreateTextureFromFileEx, it allows you to specify a colour key.

Your card has to support a format with alpha or you''d get no blending. It won''t support D3DFMT_A1R5G5B5 for the primary surface, but may for textures. Otherwise it''ll be using D3DFMT_A4R4G4B4 (which I don''t really like) or D3DFMT_A8R8G8B8.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
eckax    122
Thanks
If I would load a PNG then I wouldn''t be able to use the D3DXCreateTextureFromFileEx function, or??? If not what library could I use because I don''t thin I could load it myself even though I had the file format specification, which I already have. I''m lazy and just want''s the job done, I will do it myself sometime .

Okay, I thought it was very strange that I could have blending when my primary surface lacked alpha values. But how do I know what format my texture uses? Does it create the texture with the default format that was before I created my device? If someone would know this out of his head I would be grateful because I''m to tired right now to check it myself.

BTW, great tutorials Drunken Hyena, looking forward to the alpha blending tutorial, maybe I will understand it fully afterwards !
CYA all

---------------------------------------------
These are not the droids you''re looking for
---------------------------------------------

Share this post


Link to post
Share on other sites
DrunkenHyena    805
G''day!
quote:
Original post by eckax
If I would load a PNG then I wouldn''t be able to use the D3DXCreateTextureFromFileEx function, or??? If not what library could I use because I don''t thin I could load it myself even though I had the file format specification, which I already have. I''m lazy and just want''s the job done, I will do it myself sometime .



D3DXCreateTextureFromFileEx does load PNGs, it''s very nice.

quote:

Okay, I thought it was very strange that I could have blending when my primary surface lacked alpha values. But how do I know what format my texture uses? Does it create the texture with the default format that was before I created my device? If someone would know this out of his head I would be grateful because I''m to tired right now to check it myself.



If you don''t specify the format to use it will check the file and use an appropriate format. With D3DXCreateTextureFromFileEx you can specify the format you''d like to use.

quote:

BTW, great tutorials Drunken Hyena, looking forward to the alpha blending tutorial, maybe I will understand it fully afterwards !



Thank you. The first alpha tutorial should be up any day now.



Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites