[SOLVED] GLB file not loaded correctly using LoadFromUrl and InstantiateRenderEntity

UPDATE: The issue was most likely caused by Draco compression already applied to my GLB when I exported from Blender using the compression option that was enabled, which should be done by PlayCanvas.

Hi,

I am currently trying to load a GLB file containing a skinned mesh from the cloud using both LoadFromURL and InstantiateRenderEntity and I am coming across some issues.

I followed the tutorial : PlayCanvas | HTML5 Game Engine (Draco GLB loader example).

When I am loading the file manually to my PlayCanvas project, it generates a template that actually renders the GLB correctly when added to my Scene.

I made a sample public project rendering on the left from PlayCanvas, on the right is my cloud GLB, Both GLBs are identical. I have a strong feeling that I need to add some sort of Import Hiearchy settings, because only the first render (the head) is rendered correctly.

Here is my GLB Loading code snippet (Viewer.js in the demo)

async function loadGLB(app, assetName) {
    let url = '';
    switch (assetName) {
        case "EBU":
            url = 'https://sparkcontainers.blob.core.windows.net/actors/ebu.glb';
            break;
    }

    let asset = await this.loadFromUrl(app, url);
    let renderRootEntity = asset.resource.instantiateRenderEntity();
    app.root.addChild(renderRootEntity);
    return renderRootEntity;
}

function loadFromUrl(app, url) {
    return new Promise((resolve, reject) => {
        app.assets.loadFromUrl(url, "container", function (err, asset) {
            if (err)
                reject(err);
            else
                resolve(asset);
        });
    });
}

I am missing something ?

Best ,
Tristan

Hi @T_Froggo,

I see you are finding the rootBone entity, but you aren’t setting it in your anim component. Is there any chance that can be the issue?

this.playerEntity.anim.rootBone = rootBone;

PS Avoid using asset IDs in your code, when someone forks your project to give it a try those break.

Hello Leonidas.

Yeah my bad for the IDs, I made a quick demo to just show you the core of the issue. Let me try that , you get a good point regarding the anim.

I try using the root bone like this:

ebu_left.anim.rootBone = rootBone;

But even when not using any animations, I am still having only one the head rendered.

I am wondering if it’s my glb mesh Hiearchy (a root node empty, with multiple meshes below (head, body, etc.) that might cause the issue.

help

When I open the source scene file once uploaded in the editor I get the same thing.

image

I potentially solved the issue by disabling the Compression (Draco) Settings in Blender when exporting to GLTF, not sure if that’s the fix since I cleared my entire cache, but it most likely is.

1 Like

hey t froggo, where do I get the ebu model on playcanvas?