Brakebein/node-three-gltf

Filesize

quangArchiviet opened this issue · 2 comments

Very large data return from GLTFLoader.

The model size is just 5-6Mb .... but the GLTFLoader loaded data is 324Mb.

Screen Shot 2022-10-05 at 11 18 49

Screen Shot 2022-10-05 at 11 19 09

Well, I was already in doubt if this is an good idea to parse the model at the backend and send it as json to the frontend. This might be ok for very small models.
Take the "LittlestTokyo.glb" example: the data is not only in gltf format, but also DRACO compressed, a highly efficient compression method for 3D models. The whole idea is to keep the data load as low as possible.

In your approach, you parse the model in the backend, turning the compressed data into uncompressed data, sending the uncompressed data to the client without any benefits of compressed data.
You can try to compress the json file, but it will reduce the size only a little, I guess.

If you don't want to expose the original glb file, another approach would be to load the glb file at the backend just as a buffer and send this buffer as base64 encoded string, at the frontend decode the base64 string and parse the model with GLTFLoader.

You are right. Uncompressed data is sometimes up to 1 GB, which may break the backend process.