I have an issue when loading a gltf file as a string.
When I load it with BABYLON.SceneLoader.Append("./", "test.gltf", scene, function (scene) { // do something with the scene });, it works fine (texture are fully loaded)
However, when I pass it as a string (with embedded texture) with BABYLON.SceneLoader.Append("", "data:" + gltfString, scene, function (scene) { // do something with the scene }); it doesn’t work.
I use exactly the same file, so I guess the issue is in the gltf-loader, am I wrong ?
I tried to specify the extension like this : loader = BABYLON.SceneLoader.Append("", "data:" + gltf, this.scene, undefined, undefined, undefined, ".gltf");
The mesh is loaded but the texture still fails to load with this error : Error: /textures/0: Error while trying to load image: data:data:{"accessors":[{"buffer... - Fallback texture was used
Can it be because the string is not well formatted and the gltf fails to parse the texture ? I don’t understand how the loader can load the gltf as a file but not as a string, even though it is exactly the same
I had the problem with glTF as a string (without encoding), or with GLB encoded with base64.
Actually I tested to upgrade Babylon.js to version 5.0.0 and it works like a charm. Unfortunately, I can’t find a gltf who fits in a string and that can be saved in the playground.
However, I tested in the playground and with version 4.2.1, I have the error during loading of textures, and with version 5.0.0 I have no errors.
You can try yourself by using this playground and replacing the boomBox variable with the base64 encoded string of the same GLTF. You will notice that it will works with version 5.0 but not with version 4.2 !