Why adding glowlayer makes scene slow

Hello guys,

in order to lit some meshes in my scene I added glowlayer to use emissiveColor later.
But I noticed as soon as I define a new glowlayer the scene become more slow.
here my PG : https://playground.babylonjs.com/index.html#KI8BJH#37
adding glowlayer in lines 380,381,382 and 383

thank you

pinging @sebavan

It will definitely be slower as to handle the glow, we need to draw the scene twice and rely on 4 passes of blur.

As your scene is having a big number of meshes, it will impact even more. Maybe you could try to merge some of the meshes together ?

or exclude non relevant meshes from the glow layer ?

@sebavan I can’t merge meshes because I need them in animation, but How can I exclude non relevant meshes from glow layer ?

you can use the addExcludedMesh function from the glow layer to ensure that one mesh will not be taken in account by the layer.

can I do the opposit of excludeMesh, thing like define only the mehses that I want to lit, because I have only 4 meshes that I want to blink

The thing is you also need the occluders or you will always see the highlights even if they are behind something like a wall for instance.

And yes if you want to do that you can use the function: addIncludedOnlyMesh

https://doc.babylonjs.com/how_to/glow_layer#include-only-some-meshes