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. The reference pages cover the
header, the
pixel format, the
DX10 header and the
data layout, and the
block compression formats BC1 to BC5.
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
Not described
DDS is documented by Microsoft. These pages follow Microsoft Learn’s DDS and block compression documents; the parts below are not covered yet.
Known, not yet covered
- Reference: the BC6H and BC7 mode tables, partitions and endpoint layouts (Microsoft’s BC6H and BC7 format pages), and the bit order inside BC1 to BC5 blocks, which Microsoft gives in diagrams (block compression).
- Viewer: none. The file opens as raw bytes only.
Links
Software
- Paint.NET – free image editor that opens and saves DDS (Windows)
- GIMP – free image editor that opens and exports DDS (Windows, macOS, Linux)
- NVIDIA Texture Tools Exporter – NVIDIA’s tool for compressing textures to DDS (Windows)
- texconv – Microsoft’s command-line texture converter from DirectXTex (Windows)
Developers
- DirectXTex – Microsoft’s library that reads and writes DDS (C++)
Reference
- Programming guide for DDS – Microsoft’s documentation of the format