# glowLayer behaviour of "Included Only" Meshes

**URL:** <https://forum.babylonjs.com/t/glowlayer-behaviour-of-included-only-meshes/59630>\
**Category:** Questions\
**Created:** [July 19, 2025, 7:10pm UTC](https://forum.babylonjs.com/t/glowlayer-behaviour-of-included-only-meshes/59630 "2025-07-19T19:10:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yedpodtrzitko](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yedpodtrzitko](https://forum.babylonjs.com/u/yedpodtrzitko)\
**Post date:** [July 19, 2025, 7:10pm UTC](https://forum.babylonjs.com/t/glowlayer-behaviour-of-included-only-meshes/59630/1 "2025-07-19T19:10:36Z")

</div>

Hi,  
I’m curious how to handle following scenario:

- have a glowLayer
- add mesh A via `addIncludedOnlyMesh(meshA)`
- add mesh B via `addIncludedOnlyMesh(meshB)`
- remove mesh A via `removeIncludedOnlyMesh(meshA)`

interim result:

- only mesh B is glowing, since it’s still included in the layer `glowLayer._thinEffectLayer._includedOnlyMeshes`

- remove mesh B via `removeIncludedOnlyMesh(meshB)`

current result:

- all viable meshes in the scene are glowing, as `glowLayer._thinEffectLayer._includedOnlyMeshes` is now empty (I assume that’s the reason)

expected result:

- no meshes would be glowing, since I wanted the layer to work only with explicitly added items, and when these are removed, none of them should be glowing.

current result:  
since the is now empty, the glowLayer is considering all items in the scene should be included in the glowLayer because (again, I just assume) checking `glowLayer._thinEffectLayer._includedOnlyMeshes` says there should be no exception what to highlight

This makes it tricky because I want to dynamically add and remove items from the glowLayer, but when removing the last one, the behaviour becomes opposite what I would expect (ie. no items glowing vs. all items glowing). Here’s PG example for illustration. Uncommenting `gl.addIncludedOnlyMesh(clonedTube)` on line 24 changes the behaviour of what will end up glowing.

> **[Babylon.js Playground](https://playground.babylonjs.com/#RJAS6N%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

My current workaround is to add a dummy object which will be never removed from `_includedOnlyMeshes` (lines 17-18 in the PG). Is there any cleaner solution than this?

---

<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:** [July 21, 2025, 3:29pm UTC](https://forum.babylonjs.com/t/glowlayer-behaviour-of-included-only-meshes/59630/3 "2025-07-21T15:29:56Z")

</div>

You are tottaly right we do not have a mecanism forcing a includeOnlyMode when no meshes are present.

Your workaround is totally fine and I wonder if a new mode would not introduce even more confusion.
