Loading a gltf model cause a short time lag

image
load a model as above and render it
i noticed there was an suddent abvious lag ,check my console,it shows an warning as beblow
image
after model loaded,everything is smooth as before.

when i removed the model,everything was ok.the model file size is about 45MB,is it too big for adding to scene?

It seems like add a huge Object3d to scene cause this problem. It blocks the JavaScript threads in an instant

Consider to compress you asset e.g. via the tool gltf-transform. This will require to usage DRACOLoader in combination with GLTFLoader. You can find a code example for this in webgl_loader_gltf_avif.

A typical command with gltf-transform looks like so:

gltf-transform optimize input.glb output.glb

May also help if you can share the model. There are a lot of things that could be in those 45MB, and different performance problems require different solutions. In particular - if you have high-resolution textures then (regardless of file size!) they’ll require a lot of time to be decompressed uploaded to the GPU. Use as few textures as you can, no larger than 2048px by 2048px ideally.

great,i will try it later

sry,the model is too big for uploading,but i checked resolution of those textures,there does have one file with resolution of 4096*4096

A workaround is add a loading screen . If you don’t have any problem after model is loaded into the sceme

nice idea,that’s really an easy way

Also use can convert your model to be loaded by dracoloader it will reduce the size of model.