Three.js: GLTFLoader: WebWorker support?

Created on 19 Oct 2018  Â·  3Comments  Â·  Source: mrdoob/three.js

Is there any support currently or future plans for loading glTF model using Web Workers, just like OBJLoader2 (https://threejs.org/docs/#examples/loaders/OBJLoader2)

Loaders Question

Most helpful comment

In summary — it would probably be a mistake for us to move the entire GLTFLoader parsing process into a Web Worker, as OBJLoader2 does. GLTF is already much faster to parse than OBJ, and the design choices it uses to accomplish that are the same choices you'd need to make, again, to send mesh data back from the Web Worker.

But for certain parts of the parsing process, like Draco decompression, Web Workers would be a great addition. I'd welcome a PR for that, but would recommend discussing the API first.

If you have a specific example where parsing is not as fast as you'd like, please feel free to share it and we can consider the options. :)

All 3 comments

This topic was already discussed in a previous PR. Please have a look at: https://github.com/mrdoob/three.js/pull/13263#issuecomment-368287030

In summary — it would probably be a mistake for us to move the entire GLTFLoader parsing process into a Web Worker, as OBJLoader2 does. GLTF is already much faster to parse than OBJ, and the design choices it uses to accomplish that are the same choices you'd need to make, again, to send mesh data back from the Web Worker.

But for certain parts of the parsing process, like Draco decompression, Web Workers would be a great addition. I'd welcome a PR for that, but would recommend discussing the API first.

If you have a specific example where parsing is not as fast as you'd like, please feel free to share it and we can consider the options. :)

But for certain parts of the parsing process, like Draco decompression, Web Workers would be a great addition.

Since we already have #13648 for this, I think it's better to close the issue. We can reopen if @sarathsi provides a concrete use case where the parsing process or a pure glTF file (without Draco compression) is faster in a worker than in the main thread.

Was this page helpful?
0 / 5 - 0 ratings