Texture.serialize, hardcoded image/png for all mime types

Version: 7.51.1 and git master
OS: any
Browser: any
Engine: any

Desc

In texture.serialize, if the texture contains _buffer as Uint8Array, commonly if loaded from a glb model, serializing texture will result in base64 url in image/png type.

But in gltf spec, texture can be in many types, including png, jpeg, webp, and possibily avif.

Texture has a prop named mime type that can be directly loaded from model, and since image formats supported by browser is limited, it can be detected from first few bytes of the buffer.

1 Like

I think it’s a known issue with the glTF serializer, cc @alexchuber and @srzerbetto.

1 Like

Thanks for the report! Yes, this is a known issue that I plan to investigate soon. I recall seeing your previous thread about this :slight_smile:

(Sidenote, our serialize methods like the one in Texture are for our .babylon exporter, not .gltf)

Hmmm, my previous threads are about gltf exporting, it changes name and content of the texture

1 Like