-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTFLoader: Separate asset loading order #18097
Comments
In GLTFLoader we try to avoid doing things like "load all of the _____" , with a few exceptions, to support some lazy-loading uses. So there's nowhere in the code that explicitly loads all textures or all three.js/examples/js/loaders/GLTFLoader.js Lines 2584 to 2596 in 8ab8f09
I don't know if switching the order would be an unambiguous improvement, for a couple reasons:
But that said, if you'd like to try switching the loading order and see what the results look like, benchmarks are always nice to have. If it's a small change that improves things today maybe we should go ahead. |
Does the order of promise invocation strongly affect the order of delivery? I'd expect all resources to get loaded in parallel, so whichever is first to actually get downloaded would win. edit Although I guess on further reflection without HTTP/2 the number of resources that are fetched in parallel is somewhat limited, so it may take time to get through textures to the geometry, and of course resource prioritization over the HTTP/2 stream may also result in resources that are requested first to be delivered ahead of time. And heeeeeey "may eventually support" => "will definitely support" 😜 |
Yes, that's my hunch. It certainly could be an improvement to request the |
@donmccurdy Yeah, I doubt there's a clear cut loading order that would result in optimal loading time for all assets. However, I feel like being unbiased between images and @zeux I agree that promise invocation won't strongly affect loading order especially with HTTP/2 and above. However, in the code snippet that @donmccurdy linked above, the loader waits for all image promises to resolve before invoking the |
Parallelizing that sounds good to me, yes. No need to force one or the other to happen first.
I usually do this in dev tools (e.g.
If we're just parallelizing things — rather than forcing |
Description of the problem
Right now when loading a .gltf file, the GLTFLoader will load all of the images first and then the .bin files. I was wondering if there was a reason for this loading order. This can be seen in this example.
One instance I can think of where loading the .bin files earlier would be preferred is with DRACO encoded meshes. If we were to load the .bin files in tandem with the images, it would allow the DRACO meshes to start being decoded earlier in the loading process, potentially before all images are loaded. This would allow certain DRACO gltf files to load faster, with the decoding happening in parallel to image loading.
Three.js version
Browser
OS
The text was updated successfully, but these errors were encountered: