I have 2 .glb models of sizes 360MB and 510MB each which on draco compressing changes to 145MB and 130MB models. The is a react app where one model is loaded on a page and on a button click routes to the next page where second model has to be loaded. Similarly we can switch from current page to the previous page. The scene setup uses react-three-fiber. It is working in desktop perfectly. But in case of ipad (M1) we were able to redirect multiple times (lets say 4 to 5 times) between the pages without any fail. But at some point the page crashes throwing a run time error “Aborted() Build with -sASSERTION”. I assume this could be a range error/ out of memory error. I have tried multiple solutions where the draco instance is disposed after loading a model so that a single instance of draco is present, optimized the model, disposing the geometry, material and textures on unmounting the component. But the issue still persist.
I would suggest reusing one DRACOLoader for all models, and disposing it when model loading completes. But, yes, the numbers you’re describing do sound like they could exhaust the tab memory in iPadOS and crash the tab.
Are there textures in these models, and what is the texture resolution?
Have you considered running simplification to reduce the vertex count, in addition to Draco compression?
You might also try Meshopt compression. The decoding overhead is lower.
npm install --global @gltf-transform/cli
gltf-transform optimize input.glb output.glb --compress meshopt --simplify-error 0.0001 --texture-compress webp --texture-resize 2048
Hi @donmccurdy thanks for the reply. I have optimized the model using gltf-transform tried multiple compressions. Still facing the same issue in ipad, but working properly in my desktop.
I am a bit confused here on why my code is breaking just in ipad, that too not the first time. Both the models get loaded for the first time, which means the draco decompression is working properly. But after trying the same for multiple redirections its crashing in ipad.
Also what does the draco decoder and MeshOpt decoder actually do. Will it decode the models back to its original size ?
There are different resolutions up to 4k. Since it has to be viewed in a 95 inch device as well, I am not sure whether we will be able to reduce the resolution
Every 4K texture costs about 90 MB in memory. Draco compression is usually fully-decompressed on the device – it saves memory over network transmission only.
It sounds like your model uses too much memory, and you need to reduce the vertex count — not compress the existing vertices — or the number and size of textures. You’ll have to share a model to get more concrete advice than that I think, or to know which part of the model is the larger issue.
“Every 4K texture costs about 90 MB in memory. Draco compression is usually fully-decompressed on the device – it saves memory over network transmission only.”
Thanks for the information. That was really helpful.
Unfortunately as NDA stands I cannot share the models.
Still even in ipad I was able to decompress and load the models one after the other. That is
- I load one of the model after decompressing into the scene
- On a button click removed the model, dispose the geometry, material, texture and the instance of the draco loader on unmounting the component
- Load the next model(that too the compressed one) onto the scene
- Similarity goes back from the second model to the first after removing and disposing items
- This works without any fail for about 4 to 5 times in ipad
- But after the 4th or 5th redirection the browser crashes and the model doesn’t load
My concern is that if models are getting loaded successfully at least one time why does it break at some point even after disposing everything and that too on an ipad only. Is it something related to ipad memory management or is something getting accumulated during the process.