Model slow loding

hi everyone i trying to load a model which is glb file its size is 816kb and it take upto 1 min to load on local it is load instant but when we trying to load on stage its going to be slow and we are get model from s3 please suggest me why it is slow
createCup(){
var self = this;

            self.meshUrl = this.productDetail.productCode + ".glb"
            self.modalPath = environment[global.env].RESOURCE_URL_AMAZON + environment[global.env].RESOURCE_CONTAINER + environment[global.env].oemCode + "/preview/" + this.productDetail.productCode + '.glb';
          SceneLoader.ImportMesh("",
              // "./assets/models/", 
              self.modalPath,
              "",
              this.scene, (frame, particleSystems, skeletons, animationGroups)=>{

                this.meshes = frame;
                this.animationgroups = animationGroups;
            
              this.ifcardanimatedproduct = this.handleCardAnimatedProduct(this.animationgroups);
              this.ifanimatedproduct = this.handleAnimatedProduct(this.animationgroups);
                this.scene.createDefaultCamera(true, true, true);
                  this.updateMaskedArea();
              if (this.selectedPaper) {
                this.showPaperColorOption(this.selectedPaper);
              }
              this.setcameraposition(this.scene);
              this.engine.hideLoadingUI();
                console.log(this.meshes);
          
              } );    

              
              const endTime = performance.now();
              const loadTime = endTime - this.startTime;
              
             
              console.log('Model load time: ' + loadTime + ' milliseconds');
            
             
              setTimeout(() => {
                
                this.cdr.detectChanges();
              }, 1);
            
            
          }

Hello @NareshKushmakar11 , how are you doing?

I think the problem is that in production you will be limited by the download speed of your network. The model will be downloaded from your server to user’s computer, I don’t think there is much Babylon.js can do to improve that.

1 Like

but when i load from assets folder than also take same time

816 kB should be loaded almost instantly, given that one has good computer and decent internet speed.
Since you’ve mentioned that you are using S3 to host your model files, I would recommend to check your plan - probably your download speed is limited. Another option to try is to host your model at GitHub or Dropbox and check download speed at this case.

1 Like

Does the cup have coffee or tea? Maybe it just needs time to brew

1 Like

loading locally :

This is almost instantanious because there is practically no distance for the file to travel along the network within your own machine as your machine is both the server and the end user.

loading when deployed to a remote server :

This will have some sort of delay , how much of a delay is now based upon how fast your connection speed is and how responsive the server itself is.

Even if you are loading from the assets folder of your project. The application is running in the browser on a users machine somewhere else in the world. It loaded these files from the server. It only loads the files it is asked to load. So when the application wants to loads another file , like an asset, it is no different. It makes a request to the server and the file has to download from the server computer to the users computer.

hth