# Highlight layer bug?

**URL:** <https://forum.babylonjs.com/t/highlight-layer-bug/10512>\
**Category:** Questions\
**Created:** [May 3, 2020, 4:41pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512 "2020-05-03T16:41:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djani\_Daud](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/djani_daud/32/8184_2.png) [@Djani\_Daud](https://forum.babylonjs.com/u/Djani_Daud)\
**Post date:** [May 3, 2020, 4:41pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/1 "2020-05-03T16:41:37Z")

</div>

Hello guys, I’m relatively new to babylon.js (started using it about a week ago). I looked up some optimization methods for dealing with lots of draw calls. I started using instances in my scene because they did lower my draw calls significantly. However, something strange happened. My highlight layer started causing ~20 fps drops. Here are pictures of the inspector of my scenes before and after I implemented the instance optimization:

Sorry for the goofy picture but for some reason the website doesnt allow me to upload more than 1 photo 😃 so I combined all of them into one (big brain, i know)

 ![HH](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/7/77a940c11ead3e418acb3bc79f180d6c4abbebf4.jpeg)

---

<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 4, 2020, 3:38pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/2 "2020-05-04T15:38:51Z")

</div>

pinging @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 4, 2020, 4:09pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/3 "2020-05-04T16:09:29Z")

</div>

The highlight layer can unfortunately not work with instances as it requires a separate draw call for the highlighted object.

Also it requires the scene to be drawn twice usually causing a performances hit. May I ask what type of materials you are using ? cause I have seen lately several threads with perf related issues ?

---

<div class="post-metadata">

**Author:** ![Djani\_Daud](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/djani_daud/32/8184_2.png) [@Djani\_Daud](https://forum.babylonjs.com/u/Djani_Daud)\
**Post date:** [May 4, 2020, 6:06pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/4 "2020-05-04T18:06:42Z")

</div>

I use only PBR materials, here are links for my scene if you want to look up somethings,  
the first one has implemented instances and the second one doesn’t:

with instances:  
[http://interactivetable-com.stackstaging.com/game/optimised.php](http://interactivetable-com.stackstaging.com/game/optimised.php)  
without:  
[http://interactivetable-com.stackstaging.com/game/index.php](http://interactivetable-com.stackstaging.com/game/index.php)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 4, 2020, 6:31pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/5 "2020-05-04T18:31:26Z")

</div>

Hello looking into your scene i do not see anything suspicious, both versions run at 60 fps for me with a way bigger cpu usage in the unoptimized which is expected. The number of draw calls is also divided by 2. But as you are using shadows and highlights, you need to render the scene several times.

I am wondering if your hardware support instances as it should be faster that the unoptimized version.

---

<div class="post-metadata">

**Author:** ![Djani\_Daud](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/djani_daud/32/8184_2.png) [@Djani\_Daud](https://forum.babylonjs.com/u/Djani_Daud)\
**Post date:** [May 4, 2020, 6:47pm UTC](https://forum.babylonjs.com/t/highlight-layer-bug/10512/6 "2020-05-04T18:47:59Z")

</div>

I am using a MacBook Pro 13inch 2018. Thanks for the response, I am happy that the optimized scene ran well on your device, this means that the problem is probably in my hardware and that I shouldn’t worry if it starts lagging on someone else’s device.
