Hints, tips and tutorials for 3D modelling & content creation
|
KatsBits
Creating 3D models, meshes &
game content
3D modelling & meshing, level editing and textures makingHints, tips and tutorials for 3D modelling & content creation [back]Creating DDS textures using ATIs CompressonatorResources
Contents
What's this all about? ^One of the more puzzling aspects of creating content for Doom 3 powered games (Doom 3, Quake 4 et-al) is DDS; what they are, what they do and more importantly, how to create them. This tutorial will walk through the process of creating DDS textures using ATI's own tool for the job - The Compressonator - which was used by idsoftware for Doom 3's content. Thankfully it doesn't speak with a very bad Swedish accent, nor have any political aspirations!
What is DDS they exactly? ^DDS is an acronym for 'Direct Draw Surface' and as you might guess from the reference to 'Direct Draw', it's part of Microsofts graphics 'API' (Application Program Interface) for their Windows operating system environment; Direct X to you and me!. What it's for, or rather, what it does, is allow content creators the ability to compress images using a number of different algorithms depending on the needs of the content originators; Doom 3 powered games for instance use 3 different algorithms for the assets used in game; DXT1, DXT3 and DXT5. This tutorial will cover DXT5 and the compression of a localmap (normalmap). The Compressonators interface ^The General interface of ATI's Compressonator is unfussy and uncluttered which belies the power hiding under the hood; a word of warning before going any further, this program crashes a little too easily if you choose the wrong algorithm, so at least you'll know you've done something wrong when/if that happens!. As you can see below, the interface for the app is pretty unfussy with the usual text menus and button items. The two greyed out text fields become active when an image is loaded, both offering a selection of different algorithms to do 'things' depending on what you're doing and what's been selected. An image opened into the Compressonator displays in the main dark grey window. ![]() Looking in your development directory (kat_q4dm1 in this instance) for an image to load Loading an image into the Compressonator ^It's pretty much the same as for every other application; using File > Open browse to the location of the image you want to compress and convert to DDS, in this case we want to load in a localmap. Selected below is the TGA image we want to compress.
![]() Looking in your development directory (kat_q4dm1 in this instance) for an image to load Compressonator and 'Mipmap' generation ^Once we've loaded in an image we can get to work. The first thing to do is 'Generate Mips'; these are LOD versions of the texture saved within the image itself allowing different Levels Of Detail to appear in game depending on how far away from the texture you are; it essentially reduces the size and complexity of the image in instances where using the full sized image isn't necessary and resource hungry (loading in a full 512x512 texture for something in the distance uses far more resources than it actually needs). Pressing the 'Generate Mips' button (highlighted green below) opens up a dialogue box shows a drop down list with a number of 'levels' to which mipmapping can be applied; the lowest being 1x1; that's basically the smallest LOD version used by the texture once it gets in to game. Leave this dialogue on the default settings and click the 'Generate' button (highlighted red below). The program may pause for a second or two whilst it carries out the work. Once done you'll see the titlebar of the image change; currently
it informs us that the image has "(Mip 1 of 1 ...)"; once
done that will change to "(Mip 1 of [x] ...)", '[x]'
being a value other than '1'. There's no other visual confirmation
of this part of the process so you need to watch the image title bar.
![]() Generating the Mips level for the image Correct DDS compression filter - UberCompressor ^Once we're done with generating the Mips we can move on to compressing the image. This is where you have to watch what you're doing because although there are a number of algorithms that can theoretically be used, choosing the wrong one tends to crash the program without generating any data. For (normal) localmap compression we need to use the tools 'UberCompressor' (highlighted orange below) settings. Select 'UberCompressor' from the drop down list - it may list 'ATI 3Dc Compression' by default - and then press the 'Compress' button. A popup dialogue box will appear listing a number of items; radial selection buttons on the left and a couple of text fields on the right. The compression we need is "DXT5 RXGB" (highlighted green below), if it's not already selected, click in the radial button to select. On the right make sure that the 'Channel Weighting' text field settings are as shown below;
If they're not, change them; select, delete and retype using the settings above. Also here you want to make sure 'Adaptive' filter is unselected, for some reason DDS textures that use this don't work properly in game so it's best to turn that off. Once that's all been done the image can be compressed by clicking on the 'Compress' button. ![]() Selecting the correct setting for compressing localmaps; DXT5 What you see after DDS compression ^The compressonator may take a few seconds to 'convert' the texture but once it's done it'll display three images alongside each other;
Although visually it may not look as if much has happened, we can check this by using the mouse cursor which is now a 'colour picker' tool. If we watch the titlebar of each image the series of numbers that appear on each will change relative to the cursor informing us of any colour difference, and hence compression, that's gone on.
![]() The results of compression Saving the DDS texture ^Once the image has been processed, it's just a simply step to saving it to the correct format. What we actually want to do here is save the compressed image (although there is an option to save any of the three generated images shown above - 'original', 'difference' and 'compressed'). To do that, select File > Save Compressed; ![]() Saving the results Browse to a location on your hard drive where the image should be saved, in this instance that's a development folder called 'kat_q4dm1', which is sitting in ../model/mapobjects/. You may find that you need to add the extension ".dds" to the name given to the file (selection highlighted below) just to make sure it saves the image as a DDS and not a file without an extension - which can be hard to track down in Windows sometimes. ![]() Naming and save location Saving normalmaps with alpha channels (masks) ^Thankfully you don't need to use any other filters for this as the RxGB filter appears to save the alpha channel to the DDS on compression. Unfortunately at the moment the Compressonator doesn't seem to display the channel so you won't know if it's actually done anything until you get the DDS set into game; any errors will display as a black material (any type of 'texture' error tend to 'break' the material). Once the file is saved that's it, a DDS version of the original TGA has been created and saved to your development folder. How can I view my DDS normal map? ^If it's a DXT5 compressed localmap, as we've been creating above,
then generally speaking you'll only be able to view these textures
within Doom 3 powered games or in an ATI tool/previewer;
this particular algorithm is only supported by ATI at the moment which
means if you've installed the DDS
and TGA viewer plugins
for Windows Explorer (see 'Resources' above) you'll find that localmaps
don't show up as thumbnails. Converting the other image types to DDS ^Converting the diffuse, specular and heightmaps uses the same process but a different filter. The same is also true of images with alphachannel masks. To save images other than localmaps we need to use the DirectX Texture Compression algorithm; so once the Mipmap have been generated for the image (as per above) select the compression filter from the drop down and click the 'Compress' button. The dialogue that opens shows a list of different filters which need to be used as follows;
DXT1 is highlighted (green) below because the image being processed is a diffuse texture without and alphachannel mask (just visible underneath the filter dialogue). Make sure the correct filter is applied to the texture otherwise it'll show up in game 'black'. ![]() Compressing other images Once the image is compressed just save as per above; find a location on your hard drive, name the file, add the ".dds" extension and save. How do I view these DDS images? ^Textures saved as DXT1 or DXT3 will display correctly as image thumbnails
in Windows Explorer if the DDSview plugin is installed. Most photo
or image editing applications that are photoshop plugin compliant
will also allow the display, editing and saving of DDS
files (plugin dependant). Problems compressing DDS images ^The main problem encountered is 'black' materials in game. If everything had previously been working with TGA only textures then it means one of your DDS images has been saved with an incorrect filter (or is 'broken' somehow); the localmap is usually the culprit, so double check everything. As a general rule of thumb - for textures other than localmaps, if you can see the image used for the thumbnail in Windows Explorer then the DDS will generally be 'okay'. It's always worth re-compressing to make sure you've not previously missed something first time round. |