DDS creation

From The DarkMod Wiki
Revision as of 15:51, 1 September 2020 by Geep (talk | contribs) (Done, peter_spy & Geep)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page was entirely rewritten in August 2020 by peter_spy and Geep - A shortened version of the prior content here may be found at 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 (without mipmaps available) that results in blurred image and moire patterns. Mipmaps are scaled-down versions of your texture, stored within the same file as the full-scale texture. Mipmaps 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 2048x2048 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 in your FM

While all TGA files go to:

    yourFmRootFolder/textures/[optional subfolder(s)]

DDS files should go to:

    yourFmRootFolder/dds/textures/[optional subfolder(s)]

In other words, you need to copy-paste your folder structure into the dds directory. (At one time, the DDS hierarchy could be no more than 5 deep; this is no longer an issue.)

Priority: TDM gives DDS files higher priority than TGAs. If you have both for a given material, the engine will only load the DDS.

Leave Normal Maps as TGA: You can safely convert diffuse and specular textures to DDS. But normal (bump) maps are not images in the 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.

DDS Creation, In General

Compression Formats: DDS files can be compressed in different ways, depending on source image requirements. As a general rule, use -

  • DXT1 compression with RGB images
  • DXT5 for textures with alpha channel transparency

More info on compression formats: http://wiki.polycount.com/wiki/DXT

Mipmaping: Mipmap generation is mandatory in TDM. Otherwise DDS textures won't show in game and you'll get console errors.

TIP: You can improve texture quality - at no additional performance cost - by using the best mipmaps scaling filter available in the DDS file export settings. Usually they're ordered from faster/low-quality to slower/high-quality.

DDS Creation with Specific Tools

General Workflow Tips

  • Convert to DDS only after you have finalized 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.
  • Planning to revise and test your material's textures? Besides re-exporting the updated textures as TGA, be sure to delete its old DDS textures, that would have priority.

Testing Your DDS Texture

Mipmapping is affected by in-game Anisotropic Filtering. Set it to x16 to ensure maximum image quality while testing your materials.

See Also