Problems importing local assets (gltf/glb) [Solved]

Hi everybody, i struggle around for some simple model importing.
I got a Vue 3/webpack dev env and the only way i could load a glb model is by using a blob and babylons Tools.DecodeBase64(). :frowning:

For example:

import model from ‘@/assets/models/cube.glb’;

var base64_model_content = model;
var raw_content = Tools.DecodeBase64(
var blob = new Blob([
var url = URL.createObjectURL(

SceneLoader.Append("", url, this.scene, (
“Do Stuff”
}, onProgress, onError, “.glb”);

Also put the models into the public/static folder… Seems like the loaders can´t read the local path? Anyone got an idea about what to do so that i can just the assetmanager or sceneloader in a simple way like:

SceneLoader.Append(“modelName”, “path/to3DModels/”, “modelName.gltf”, this.scene, (_newScene) => {});

Thanks a lot.


can you tell us what error do you get? How does the network profiler look like (f12)?

Hi and sorry, of course i got some more info…
When I use the assetmanager:
var meshTask = this.assetsManager.addMeshTask(“task”, “”, “src/assets/models/”, “terrain.glb”);
I got no console errors, instead i got an html content as response.

If I go with the SceneLoader:
SceneLoader.Append(“src/assets/models/plane/”, “P Shooter.glb”, this.gameScene, function (
// do something with the scene
I get: “Unable to load from src/assets/models/plane/P Shooter.glb: Unexpected magic: 1329865020”

What is the content of that html? Probably a 404. Can you check the network profiler when bjs tries to load that file?

Yep seems like 404…
It returns 200 but the file size is for every model 2.1kb… so just the html?


So i can imagine that the dev env i use (vue3/webpack) can´t load or resolve the path i need to inject into babylons asset loaders… I tried the npm module “gltf-webpack-loader” but could not make it work. The only work-around is by adjusting the url-oader of webpack to allow/use “(/.(glb|gltf|bin)$/i)i” and then decoding the .glb file before loading and using a blob. But with that i only can laod glb´s but no gltf´s and it feels hacky if i got more than one model… I have no idea what i could do else. Do you got a solution? thanks

Blob will be the only way of you want to bundle everything
I would recommend to not bundle your gltf assets and let them accessible through a regular url

Hey Deltakosh, thanks a lot for the fast and helpful support.
So I´ll go from here with static assets and absolute paths.
By the way thx for pushing Babylon… just get into it and it feels clean and nicely abstracted. :ok_hand:

1 Like