I experimented with the highlight layer: On mouse over/click the mesh is added once to the highlight layer. Worked as intended. But i noticed a drop in performance, so i investigated. Somehow, as soon as a mesh is added to the highlight layer, the draw calls, active faces and active indices are doubled. In my project the jump for adding a single mesh to the highlight layer was from 1260 active indices to 2520, from 420 active faces to 840 and from 27 draw calls to 57 draw calls.
Comment out line 20 & 21:
7800 active indices, 2600 active faces, 3 draw calls
Comment in line 20:
15600 active indices, 5200 active faces, 11 draw calls
Is this a bug or a feature? If that is the way, it works, i’d have had expected a hint in the documentation, that using highlight layers could lead to performance drops.
it due to how such effects are achieved , not a bug. geometry doubled and normals inverted is common for outline effects. So for verts and indices and triangles , double can be expected , i dont know why draw calls are doubled , i think it should not be like that.
It is possible to do this in a shader , Ive done it before many years back using Unity engine. But that is for simple outlines, not a glowing outline. For the glowing a post process would probably still be required , and for that it does need to do another pass?
So basically im saying , there will always be a performance increase when adding an effect like this in some manner or another.
I have not personally looked at how babylon is handling this. Better to have someone more clued up give details. I do know they have the more performant version of it enabled by default ( overlapping highlights cancel those beneath ) and to not have that it will become even more expensive to render
Okay, thanks for your answers and time. I expected some performance drops, because, as you already said, it is an expensive operation. But i wasn’t expecting the doubled draw calls. A few, yes, but not doubled.