Open mklokocka opened 2 months ago
I gave this some thoughts The first thing we need to decide is whether (1) we use it for everything or (2) only for compression In case (1), we can either (1.1) rename Texture to DxTexture and create CrunchTexture, that will use its own optimize. The user can then choose Or (1.2) make it an implementation detail and choose smartly
In case (2), it's way less work
I agree that option (2) would be easier, however, I see a few enticing points for (1) besides the better compression:
Regarding when to apply Crunch or DirectX, Crunch notably only supports DXT1-5 for compression (BC1-BC3), and RGB(A) output. So either making it user configurable to an extent (if CAO wants to process texture as BC7 it should never use Crunch for example), or choosing smartly based on the selected output format (BC1 -> Crunch DXT1, BC3 -> Crunch DXT5, B8G8R8A8 -> RGBA, B8G8R8X8 -> RGB).
it can generate mipmaps with gamma correction which can improve the looks of mipmapped textures (textures further from the player character, without gamma correction they tend to be darker than expected).
I'm willing to bet that we could use the Crunch mipmaps generation on DirectXTex ScratchImage
If the quality is really better, maybe we could extend (2) to mipmaps? But I would prefer real comparison between the two before doing that, in terms of performance too
Crunch is a state of the art library for compressing with the standard DXTn. DirectXTex, while fine by itself, doesn't produce the best quality.
https://github.com/FrozenStormInteractive/Crunch2