Query which KTX codecs were used?
Is there a way to query which KTX codecs were used to compress various textures in a glTF file? For example, was the baseColor.ktx compressed with ETC1S while the normalTexture.ktx wwas compressed with UASTC?
Thanks Don!
The information is in the file, but not currently exposed by CLI or other tools. In a script you could extract that data from the KTX2 container like this:
import { NodeIO } from '@gltf-transform/core';
import { KHRONOS_EXTENSIONS } from '@gltf-transform/extensions';
import { read as readKTX } from 'ktx-parse';
const io = new NodeIO().registerExtensions(KHRONOS_EXTENSIONS);
const document = await io.read('path/to/model.glb');
for (const texture of document.getRoot().listTextures()) {
if (image.getMimeType() === 'image/ktx2') {
const container = readKTX(texture.getImage());
const dfd = container.dataFormatDescriptor[0];
if (dfd.colorModel === KTX2Model.ETC1S) {
// ...
} else if (dfd.colorModel === KTX2Model.UASTC) {
// ...
}
}
}
I haven't planned to expose that information through the inspect command, but would probably do so if there were a good way to include it in the MIME type, similar to https://github.com/KhronosGroup/glTF/issues/2064.
Thanks!
I found out this is exposed in UX3D's Gestaltor tool. https://gestaltor.io

Thanks Don!