Archived

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

kiev_class

dx8 alpha texturing

Recommended Posts

i''m having trouble setting up alpha texturing using dx8. What I am actually trying to do is draw a mouse pointer in a full-screen app using the d3dxsprite functionality. It looks like bitmaps don''t support an alpha channel, so do i have to load 2 separate textures (one 24-bit bitmap for color, and one 8-bit bitmap for alpha) from 2 separate images?? It sure would be nice to be able to store them in the same image instead of 2 different ones. Once this is done, do I have to use texture stages to blend the two images together over top of the already rendered background? Any help would be appreciated. I have a feeling i''m misunderstanding things...

Share this post


Link to post
Share on other sites
In my engine, I ended up loading two bitmaps (one for alpha, and one for color, as you described), and then I combined them in the code into one texture. It''s not very difficult, it''s just mostly a pain to write the color conversion code.

The alternative is to use two textures and render it in multiple passes, or to use multitexturing. Either way will probably result in a bit of a performance decrease, but otherwise they would work.

Share this post


Link to post
Share on other sites
thank you senshi. I''ll try it using texture stages. I just wanted to make sure I wasn''t doing something silly by loading the alpha channel separately (it would be nice if there was a built-in way to load an RGBA format).

thanks again...

kiev

Share this post


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

If you only need a simple ColourKey effect (100% or 0% transparency) you can load a BMP and specify a ColourKey value using D3DXCreateTextureFromFileEx (I think, this is from memory, don''t have docs here).

Alternately you can use a program like Photoshop or Paintshop or TheGimp (www.gimp.org, it''s free!) and save your images as TGA or PNG which support alpha.

There''s a Colour Key tutorial on my site if you''re interested (www.drunkenhyena.com, or click my sig) in taking that route.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
thank you hyena. I actually stumbled my way to your site last night, and the tutorial you mention is the one that helped me. I''ve got it working now using the .png format. Thanks!

kiev

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When I made a 2d shooter using D3DX (version 7.0 mind you) I used the d3d texture utility that was included. I took 2 separate images (alpha and image), and combined them as 1 compressed texture using this program. The resulting file was small, had a low memory footprint, and had all the image information I needed. You may want to try this method. Your game will work on lower end video cards that way.

Share this post


Link to post
Share on other sites