Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using transparency with textures

Started by RelisH Oct 16, 2001 at 11:36 PM 3 replies 200+ views
Original Post
RelisH
RelisH
yes, I know that this question has been asked many times, and I searched for it and I''ve tried what the people have suggested. I''ve tried adding SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE); and a few other suggested lines before I go into my render loop, but they don''t seem to work. I''m using a 32 bit TGA file that has an alpha channel that has spots all over it so some parts should be transparent and others not. The texture loads fine but then when I run the program, I just have the face spinning around with a texture with no transparency, or in other words fully opaque. Is there something else I must do to ensure that my texture comes out with transparent areas?
-RelisH!
Nubbinoski
Nubbinoski
does your format have to be targa?

I had the same problem, and then I changed to .PNG and it loaded and displayed with a full range of transparency, without any change in my code.

nubbinoski-
DrunkenHyena
DrunkenHyena
G''day!

(website flogging time)
On my website (www.drunkenhyena.com) there are a number fo transparency tutorials. The tutorial you''d be most interested in is: http://www.drunkenhyena.com/docs/d3d_tutorial.phtml#DHAlphaChannel since it loads an image with an alpha channel and displays it. You can try replacing the image provided with yours, and see if it displays properly. If it doesn''t, there''s a problem with your image, if it does, peek at the code to see what I did.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
RelisH
RelisH
Wow! Thanks!
it seems it wasn''t working because I was using a TGA, but PNG''s are easier to work with. Thanks for the help Hyena!
-RelisH!
DrunkenHyena
DrunkenHyena
G''day!

Targa files SHOULD work. The main problem with them is that the Targa spec is pretty wide. I''ve had some luck using them, but sometimes the alpha channel gets lost. I like PNG. PNGs are compressed (almost as good as a good quality jpeg) and they can have alpha channels and all that good stuff and I''ve never had a problem using PNGs created by various programs. A nice tight spec is your friend.



Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.