I load the model on local environment it take 958 millisecond to load and same model on stage take 1 min to load and the glb file size is 857kb

i facing a issue related slow loading of model suggest me something thanks in advance

1 Like

I believe we would need to see a PG and the model? There are a number of ways to speed-up the loading (and a number of reasons why it would display or load only very slowly)…but this really depends on what it is? Eventually the model itself might also requires to go through some optimization. But without seeing anything, all that could be said here would be just based on ‘assumptions’.

there is website link
EL-6820-3828.zip (667.7 KB) that is glb file
CreateScene(scene: Scene, canvas: HTMLCanvasElement) {
this.light = new HemisphericLight(“light”, new Vector3(0, 1, 0), this.scene);
this.light.parent = this.camera
const envTexture = CubeTexture.CreateFromPrefilteredData(“./assets/environment/environmentSpecular.env”, scene)
scene.environmentTexture = envTexture;
// scene.createDefaultSkybox(envTexture);
// scene.environmentIntensity = 0.2;
var blur = 0.8;
var myskybox = scene.createDefaultSkybox(envTexture, true, 10000, blur);

return scene;


startTime = performance.now();
async createCup():Promise {
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';
await SceneLoader.ImportMeshAsync("",
  // "./assets/models/", 
   this.scene, (evt)=>{
  // const loadedStatus = ((evt.loaded*100)/evt.total).toFixed();
  // this.loadingScreen.updateLoadStatus(loadedStatus)
  } ).then((frame) => {
    this.scene.createDefaultCamera(true, true, true);
    this.meshes = frame.meshes;
    this.animationgroups = frame.animationGroups;

   if(this.animationgroups.length !== 0){
      // this.modelAnimation();
  //  this.newAnimation(this.engine);
  //  this.modelAnimation()
  this.ifanimatedproduct = true;
   const endTime = performance.now();
   const loadTime = endTime - this.startTime;
   // Output the load time to the console
   console.log('Model load time: ' + loadTime + ' milliseconds');
    if (this.selectedPaper) {


loadComponent(engine: Engine) {
console.info(this.threedpreview.nativeElement, this.loaderRef.nativeElement, this.loadingBarRef.nativeElement, this.percentLoadedRef.nativeElement)
const loaderElement = this.loaderRef.nativeElement;
const loadingBarElement = this.loadingBarRef.nativeElement;
const percentLoadedElement = this.percentLoadedRef.nativeElement;

var canvas = this.threedpreview.nativeElement
// const context = canvas.getContext('2d');
//context.clearRect(0, 0, canvas.width, canvas.height);

var w = this.productDetail.Width + this.productDetail.Bleed * 2;
var h = this.productDetail.Height + this.productDetail.Bleed * 2;
var calculateCanvas = this.utilityService.calculateEditingArea(w, h, 0, 0);
//this.arrPaper = this.productDetail.
this.ppi = calculateCanvas.pixelPerUnit;

var settingsJSon = JSON.parse(this.productDetail.settings);

this.engine = new Engine(this.threedpreview.nativeElement, true);
this.loadingScreen = new CustomLoadingScreen(loaderElement, loadingBarElement, percentLoadedElement);
this.engine.loadingScreen =  this.loadingScreen;
this.scene = new Scene(this.engine);
this.CreateScene(this.scene, this.threedpreview.nativeElement);

this.engine.runRenderLoop(() => {


window.addEventListener("resize", function () {
  console.log('resized window');

} that is my code

Thanks for the info. That’s a lot more than I expected when reading the title of your post. Are you sure it’s the model import causing that huge difference in loading time? Honestly, one would need to check on all this and without the PG, it’s not really ‘convenient’, so to say. I guess a start would be to just load the model async in a PG to see what happens. Sadly, I’m out of time to investigate this right now (sorry :pray:) so I hope someone else will kick-in and have enough time to go through it. May be wait a bit for the Team (though they might request a PG). I’ll check back later today when I’m done with my own assignments :sweat_smile: Sorry for the wait and meanwhile, have a great day :sunglasses:
BtW: The site looks real cool :+1:

On my computer’s browser(edge 114) this page keeps growing in memory, 100% cpu usage. Finally the page crashes.

Yep Playground please :slight_smile: It’s always one of the first things we ask for because it helps isolate the problem from local factors :slight_smile:

why are you constantly calling resize() in the render loop? That cant be a good thing to do.?

Also, are you comparing local load times to load times on an actual deployment? Requests times are obviously then subject to the said server speed and your ISP speed

without calling resize() in renderloop it is stretch the model
this.engine.runRenderLoop(() => {
// this.engine.resize();


after calling resize() in renderloop i got proper model

is there other method to call resize please suggest me thanks in advance

you can call resize , its a valid function , i didnt say never call it, i mentioned having it called in the render loop is probably not good since it is then resizing every single frame. I could be wrong here , perhaps the engine handles this gracefully but my suspicions are it is not good. Normally you would add some listener to the page for resizing and then call engine resize only once each time it is required to run , no more.

I also cant access your website link , same as @qq2315137135 mentioned … the page just crashes.

Resize doesn’t do anything if the canvas size hasn’t changed: Babylon.js/packages/dev/core/src/Engines/thinEngine.ts at master · BabylonJS/Babylon.js · GitHub, but it’s good practice anyway to only call it when the canvas is resized. You can see an example here: Getting Started - Chapter 1 - Setup Your First Web App | Babylon.js Documentation (babylonjs.com)

1 Like

Hi, Just passed by looking back at this topic. Still no PG to show? :cry:
Or did you figure it out by yourself?

Anyways, adding on top of the comments of others and with regards to

this is abnormal. Also looking at some of your init lines of codes (which I’m not sure what they are supposed to do just exactly without having the context, like this part :

// const context = canvas.getContext('2d');
//context.clearRect(0, 0, canvas.width, canvas.height);
var w = this.productDetail.Width + this.productDetail.Bleed * 2;
var h = this.productDetail.Height + this.productDetail.Bleed * 2;
var calculateCanvas = this.utilityService.calculateEditingArea(w, h, 0, 0);
//this.arrPaper = this.productDetail.
this.ppi = calculateCanvas.pixelPerUnit;

this all gives me the feeling that your entire approach may just not be correct. Obviously meshes shouldn’t need a resize, a clear or a new render of the canvas to render correctly.