Jump to content

New Texture Compression Formats


Josh

8,188 views

 Share

The Vulkan renderer now supports new texture compression formats that can be loaded from DDS files. I've updated the DDS loader to support newer versions of the format with new features.

BC5 is a format ATI invented (originally called ATI2 or 3Dc) which is a two-channel compressed format specifically designed for storing normal maps. This gives you better quality normals than what DXT compression (even with the DXT5n swizzle hack) can provide.

BC7 is interesting because it uses the same size as DXT5 images but provides much higher quality results. The compression algorithm is also very long, sometimes taking ten minutes to compress a single texture!  Intel claims to have a fast-ish compressor for it but I have not tried it yet. Protip: You can open DDS files in newer versions of Visual Studio and select the compression format there.

Here is a grayscale gradient showing uncompressed, DXT5, BC7 UNORM, and BC7 SNORM formats. You can see BC7 UNORM and SNORM have much less artifacts than DXT, but is not quite the same as the original image.

uncompressed.thumb.png.9759cc5f5afc7c94947bad97a914cdee.png

dxt1.thumb.png.af7bf97f7c1cf6eaaf5b239cfa3577db.png

dxt5.thumb.png.0a450dcd60ac364d839e4c5ee0ed1d83.png

bc7_unorm.thumb.png.d3c5339ff07e4c68477070c854019c12.png

bc7_snorm.thumb.png.c9f5006d09352e3eba2d890bb1911100.png

The original image is 256 x 256, giving the following file sizes:

  • Uncompressed: 341 KB
  • DXT1: 42.8 KB (12.6% compression)
  • DXT5, BC7: 85.5 KB (25% compression)

I was curious what would happen if I zipped up some of the files, although this is only a minor concern. I guess that BC7 would not work with ZIP compression as well, since it is a more complicated algorithm.

  • DXT5: 16.6 KB
  • BC7 UNORM: 34 KB
  • BC7 SNORM: 42.4 KB

Based on the results above, I would probably still use uncompressed images for skyboxes and gradients, but anything else can benefit from this format. DXT compression looks like a blocky green mess by comparison.

I was curious to see how much of a difference the BC5 format made for normal maps so I made some similar renders for normals. You can see below that the benefits for normal maps are even more extreme. The BC5 compressed image is indistinguishable from the original while the DXT5n image has clear artifacts.

norm_uncompressed.thumb.png.641ec4ad732fe481db4cd58e4ae35499.png

norm_dxt5n.thumb.png.251b778e5633a48c0a75aa70da98c7f8.png

norm_bc5_unorm.thumb.png.e6d267d8e39dc97a09c7b806123f2ec9.png

In conclusion, these new formats in the Vulkan renderer, when used properly, will provide compression without visible artifacts.

  • Like 4
  • Upvote 2
 Share

3 Comments


Recommended Comments

I replaced our own texture format constants like TEXTURE_RGBA with the Vulkan texture constants and added support for pretty much all the DDS formats that correspond to Vulkan formats.

  • Like 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...