Loading multiple textures at run-time? Initial load time problem

Hi everybody
I have a scene with 100’s of meshes which I need to load into my scene. I am thinking of having 2 textures for each mesh, one being low resolution and one with higher resolution. I am thinking of loading the low-res ones first and after my scene loads initially, try to REPLACE the low-res textures with high-res ones at run-time as a background process.
The only clue that I have that this can be done is that when BABYLON loads files incrementally (ie: BABYLONGEOMERTYDATA) there is a delayLoadingFile parameter, which loads textures (and I guess their underlying meshes) at run-time: that is when the mesh “appears” in the spectrum of the camera for the first time.

Any suggestions?

Maybe the MSFT_LOD extension of GLTF could be a nice help for you ???

Pinging @bghgary as he knows this extension pretty well.

1 Like

If you are using glTF, the MSFT_lod extension may work. The glTF loader in Babylon supports this and can load textures progressively just like you described. You can use glTF-Toolkit to combine multiple glTF LODs into one using this extension.


thanx I will check

Thanks @sebavan and @bghgary. I didn’t know about this cool feature! :+1:

Is there a flag for forcing each model to use textures from only the attached material? I have been working with the MSFT_lod extension and am finding that the textures swim and distort while the lod levels load, and then fit correctly after the final level succeeds.


Can you share a repro?

Hey, and thanks for looking at this with me. I have included a link to a playground which shows the issue here. There are issues with using range requests on assets being loaded from github, but the affect on the model is the same.

I created the GLTF using the Windows Mixed Reality Asset converter (here), and it produces binary gltfs which I am looking for a way to better debug.

The mesh was created by Hannah Newey and share on sketchfab (here). It was decimated using Simplygon and has different UVs and texture dimensions at each LOD.

It looks like the glb has either bad textures or bad UVs in it.

Stop at first LOD: https://www.babylonjs-playground.com/#U9M5ES#2
Stop at second LOD: https://www.babylonjs-playground.com/#U9M5ES#3

You can easily unpack a GLB to its parts by using glTF-Shell-Extensions for Windows or gltf-vscode for cross-plat.

Hey, thanks, and pardon me for not doing a deeper dive before asking the forum.

Testing the input files showed no issues, but it appears that the draco compression is introducing artifacts in the child lods. I will use your tools to do some comparing of the output, but would appreciate any resources you know of which will do the same work.


1 Like

@bghgary Can I assume that there is a 1:1 relationship between the binary and json gltf files using the shell-extensions tool you mention above? The vscode extension throws errors on convert due to unsupported gltf-extensions, and I am unsure if the shell-extension is quietly doing the same.


Not generally, but with the extension that are used in this GLB, I believe it will work properly.

Okay, and thanks. It looks like some of the issues I was having were coming from clashes in the shape nodes exported from my DCC (needed to rename transform node and child shape), but the compression (WinMRAssetCreate) continues to cause problems.

After reading some of the documentation it looks like there are limits to the number of triangles, and I will look for alternatives to apply the compression step.


1 Like