It is difficult to make a useful progress bar when loading a single model.
Loading a model involves a number of things, and their influence on the final loading time differs case-by-case:
- loading model from disk/network
- parsing (significant in case of XML, VRML classic, almost nothing in case of binary glTF)
- initializing GPU shaders
- loading vertex data to GPU buffers
- loading texture data from file to RAM, then from RAM to GPU
These things are not always easy to “break down”, e.g. when we load a single huge Shape to GPU, it is just one big call to GPU.
Testing your model in view3dscene, log shows:
-------------------- Loading begin
Loaded "file:///home/michalis/Desktop/assets/scene.gltf" with dependencies in 7.50 seconds:
0.33 to load from disk (create X3D graph)
2.79 to initialize scene (initialize shapes tree, collisions...)
4.38 to prepare resources (load textures, prepare OpenGL resources...)
-------------------- Loading end
So both “initialize scene” and “prepare resources” are important contributors here.
LogTextureLoading := true;
LogAllLoading := true;
to view3dscene (see https://castle-engine.io/manual_optimization.php ) one can see with the naked eye that most time is spent on loading
assets/textures/materialXXX_baseColor.jpeg (each 2048x2048 texture). So it’s not (only) about the number of triangles loaded, in this case a useful progress bar would need to take into account how many dependent files are also loaded.
( Note that you can possibly speed up the loading by converting textures to DDS or KTX formats. These are larger on disk, but require almost no processing to load them on GPU. )
I don’t yet have a better answer about “progress of loading the model”, I can only show that it’s not trivial to make such progress in a way that is useful in various practical use-cases
P.S. Sorry for the delay in answering. I had a hard time last week being busy with lots of things. I’m catching up now – all questions will be answered soon