question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GLTFLoader: HTTP Range Requests support

See original GitHub issue

Is your feature request related to a problem? Please describe.

GLTFLoader first loads the entire bundle glb file and then starts the parse. It is inefficient for network usage if users want to first partially load the assets and then lazily load the others on demand (eg. glTF LOD extension).

Describe the solution you’d like

Support HTTP Range Requests in GLTFLoader.

Changes probably needed:

  • FileLoader supports HTTP Range Requests #24485
  • First load only the glb header
  • Load partial buffer for a buffer view with HTTP Range Requests

Additional context

With the changes, the number of requests can be many. How will the response time be? Longer because of many requests? Or shorter because of the parallelism?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
takahiroxcommented, Sep 17, 2022

I experimented HTTP ranged requests with #24580 and the gltf loader plugin API. I succeeded by using .loadBufferView hook.

Plugin source code: https://github.com/takahirox/three.js/blob/GLTFLoaderRangeRequestPlugin/examples/jsm/loaders/gltf-plugins/GLBRangeRequestsPlugin.js

Demo: https://raw.githack.com/takahirox/three.js/GLTFRangeRequestsDemo/examples/webgl_animation_keyframes.html

image

image

There are some limitations, eg. it can’t be used with anther plugin using loadBufferView() hook like EXT_meshopt_compression handler, but it’s likely possible to support HTTP range requests + glTF loader + bungled glb as a plugin and it’s managed in external repository or in user codes.

I would like to keep this issue opened at least until #24580 will land.

2reactions
donmccurdycommented, Sep 10, 2022

@elalish I think the Streams API might be the way to go for what you’re describing, less time waiting on request round trips maybe? All the same it’s a great illustration.

Sorry if this is a longer thought than really belongs in this thread, but I’ve been feeling for a while that GLTFLoader is becoming pretty complex. It’s 4500 LOC in a single file; its unit tests have been removed, and this puts more burden on manual testing. Pre-compiling shaders, streaming textures, early uploading textures, streaming LODs, etc. all does sound like a good thing for our users. But I’m not sure we’re setting ourselves up for success in maintaining these features here.

I’ve also heard complaints from advanced developers who wish GLTFLoader was more memory-efficient — e.g. fewer callbacks — for loading glTF models into a running application without triggering GC and dropping frames. Doing more work synchronously does conflict with our extension API and lazy-loading/streaming features, though.

Eventually, we may need more than one loader in order to support some of these goals. Probably in a separate repository that can run its own unit tests. I’m not sure where to draw that line, and which features should be scoped for a separate loader, but those needs don’t seem too far away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Progressively Load .glTF Files - Babylon.js Documentation
The glTF loader minimizes the amount of HTTP requests sent to the server for optimal efficiency. ... The glTF loader in Babylon.js supports...
Read more >
Hubs LOD Support
js GLTFLoader HTTP range requests plugin that allows progressive LODs loading with HTTP range requests. How to enable HTTP range requests ...
Read more >
HTTP range requests - MDN Web Docs - Mozilla
Requesting a specific range from a server. If the server supports range requests, then by including the Range header in your HTTP request,...
Read more >
takahiro(John Smith) on Twitter: "* loading partial buffer for a buffer ...
Is it safe to expect that major servers and browsers support HTTP range requests? developer.mozilla.org. HTTP range requests - HTTP | MDN. An...
Read more >
Issues · mrdoob/three.js · GitHub
GLTFLoader : HTTP Range Requests support Suggestion. #24506 opened Aug 17, 2022 by takahirox · 3. FileLoader: Range request support Suggestion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found