Performance ideas (loading objects in workers, faster texture uploads, etc)

GLTFLoader never does Array-to-TypedArray conversion for vertex data: the vertex data is in an ArrayBuffer, creating the typed array is a zero copy operation: array = new Float32Array( buffer, offset, length ). This is true whether the ArrayBuffer was transferred from the network or from some other source.

After thinking a bit though, I think the bottle neck will still be uploading textures to the GPU.

That is a common one, yeah. You have a few options:

  • ImageBitmap: Moves decompression of PNG/JPG textures off the main thread. Still need to upload the fully decompressed textures on the main thread. Not supported in all browsers yet.
  • GPU textures (e.g. KTX 2.0 / Basis): Transcode KTX to a GPU compressed format in a worker. The compressed texture is 4-8x smaller than uncompressed data from a PNG or JPEG file, and uploads to the GPU much faster.
  • Incremental texture upload: There are a few ways to do this, like uploading mips one at a time or subTexImage2D, see Load textures progressively - #5 by ataylor09. This would take a fair bit of work to do, and I don’t know of good examples for it.

With glTF I’d recommend converting textures to KTX for this use case, that’s exactly what it’s designed for. With formats like DAE, efficient loading is much harder.