KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
875 stars 230 forks source link

astc encoding lost normal-mode #813

Open wasimabbas-arm opened 10 months ago

wasimabbas-arm commented 10 months ago

Since --normal-mode is only valid with ktx create --encode basis-lz | uastc there is no way to encode astc normals anymore. You will get;

ktx create fatal: Invalid use of argument --normal-mode that only applies to encoding.

If used with --format VK_FORMAT_ASTC_4x5_UNORM_BLOCK

MarkCallow commented 10 months ago

Clearly we need to have a think about how to support this for BasisU and ASTC. Anyone want to make a proposal?

wasimabbas-arm commented 10 months ago

Shouldn't this just requires removing the coupling of --normal-mode with --encode for ASTC.

Actually why are these linked in the first place? Why can't I make an uncompressed KTX2, 2-component normal texture? As long as I know its 2-components, compressed or not I can recreate the 3rd component in the shaders.

MarkCallow commented 10 months ago

Shouldn't this just requires removing the coupling

Yes . But should be make a normal_mode_utils.h with these options or duplicate them where needed. Almost certainly we should make a utils file even though there are only 2 options.

Actually why is this coupled in the first place?

Excellent question. We (I) just never thought about it. This started out as a way to get better results from block compression schemes.

abbaswasim commented 10 months ago

Ok, how we implement them across different tools needs a bit of thinking. Agree collecting those into a norma_mode_utils.h makes sense.

If we are happy to have non-compressed normal mode normal map textures supported then un-linking from the --encode should immediately solve the ASTC issue. Of course the options needs to be traversed down into ASTC options for it to be used by the encoder.