# GizmoManager and SSAORenderingPipeline, It does the SSAO twice in a frame

**URL:** <https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614>\
**Category:** Questions\
**Created:** [February 13, 2022, 4:45am UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614 "2022-02-13T04:45:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![0b5vr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/0b5vr/32/22131_2.png) [@0b5vr](https://forum.babylonjs.com/u/0b5vr)\
**Post date:** [February 13, 2022, 4:45am UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/1 "2022-02-13T04:45:56Z")

</div>

### Description

I’m trying using GizmoManager along with SSAORenderingPipeline.  
When I see Nsight or SpectorJS, it seems it’s processing SSAO twice in a single frame.

More in general, I think a thing called UtilityLayer does not work well with RenderingPipeline.

How do I fix this?

### Demo

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

### Environment

- OS: Windows 10
- Browser: Chrome 98
- Babylon: 4.2.1 but the demo above also is reproducing the behavior in 5.0.0-beta

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [February 13, 2022, 1:33pm UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/2 "2022-02-13T13:33:01Z")

</div>

Hi and welcome. Your web audio and rendering stuff is awesome:) . Maybe @Evgeni_Popov can give you some insight

---

<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:** [February 14, 2022, 1:57am UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/3 "2022-02-14T01:57:56Z")

</div>

Forcing the geometry buffer (5th parameter of the `SSAO2RenderingPipeline` constructor) does reduce the number of rendering to the same number than when the gizmo is not used. So it seems it’s related to the prepass renderer: pinging @CraigFeldspar in case he has an idea.

---

<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:** [February 21, 2022, 5:50pm UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/4 "2022-02-21T17:50:50Z")

</div>

@CraigFeldspar any updates on this one ?

---

<div class="post-metadata">

**Author:** ![CraigFeldspar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/craigfeldspar/32/45631_2.png) [@CraigFeldspar](https://forum.babylonjs.com/u/CraigFeldspar)\
**Post date:** [February 27, 2022, 6:15pm UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/5 "2022-02-27T18:15:20Z")

</div>

Actually, SSAO is bound on a camera, which is the same used on the utilityLayer. So when it calls `scene.render`, the SSAO is also rendered as it’s in the list of the camera’s postprocesses.  
I’m proposing this [PR](https://github.com/BabylonJS/Babylon.js/pull/12059) that deactivates all post processes on the utility layer scene, but I don’t know if it’s the way to go. Pinging @sebavan for more insight

---

<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:** [February 28, 2022, 2:26pm UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/6 "2022-02-28T14:26:43Z")

</div>

I kind of like it @Deltakosh what do you think ?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 28, 2022, 5:17pm UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/7 "2022-02-28T17:17:27Z")

</div>

I totally support the idea 😃

---

<div class="post-metadata">

**Author:** ![0b5vr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/0b5vr/32/22131_2.png) [@0b5vr](https://forum.babylonjs.com/u/0b5vr)\
**Post date:** [March 1, 2022, 11:29am UTC](https://forum.babylonjs.com/t/gizmomanager-and-ssaorenderingpipeline-it-does-the-ssao-twice-in-a-frame/27614/8 "2022-03-01T11:29:46Z")

</div>

ohhh, so it seems simply saying `utilityLayer.utilityLayerScene.postProcessesEnabled` would be enough for my case. Thank you for the code!
