Support Other Textures in GLTFLoader

I use Basis texture compression format to replace all png textures, and replace all ‘.png’ to ‘.basis’ inside gltf file.

glTFLoader.js

this._babylonScene.getEngine().textureFormatInUse seems to be undefined in my case, any way .basis is actually not in this supported list as well as Engine.texturesSupported.

maybe line 1889 here should be else but not else if, leave Texture class to handle texture loading.

textureFormatInUse is not something which should be defined by default. It is only here in case you want to replace any texture call with ktx, I do not think it is that simple to repurpose to basis.

Ping @bghgary for ideas

KHR_texture_basisu, KHR_image_ktx2 are still experimental, but actually we can use various unusual formats in GLTF by setting up image.uri.

the way i described is making Texture class handle properly image.uri from gltf file.

Could you submit a PR for it so that @bghgary can review after thanksgiving ?

Sure, there’s no hurry.

1 Like

I’m not a big fan of this part of the code. IMO, the glTF loader should not explicitly allow non-core spec code paths. I will gladly review a PR, but it might be better to put this under a loader extension or at least a flag.