Games for Windows and the DirectX SDK blog

Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox One, and UWP

Project maintained by walbourn Hosted on GitHub Pages — Theme by mattgraham
Home | Posts by Tag | Posts by Month

BC6HBC7EncoderDecoder Sample Update

dds, dxsdk

Originally posted to Chuck Walbourn's Blog on MSDN,

Direct3D 11 class hardware through the Direct3D 11 API supports two new texture compression formats: BC6H and BC7. These new Block Compressed formats provide excellent compression for High-Dynamic Range (HDR) images and higher-fidelity traditional content. The D3DX11 library includes a software implementation of the encoder, but the new BC formats are extremely asymmetric meaning the encoding algorithm has a very large search space to determine the optimal compression for each 4x4 block. This makes a great candidate for a GPGPU DirectCompute implementation of the compression algorithm. The BC6HBC7EncoderDecoder11 sample in the DirectX SDK provides such an implementation using DirectCompute 4.0.

Attached to this post is a ZIP containing an updated copy of the C++ source files and the two HLSL shaders for encoding which you can drop into the BC6HBC7EncoderDecoder11 sample code in the DirectX SDK (June 2010). This update enables support for HD Photo source images which makes a great source for HDR content (D3DX11 supports the HD Photo file format, but COM must be explicitly initialized for it to work properly), as well as a work-around for an HLSL compiler bug with the June 2010 release that affected encoding in some cases. There are also a few minor cleanups and a diagnostic message to highlight that the source image must have dimensions that are a multiple of 4 for the encoder to succeed (this is a requirement for all the BC formats).

For more information on BC6H and BC7 texture compression, see the Gamefest 2010 talk Block Compression Smorgasbord (link). Remember that DDS files containing BC6H and BC7 content are stored using the ‘DX10’ header extension, which is not widely supported by existing tools

Update: Note that full documentation on the BC6H and BC7 formats is now available on Microsoft Docs. The source to the D3DX11 software compressor and decompressor has been incorporated into the DirectXTex library as well.

Note: The latest version of this code is now available on GitHub.

DirectXTex: The DirectCompute BC6H and BC7 compressors are now integrated into DirectXTex.