Scene loader progress tracking

Hey guys i am trying to get a more accurate accounting of the scene loading progress.
i am basically using the code from docs on tracking either percentage loaded or total bytes loaded (if lengthComputable = false)

   // onProgress
   var loadedPercent = 0;
   if (evt.lengthComputable) {
       loadedPercent = (evt.loaded * 100 / evt.total).toFixed();
   } else {
       var dlCount = evt.loaded / (1024 * 1024);
       loadedPercent = Math.floor(dlCount * 100.0) / 100.0;
   }
   console.log(loadedPercent);

The problem is it reports different evt.total when calculating percent. So you end up with more that message says 100 %

Here is console log screenshot… It show it 100% twice… First it goes from 0% to 100% with just 2 console log entries… then it restarts and goes to 100% over several console log entries…
How can this be… you cant accurately show loading progress:

Also… how com the evt.total is different… how can you calculate percent when the total is different:

Seems a bit off to me :frowning:

1 Like

Adding @bghgary as I think he did some dev related to loading progress tracking.

@MackeyK24 Can you send a playground or explain what you are loading?

Try this one with lots of texture… That still keep loading after scene has loaded… This would be great to test that GLTF Loader onComplete and make sure it only fire AFTER all the textures have download

It looks like a small amount is downloaded then it starts over then still loads a bunch of texture even after scene loader goes away… Is there some kind of setting for delayed loading for textures or something like that ?

https://playground.babylonjs.com/#VMTDRQ#1?UnityToolkit

Hmm, I’m unable to repro this. What browser are you using?

I can repro the total going down, which is very odd.

1 Like

Hello, I also have this problem. I only loaded a gltf file. Is there a solution?

I believe my issue had to do with the GLTF doing an additional load cause of the GLTF Loader validate.
So i turn that feature off with:

    BABYLON.SceneLoader.OnPluginActivatedObservable.addOnce(function (loader) {
        loader.validate = false;
    });

2 Likes

This seems like a bug if glTF validation is causing the progress to go wonky.

I also encountered the same error, the loading progress does not match

@brightMoon we need a playground repro so that @bghgary can have a look

There is a playground in the new issue: SceneLoader Load progress rollback - Bugs - Babylon.js (babylonjs.com)

closing this thread for SceneLoader Load progress rollback

1 Like