Prefered order for texture formats

Hi all,
I’m generating 3D tiles & glb files from an in-house app.
I would like to maximize both performance and compatibility of my 3D Tiles in terms of texture.

As some client applications support KTX2 but not WEBP, some others WEBP and not KTX, and some others only support JPEG/PNG, I’m generating glb files with both KHR_texture_basisu and EXT_texture_webp extensions.

For each texture, I have 3 possible sources (all images are external, ie.not in a GLTB buffer):

	{
		"extensions": {
			"EXT_texture_webp": {
				"source": 1 /// point to WEBP uri
			},
			"KHR_texture_basisu": {
				"source": 2 /// points to KTX2 uri
			}
		},
		"sampler": 0,
		"source": 0 /// points to JPEG(RGB) or PNG(RGBA) uri
	},

When I load the 3D tiles in CesiumJS, WEBP images are loaded.
If I do not include the WEBP support (ie. only JPEG/PNG and KTX2 textures), KTX2 images are loaded.

I would prefer to have the following fallback order:
KTX → WEBP → JPEG/PNG.

Is there a way to specify it ? does the order of the extensions matter ?

Any hints appreciated, thanks in advance,
Fred.

That’s an interesting question.

I could imagine that the order of the extension objects within the JSON matters. In doubt, it could be easy to try it out by swapping the extension objects in the example that you posted.

But regardless what the answer is for CesiumJS: This is certainly not specified anywhere. The order might change in CesiumJS in the future. And a different rendering engine might use a different order to begin with.

As such, I think that it could make sense to bring this up in Issues · KhronosGroup/glTF · GitHub

Thanks Marco - will try with both orders and will post here what is the result (in Cesium JS).

This is unrelated to Cesium, but I opened Preference or order of texture format extensions · Issue #2455 · KhronosGroup/glTF · GitHub - maybe that can help to clarify what should happen here.

(EDIT: If you want your thread here to be linked from that issue, then I can do this - just drop me a note)

There doesn’t seem to be a preference or guidelines on the specification level, according to the answer to the issue.

So you can check what CesiumJS is currently doing, but there will be no guarantees that this will not change. (It will almost certainly not change - the point is that it is not guaranteed).