DaBooda Turbo v1.4 - Tutorial Bonus 1
Alpha Channel (.dds Files)
Andrew "DaBooda" Stickney
August 12, 2004

I was emailed and told that using .dds files was the wrong way to go, for a lot of people do not know how or what a .dds file is.  A .dds file is simply an image format made strictly for directX, and it is basically a file that holds alpha channel information as well as the image with it.  A good thing about this format is, is that the channel information does not have to be extracted, and anyone who has done this programmitacally knows its almost impossible, because bit depths are different on every machine.. but the .dds file is one format, therefore it works for everyone.  To make a .dds file, you simply need one program, and anyone who has the DirectX 8 SDK will have this one program, but I decided to export it with this tutorial, which is probably wrong, but hey I plead ignorance here.

Making a .dds file is so easy, its almost laughable, for if you already know how to make masks or something of that nature then this will be easy for you.  Anybody who uses paintshop, which is essential for any game programmer, then this will be very easy.


Alpha Channel

Lets take a look at two images:

Regular Image

Alpha Image

With these two images we will make a .dds file with DXTex... the first image is the normal picture, and the second image is our alpha image. Transparency is determined by the value of white, for a value of 255 is solid and a value of 0 is clear, with values in between being variations in between.  This is what is great about .dds files, it really adds a nice look to any game.


Creating a DDS File

To create a dds file with DXTool is so easy, for all you have to do is open the program.  Then we open a file, in bitmap format.  Once that file is open and seen, you simply go back up to file and open a file as alpha channel, then load in your alpha image.  There you go, just save that .dds file and you have made a .dds file.  It is too easy, and when the engine, loads this in, you will see an image with the alpha information you declared for it.  This is what we got when I created the above two images into one .dds:

.dds File

Its this easy, I think alot of people become confused with the other options in DXTool.  Just ignore them, you really only need to use to open commands and then the save comamnd.  Do not use any of the formats that they let you set, or it will not load properly.

The hardest part of making a .dds file is probably creating the alpha itself and finding the best values of transparency, but with a little practice this becomes easy.

One thing to keep in mind is that it only takes .bmp format, so be sure to save the original copies as that, or it will not load them in.


DDS vs. PNG

Most of your game programmers swear by PNG format, for it is way smaller than any size, but really the only reason for wanting small size is for exproting your game.  But to be honest with you png has alpha information , but it is unreadable by DirectX8 and size wise yes it is smaller, but this is because it is compressed.  A .dds file once compressed becomes the same size as the .png file, and a .png file will not compress any further.  So exporting wise, you are still exporting the same file size. There is nothing saying you can't use the .png for regular images either, .dds files are really for those you wish to have alpha channels with.


A general note to any XP users.

There is a flaw in the DXTool, and that is on xp, it shows nothing but black, but it is still working.  Microsoft has addressed this issue and what it basically boils down to, is it still works, just do it in the dark... How nice of them...  It does work, it is just kind of annoying, but really just use the file commands and that is it, for that is all you are concerned with anyways.


This wraps up the dds tutorial, I hope this simplifies things for anyone.  These files are really easy to make and use, they may take a little more clicking to create than to be able to create with paint shop pro, but it really isn't that much more work.  And this is really the only way as of now, until someone figures out a quick way to extract alpha information from a png into directX8, to get alpha information.

For anymore questions please email me at masterbooda@yahoo.com ... And please ask me anything...