GLB + KTX/etc1 supported?

Hi, are .glbs packed with ktx2/etc1 textures supported in babylon?

I have used the glb optimizer to pack some .glbs with ktx2/etc1 textures and want to use them in babylon. I have also draco compressed the .glb using gltfTransform.

Inspecting with gltf.report everything seems fine, asset is nice and compressed, textures are ktx2/etc1.

When loading in babylon windows desktop, and using the inspector to investigate, the textures appear to be RGBA BPTC UNorm; Is Compressed: Yes. For testing, I also tried ktx2/uastc. Same thing, RGBA BPTC UNorm, Is Compressed: Yes.

On android, in the inspector, etc1 textures appear as unknown format, type: unsigned byte,
Is compressed: No.

The UASTC → RGBA ASTC 4X4, Is Compressed: Yes.

I also tested this playground where I specified etc1 as the only type. On desktop the uncompressed.png gets loaded, instead of the etc1 and on mobile, the etc1 texture gets loaded, but the inspector again shows unknown info.

So I am a bit confused? Is the inspector not showing correct info, and etc1 is actually being used? Is etc1 not supported cross platform?

Cc @bghgary @alexchuber

ETC1 is supported (see list of supported texture formats). And the formats your ETC1S-encoded .ktx2 are transcoding to seem about right, according to the transcoding decision tree.

The “unknown” you’re seeing in the Inspector is indeed misleading. We’re missing some entries in this table. If someone beats me to updating this, please feel free :slight_smile:

Hi, thanks for the reply! So, as I understand, the etc1.ktx texture is actually used, it’s just that the inspector does not show this.

I have a remaining question though. In the attached playground , the only available format provided is etc1, var available = ['-etc1.ktx']; On mobile devices it works, and the etc1 texture is loaded. On desktop though it falls back to .png. I understand that .dxt is recommended in this case, but etc1 is supposed to work. When I load a .glb with etc1/ktx textures, it works & they load as RGBA BPTC UNorm.

After more testing I found out that manually loading etc1.ktx2 works for desktop too.

This code does not work though.

    var available = ['-etc1.ktx'];
    var formatUsed = engine.setTextureFormatToUse(available);

I think there is some confusion. There are two versions of KTX, version 1 and version 2.

glTF uses KTX version 2 (a.k.a. KTX2 with file extension .ktx2) with Basis Universal (BasisU) payload. glTF can use BasisU encoded with ETC1S or UASTC. ETC1S is a subset of ETC1. UASTC is a subset of ASTC. Both can be transcoded to other formats on target platforms.

KTX version 1 (with file extension .ktx) is not a universal format. It can hold platform specific formats. Users must provide separate files for each platform target with a format that works for the target platform.

ETC1 is not a format that desktops can load.

This is KTX version 1.

This make more sense, thank you!