# Snapshot rendering glow layer penetration

**URL:** <https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459>\
**Category:** Questions\
**Tags:** octree, glowlayer, sr\
**Created:** [January 23, 2024, 10:30am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459 "2024-01-23T10:30:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangyahan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zhangyahan/32/31789_2.png) [@zhangyahan](https://forum.babylonjs.com/u/zhangyahan)\
**Post date:** [January 23, 2024, 10:30am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/1 "2024-01-23T10:30:33Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/?webgpu#03BKEK%2311)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

with some angles, the box does not block the luminous layer behind it. I struggled with this problem for a long time, until I replicated it at pg. Please give me some advice

I applied everything that could be optimized to the scene including: octree, snapshot rendering, NCM, etc…

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/4/14722ca1d823634184c7dbff3ec5a80c134f3236.jpeg)

My project was more confusing, and I wasn’t quite sure what the problem was. All of these issues will disappear when the standard snapshot mode is turned off.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/3/a351db5f5ca48fad61efc6483793223645e13769.jpeg)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 23, 2024, 11:38am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/2 "2024-01-23T11:38:13Z")

</div>

cc @Evgeni_Popov

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 23, 2024, 12:13pm UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/3 "2024-01-23T12:13:35Z")

</div>

It seems removing everything related to octree makes it work:

> **[Babylon.js Playground](https://playground.babylonjs.com/?webgpu#03BKEK%2313)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

In any case, you don’t need / should not use an octree as all meshes have `alwaysSelectAsActiveMesh = true`, so the octree is of no use, and will slow down things instead.

---

<div class="post-metadata">

**Author:** ![zhangyahan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zhangyahan/32/31789_2.png) [@zhangyahan](https://forum.babylonjs.com/u/zhangyahan)\
**Post date:** [January 23, 2024, 2:01pm UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/4 "2024-01-23T14:01:55Z")

</div>

Isn’t octree able to speed up collision detection calculations? That’s why I used it

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 23, 2024, 4:33pm UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/5 "2024-01-23T16:33:14Z")

</div>

In that case, you can keep the Octree but reset the `getActiveMeshCandidates` and `getActiveSubMeshCandidates` scene properties so that they don’t use the Octree:

> **[Babylon.js Playground](https://playground.babylonjs.com/?webgpu#03BKEK%2316)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![zhangyahan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zhangyahan/32/31789_2.png) [@zhangyahan](https://forum.babylonjs.com/u/zhangyahan)\
**Post date:** [January 25, 2024, 6:00am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/6 "2024-01-25T06:00:23Z")

</div>

More serious issues occurred during testing in my project using the playground approach. I use the octree、NCM、snapshot mode、direct light、 Cascaded shadow。 I’m about to give up using snapshot mode.

 ![69739742db826cc07b743adc80ec3b7](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/0/90c6bdae24abe00da37fb2ec4c57ceeb2c6da1dd.jpeg)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 25, 2024, 10:31am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/7 "2024-01-25T10:31:26Z")

</div>

As explained in the docs, snapshot mode has some restrictions and may be difficult to use in the general case. Best used in “fast” mode, for mostyl static scenes. However, if you are able to reproduce the problems in the PG, we can try to fix them.

---

<div class="post-metadata">

**Author:** ![zhangyahan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zhangyahan/32/31789_2.png) [@zhangyahan](https://forum.babylonjs.com/u/zhangyahan)\
**Post date:** [January 25, 2024, 10:34am UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/8 "2024-01-25T10:34:19Z")

</div>

Yes, I could try to reproduce the problem, but it might take a while. Because I don’t know what causes this problem, it may not be easy to reproduce.

---

<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:** [January 29, 2024, 7:57pm UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/9 "2024-01-29T19:57:45Z")

</div>

looks like it could be alpha sorting @Evgeni_Popov ?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 29, 2024, 9:35pm UTC](https://forum.babylonjs.com/t/snapshot-rendering-glow-layer-penetration/47459/10 "2024-01-29T21:35:15Z")

</div>

Yes, alpha sorting will be even more problematic in snapshot mode than in standard mode because meshes are not sorted front to back. It’s part of the restrictions I spoke above related to this mode.
