Wednesday, April 24, 2019
Universal texture compression: 5th experiment (originally published 9/15/16)
I outlined a plan for my next texture compression experiment in a previous post, here. I modified my ETC1 packer so it accepts an optional parameter which forces the encoder to use a set of predetermined selectors, instead of allowing it to use whatever selectors it likes.
The idea is, I can take an ETC1 texture using a subset of the full-format (no flips and only a single base color/intensity index - basically a single partition/single subset format using BC7 terminology) and "upgrade" it to higher quality without modifying the selector indices. I think this is one critical step to making a practical universal texture format that supports both DXT1 and ETC1.
Turns out, this idea works better than I thought it would. The ETC1 subset encoding gets 33.265 dB, while the "upgraded" version (using the same selectors as the subset encoding) gets 34.315 dB, a big gain. (Which isn't surprising, because the ETC1 subset encoding doesn't take full advantage of the format.) The nearly-optimal ETC1 encoding gets 35.475 dB, so there is still some quality left on the table here.
The ETC1 subset to DXT1 converted texture is 32.971 dB. I'm not worried about having the best DXT1 quality, because I'm going to support ASTC and BC7 too and (at the minimum) they can be directly converted from the "upgraded" ETC1 encoding that this experiment is about.
I need to think about the next step from here. I now know I can build a crunch-like format that supports DXT1, ETC1, and ATC. These experiments have opened up a bunch of interesting product and open source library ideas. Proving that BC7 support is also practical to add should be easy. ASTC is so darned complex that I'm hesitant to do it for "fun".
1. ETC1 (subset):
Max: 80, Mean: 3.809, MSE: 30.663, RMSE: 5.537, PSNR: 33.265
2. ETC1 (full format, constrained selectors) - optimizer was constrained to always use the subset encoding's selectors:
Max: 85, Mean: 3.435, MSE: 24.076, RMSE: 4.907, PSNR: 34.315
Its selectors (should be the same as #1's):
Biased delta between the ETC1 subset and ETC1 full encoding with constrained selectors - so we can see what pixels have benefited from the "upgrade" pass:
3. ETC1 (full format, unconstrained selectors) - packed using an improved version of rg_etc1 in highest quality mode:
Max: 80, Mean: 3.007, MSE: 18.432, RMSE: 4.293, PSNR: 35.475
Delta between the best ETC1 encoding (#3) and the ETC1 encoding using constrained selectors (#2):