Highlight layer bug?

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 :smiley: so I combined all of them into one (big brain, i know)

1 Like

pinging @sebavan

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 ?

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:

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.

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.