Introduction
DDS is Microsoft’s texture format for DirectX. It stores textures in the layout a graphics card reads directly, usually block-compressed with the DXT or BC formats, so a game can load them without decoding. One file can hold a full chain of mipmaps, the six faces of a cube map, a volume texture or an array of textures.
DDS files are common in Windows games and their mods. Besides compressed colour, they can hold floating point and other high precision formats used for lighting and normal maps.
Structure
A DDS file starts with the four bytes DDS (44 44 53 20),
followed by a 124-byte header. The header gives the height, width, depth and mipmap
count, and a pixel format structure that names a compressed format with a four-letter
code such as DXT1 or DXT5, or describes uncompressed pixels
with bit masks. Caps fields say whether the file holds mipmaps, a cube map or a
volume.
When the four-letter code is DX10, a further 20-byte header follows. It
gives a DXGI format number, which covers newer formats such as BC6H and BC7, and an
array size. The surfaces come after the headers: each texture with its mipmaps from
the largest to the smallest.
0MagicDDS4 bytes4Header size, flags, dimensions, mipmap count, pixel format, caps124 bytes128DX10 header DXGI format, dimension, array size (only withDX10)20 bytes…Surface data each texture and its mipmapsvaries
Links
Software
Developers
- DirectXTex, Microsoft’s C++ library that reads and writes DDS
Reference
- Programming guide for DDS, Microsoft