# Horrible performance to render a large gltf file (11M faces)

**URL:** <https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671>\
**Category:** Questions\
**Tags:** performance\
**Created:** [April 6, 2023, 2:41pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671 "2023-04-06T14:41:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 6, 2023, 2:41pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/1 "2023-04-06T14:41:17Z")

</div>

Hi everyone, I’m facing a terrible performance issue when I try to load a large mesh.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/c/bc43fc52f5709fc33100c580d3ef917de74882be.png)  
As you can see in the picture there is a large number of faces (11M) which start to be a big mesh but we have biggers… Please note the poor fps performance in the bottom right corner. I just can’t rotate the camera.  
At the moment I’m testing a bit all the 3d framework availables and I want to mention that I don’t have any issue to render this mesh in x3dom or THREE.

> **[Babylon.js Playground](https://playground.babylonjs.com/#AM2J36%2326)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

In this playground I tried to implement the various optimizations found in the [documentation](https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#performance-priority-modes) but I still can’t use the viewer.

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 6, 2023, 4:14pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/2 "2023-04-06T16:14:03Z")

</div>

Hello and welcome!

I didn’t have any issues while putting your model to Sandbox - [https://sandbox.babylonjs.com/](https://sandbox.babylonjs.com/)  
Is there any reason for it to be of such a big size (about 400 Mb)? Seems it could be optimized, for example with the help of [CLI | glTF-Transform](https://gltf-transform.donmccurdy.com/cli.html)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 6, 2023, 4:27pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/3 "2023-04-06T16:27:23Z")

</div>

Hello and welcome to the community!

Have you tried experimenting with the performance priority modes? [Optimizing Your Scene | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#performance-priority-modes)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 6, 2023, 5:16pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/4 "2023-04-06T17:16:25Z")

</div>

I think you have a problem with your browser/computer when rendering this mesh.

It’s only 2 draw calls, so it should be very fast, even for 11M faces: it takes 2.5ms GPU time and ~0ms JS time on my computer:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/6/5658e4216ed57b34e1ade11ce1c4f0e089aed9e8.jpeg)

What’s your GPU? Have you tried in different browsers? Are there any messages in the console log?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [April 6, 2023, 6:11pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/5 "2023-04-06T18:11:31Z")

</div>

Are you sure you have hardware acceleration turned on in your browser settings?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 6, 2023, 6:14pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/6 "2023-04-06T18:14:19Z")

</div>

They said they rendered in other frameworks and they didn’t have an issue, so hardware acceleration should be on. 🤔 When you said you had no issue, did you render a minimal scene with Three and x3dom, or did you change any settings there?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 6, 2023, 6:21pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/7 "2023-04-06T18:21:28Z")

</div>

It might be helpful to add what’s on this panel on your machine too:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/b/db7e3240d87a8c6a92e404a596a9a57719e86ab5.png)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 7:11am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/8 "2023-04-07T07:11:20Z")

</div>

Hello, this is the highest LOD of a part of 3 LODS; the lowest is about 17M and is loaded in first to prevent the user to wait. But the fact is that the highest model in x3dom (we use no LOD simply the biggest model in the x3dom file format) or threejs (with the same LOD system) without optimisation works fine.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 7:22am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/9 "2023-04-07T07:22:54Z")

</div>

Hi @carolhmj, yes if you look at the line bellow n°140 I try some optim I’ve read from this topic.

```auto
        //add optimizations
        scene.freezeActiveMeshes();
        porsche.freezeWorldMatrix();
        porsche.cullingStrategy = BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY;
        porsche.doNotSyncBoundingInfo = true;

```

I also tried to set the scene performance priority

```auto
scene.performancePriority = BABYLON.ScenePerformancePriority.Aggressive;

```

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 7:26am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/10 "2023-04-07T07:26:00Z")

</div>

Hi @Pryme8, yes it’s turned on in my chrome dashboard

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/b/0bb4e13ebd1c2e7173a3a6c424ef623640a40134.png)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 7:29am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/11 "2023-04-07T07:29:53Z")

</div>

Hi @carolhmj, as I explained upper in x3dom there is no managing of gltf files but yes it loads the full model 11M of triangles and there is never slownest on none of the computer of my colleagues.  
In ThreeJS we implemented the same kind of system as Babylon loading the GLTF file with 3 levels of details. No slowness detected as well without any optimization.

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [April 7, 2023, 7:37am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/12 "2023-04-07T07:37:24Z")

</div>

That’s very strange indeed 🙂

 ![carPerf](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/9/79c47d7ae1180d10bf9a1689974d3371424bee5c.png)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 7:52am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/13 "2023-04-07T07:52:16Z")

</div>

Guess what… today I’ve got 60 FPS without changing anything…

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/f/3f5daeb1fc52ce3f3f2091eea578da6c1208df71.png)  
I noticed that in the morning everything is ok but later in the day everything goes slow… but only with babylon; never with three of x3dom.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 7, 2023, 8:03am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/14 "2023-04-07T08:03:52Z")

</div>

Are you using preview or cdn? or simply testing in the PG? I mean the new server is good but I also experienced some slowdowns from time to time.  
You should download the latest cdn version and install it on your server to make your performance checks. Or at least link to cdn.

Edit: I checked it just now on a medium-range GPU and the model shows with a fair and stable framerate limited to 60fps. Nothing special to report here (in my opinion). Except may be that the inter-frame is as expected and below GPU time whereas a former test I did had just a very high and somewhat abnormal inter-frame.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lafite](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jonathan\_Lafite](https://forum.babylonjs.com/u/Jonathan_Lafite)\
**Post date:** [April 7, 2023, 2:04pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/15 "2023-04-07T14:04:56Z")

</div>

I’m hosting the version 5.54.0 on our webserver.  
Back to 6fps in the end of the afternoon. What’s different between now and this morning ?  
I had a new test with x3dom; we have no more fps than baylon I confess but when the camera moves it feels more fuild.  
In x3dom it’s like skiping frames is allowed; this way the camera is always synchronized with the camera; in babylon it’s like skipping frame is no possible; that means the camera lags behind the mouse.

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [April 7, 2023, 3:25pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/16 "2023-04-07T15:25:32Z")

</div>

Time of day shouldn’t have any impact afaik…

Here’s mine 2 minutes ago.

 ![carPerf](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/8/b8f9c9ca91f0848f139b721d150f3c83bbec4aed.png)

As for the camera movement, 6 fps is tough to get to seem fluid.  
But I’m 95% sure it’s due to babylonjs’s default camera controls being hard-coded to expect 60 fps.

Basicly - back when the cameras were first made, they were implemented with no consideration for fps/deltaTime, they go “move by 0.00x” every frame, a bit more complex under the hood ofc, you have speed variables, inertia, and things.  
But essencially, this is why they can become very slow the lower fps you have and go zooooooooom if you go on a system that supports 120+ fps

---

<div class="post-metadata">

**Author:** ![shaderbytes](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaderbytes/32/174_2.png) [@shaderbytes](https://forum.babylonjs.com/u/shaderbytes)\
**Post date:** [April 7, 2023, 4:38pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/17 "2023-04-07T16:38:07Z")

</div>

i was going to test it … until I saw how slow its loading? How big is the asset? is this meant for web? Or are you planning to use the engine in some offline tool?

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 7, 2023, 5:59pm UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/18 "2023-04-07T17:59:11Z")

</div>

The asset size is 395 Mb.  
Also, the server where it is hosted is quite slow.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 8, 2023, 10:49am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/19 "2023-04-08T10:49:44Z")

</div>

How do you know where it’s hosted? I only have the PG link.  
And yes, the model is oversized for what it shows and the loading time is way too much for the web (in my opinion).  
But that doesn’t explain why the FPS would drop from 60 to 10. Which it doesn’t for me in the PG.  
When I said the PG server is sometimes slower, it’s essentially for loading times and once loaded I sometimes have a ~10-15% difference in performance. Clearly nothing that could explain such a huge drop.  
So, I would say the same as you @labris if it’s hosted on your own server and it drops at a certain time of day, it’s likely because your server does not deliver at this time. You should change for a server located elsewhere (closer to you or closer to your clients) and then one that delivers consistently.

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 8, 2023, 11:15am UTC](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671/20 "2023-04-08T11:15:31Z")

</div>

> [@mawa](#):
>
> How do you know where it’s hosted? I only have the PG link.

There is the link in PG

```auto
 const url = "https://testcricon.s3.amazonaws.com/LOD_high.gltf"

```

It takes about a minute for me to download. When I drop the file to Sandbox, it is displayed almost instantly, and I don’t see any FPS drops. The other question is what is the reason to have such a big file, but this is other question 🙂

[Next page](https://forum.babylonjs.com/t/horrible-performance-to-render-a-large-gltf-file-11m-faces/39671.md?page=2)
