Non-relative URI in GLTF

My question concerns the behavior of Babylon.js regarding URIs encoded in a GLTF model.
I have a GLTF which uses a URI as image for a texture, e.g.

"images" : [
{
   "uri" : "http://www.example.com/image.png"
}]

First question:
this results in a warning while validating the GLTF (“code”: “NON_RELATIVE_URI”).
Is there an official GLTF-way of linking remote assets which I missed?

Second (Babylon.js related-)question:
Despite the warning, the GLTF renders as intended on the Babylon.js sandbox (https://sandbox.babylonjs.com/). This is all fine.
However, when I try to load the GLTF on my own website using Babylon.js, the absolute URLs get converted into a relative url, as such: “http://localhost:8080/api/gltf/http://www.example.com/image.png
(which of course fails to load the asset resulting in a response error from the localhost server).

I’m using the babylonjs.loaders.js loader and following code to load the GLTF:

var createScene = function() {
                    var scene = new BABYLON.Scene(engine);

                    BABYLON.SceneLoader.Append("/api/gltf/", "model.gltf", scene, function (newMeshes) {
                        // Create a default arc rotate camera and light.
                        scene.createDefaultCamera(true, true, true);
                        var camera = scene.activeCamera;
                        camera.upVector = new BABYLON.Vector3(0, 0, 1);
                            })
                        })
                    })

                    scene.createDefaultCamera(true, true, true);
                   var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
                    light.intensity = 0.7;

                    return scene;
                };

This code works fine for GLTF models with relative URIs.
So I guess the question is: what’s the difference between loading the GLTF model using the code above vs dragging/dropping into the Sandbox? What makes absolute URIs work in one case but not in the other?

@bghgary answered a related question here

2 Likes

Thanks for the pointer. I’ve missed this post.