# Fps dropping when panning the camera

**URL:** <https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000>\
**Category:** Questions\
**Created:** [May 6, 2019, 2:07am UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000 "2019-05-06T02:07:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeonYao](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@LeonYao](https://forum.babylonjs.com/u/LeonYao)\
**Post date:** [May 6, 2019, 2:07am UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/1 "2019-05-06T02:07:53Z")

</div>

Hi,  
Recently I’ve been using babylonjs to implement a 3d project and I found after load a lot of meshes (more than 100 million triangles totally), the fps will drop rapidly when panning the scene (or camera). After doing some performance indicating, I end up with finding the InputManager is always executing picking function when \_onPointerUp, \_onPointerDown and \_onPointerMove, which makes every panning process so slow.  
So eventually I just have to override the `scene.pointerDownPredicate`, `scene.pointerMovePredicate` and `scene.pointerUpPredicate` functions and make them always return a false result to let the picking process end up there. And my question is, am I doing the right way for reducing the fps turbulence? Or is there any advanced methods for improving this? Many thanks!

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/d/d3dd39116a686121c772e255291ce223d5a93d12.jpeg)

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [May 6, 2019, 2:16pm UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/2 "2019-05-06T14:16:07Z")

</div>

Hi LeonYao,

First of all, welcome to Babylon! This idea might not work if you’re using those events at other times (Do you have a Playground that shows your use case?), but it looks like [Scene.attachControl](https://doc.babylonjs.com/api/classes/babylon.scene#attachcontrol) has options to disable the calling of the `_onPointer...()` events. If you disable the events from there, does the performance improve?

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [May 6, 2019, 2:58pm UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/3 "2019-05-06T14:58:23Z")

</div>

One direct way, which will also have other benefits, is to merge meshes which of the same material which never move or rotate, assuming you have many. Not only does this reduce this overhead, but anything inside the render loop on the cpu side.

Because the cpu side is single threaded having a bunch of them kind of negates the parallel nature of he gpu. There is also a significance overhead for each gpu call, so few of them helps A lot.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 6, 2019, 2:58pm UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/4 "2019-05-06T14:58:42Z")

</div>

You can flag your meshes with mesh.isPickable = false to avoid any interaction with the pointers

---

<div class="post-metadata">

**Author:** ![LeonYao](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@LeonYao](https://forum.babylonjs.com/u/LeonYao)\
**Post date:** [May 7, 2019, 1:39am UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/5 "2019-05-07T01:39:41Z")

</div>

Hi, Deltakosh  
It works for my code. Many thanks for the advice!

---

<div class="post-metadata">

**Author:** ![LeonYao](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@LeonYao](https://forum.babylonjs.com/u/LeonYao)\
**Post date:** [May 7, 2019, 1:48am UTC](https://forum.babylonjs.com/t/fps-dropping-when-panning-the-camera/3000/6 "2019-05-07T01:48:13Z")

</div>

Hi, syntheticmagus  
Thanks for the advice. I used the method Deltakosh suggested, it worked. So I thank maybe it is the easiest way. But still appreciate for your help!
