GlowLayer removeIncludedOnlyMesh has no effect

Hello everyone,

I am trying to toggle some meshes’ glow, adding and removing them from/to the glow layer. I don’t know if that’s the expected behavior but the call removeIncludedOnlyMesh doesn’t seem to work. When I try to remove a mesh them from the glow layer, they keep glowing.

The source code looks correct but the behavior is not what I expect.

In this playground I was expecting the mesh to not glow: https://playground.babylonjs.com/#LRFB2D#421

If this is the expected behavior, how can I remove a mesh from the glow layer, after adding it using the addIncludedOnlyMesh?

Thank you in advance

Hi,
From some tests I quickly did it looks like you cannot remove the last included to the exception list without adding another one. Not sure why this is?cc @Evgeni_Popov

You should not get the first children of what scene.getMeshByName returns because it already returns the mesh you are looking for (or use getTransformNodeByName instead):

Note that includedOnlyMeshes is evaluated before excludedMesh: if the array is not empty, only meshes in the array wil be drawn in the glow layer, and if it is empty, all meshes in the scene will be drawn, save from the ones from excludedMeshes.

2 Likes

Thank you! I got it now, so in my case for convenience I could have a dummy mesh on the includedOnlyMeshes so I can freely toggle my meshes without resetting the logic.

@mawa now your comment makes sense.

1 Like

My comments always make more sense when @Evgeni_Popov explains’em :grin:
Even I can now understand it :rofl: