Search code examples
graphicstexturesdirect3ddds-format

Determine the block compression format of an existing DDS texture file


Does anyone know if it is possible to determine the compression format of an existing DDS texture file? I have the NVidia Photoshop plugin, a DXTViewer app, and Honeyview app, but cannot seem to find any way to obtain this simple information?

By compression formats, I'm referring to BC7, BC6H, BC3, BC2, etc.


Solution

  • Most DDS viewers out there only understand how to parse the standard 'DDS' file. Since the introduction of Direct3D 10, there is a "DX10" extension header which is indicated by the FourCC value of "DX10" in the old DDPIXELFORMAT. This was implemented in D3DX10, D3DX11, and DirectXTex. See this blog post.

    BTW, modern versions of Visual Studio can view most DDS files.

    You can build the ddsdump.cpp which also needs dds.h to build a quick console application which dumps out the header information and format.

    See also DirectXTex on GitHub and Microsoft Docs.

    WIC on Windows 8.1 or later has a built-in DDS codec, but it only supports "DXT1", "DXT2", "DXT3", "DXT4", and "DXT5" (i.e. classic BC1-BC3 compression). It's only there for some WebGL scenarios.

    I've had updating the old legacy DirectX SDK Texture Viewer (a.k.a. dxtex) on my backlog for ages. So far I've managed to get the existing version open source but haven't any time to dig into support the newer "DX10" header.