DDS creation
AUGUST 2020 - REWRITE IN PROGRESS All prior content here has been moved to new page DDS Creation with ATI Compressonator.
Introduction to DDS
DDS (Direct Draw Surface) is an image format often used in games due to its significant advantages over other file types:
No need for conversion during load: This is a target format in which textures are stored in your GPU memory. Other image types, like TGA, have to be converted during loading, and that makes the whole process longer.
Better image quality with mipmapping: Game engines use LOD systems to generate textures further away from the player, but that results in blurred image and moire patterns. Mipmaps are scaled-down versions of your texture. You can store them in the same file as your texture. This will improve image quality, the transition between LOD stages, and overall performance. More on mipmapping: https://en.wikipedia.org/wiki/Mipmap
Very efficient compression: Depending on the DDS compression format, a typical results is around 25% of the original uncompressed file. For example, a 2048 px RGB texture saved as uncompressed TGA will be around 12 MB. Save it as DDS, and you'll go below 3 MB. Other formats like PNG or Zip compression will give you around 9 MB.
Textures in TDM
TDM can handle textures in either TGA or DDS formats. For guidance in preparing compliant texture files, applicable to both formats, see:
Folder Structure
While all TGA files go to yourFmRootFolder/textures/darkmod/etc., DDS files should go to yourFmRootFolder/dds/textures/darkmod/etc. In other words, you need to copy-paste your folder structure into the dds directory.
General Workflow Tips
– Convert to DDS when you have finished textures that make up your material. There are at least two reasons for that:
DDS format isn't suited for fast iteration: You have to restart the game and reload the map to see the any changes. With TGA files, you just need to use a refresh command to see your changes in an instant.
DDS compression is lossy: While the compression ratio is pretty great, it slightly reduces image quality. You shouldn't work on DDS textures directly, as you'll decrease image quality with each save. Keep your source files and work on them instead, then export TGAs to DDS when you're happy with the final result.
– You can safely convert most textures to DDS except for normal maps. The latter are not images in traditional sense, they're more like vector maps. Any lossy compression will always introduce some artifacts and otherwise damage that data. To be on the safe side, keep normal maps as TGAs.
– TDM gives DDS files higher priority than TGAs. If you have both TGA and DDS textures for your material, the engine will only load the latter. If you want to get back to work on your material, re-export its textures as TGAs and delete corresponding DDS files.
DDS Compression Formats
DDS files can be compressed in different ways, depending on source image requirements. As a general rule, RGB images use DXT1 compression, while textures with alpha channel need DXT5. More info on compression formats: http://wiki.polycount.com/wiki/DXT
Mipmaping Tips
– Mipmap generation is mandatory in TDM. Otherwise DDS textures won't show in game and you'll get console errors.
– Mipmapping is affected by in-game Anisotropic Filtering. Set it to x16 to ensure maximum image quality while testing your materials.
– You can improve texture quality at no additional performance cost by using the best scaling filter in DDS file export settings. Usually they're ordered from faster/low-quality to slower/high-quality.