# Enable ssao2 scene render notify error

**URL:** <https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962>\
**Category:** Questions\
**Created:** [May 19, 2023, 3:31am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962 "2023-05-19T03:31:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 19, 2023, 3:31am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/1 "2023-05-19T03:31:20Z")

</div>

Enable SSAO2 post-processing, prompt information when rendering the scene

code:

```auto
let ssaoRatio = {
                ssaoRatio: 1, // Ratio of the SSAO post-process, in a lower resolution
                blurRatio: 0.5, // Ratio of the combine post-process (combines the SSAO and the scene)
                combineRatio: 1,
            };

            ssao2 = new SSAO2RenderingPipeline("SSAO2RenderingPipeline", scene, ssaoRatio);
            // set 1，super jagged，set 4 resample；
            if (ssao2?._prePassRenderer) {
                ssao2._prePassRenderer.samples = 4;
            }
        }

        // Attach camera to the SSAO render pipeline  
        if (scene?.postProcessRenderPipelineManager?.attachCamerasToRenderPipeline) {
            scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(
                "SSAO2RenderingPipeline",
                [scene.activeCamera]
            );
        }

```

when scene.render  
prompt this error

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/c/6c77fff5841c9371abea9b6d506b9960e23e0ecf.png)

---

<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:** [May 19, 2023, 8:18am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/2 "2023-05-19T08:18:01Z")

</div>

It does work for me in this PG:

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

Can you provide a repro in the Playground?

---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 19, 2023, 9:26am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/3 "2023-05-19T09:26:17Z")

</div>

I created an example, press f12 to open the console, click the 1 and 3 keyboard key repeatedly, and if you click several times, an error will be reported. This problem is not raised by me before.  
It is estimated that after this problem is solved, the code continues to execute to reproduce the problem I mentioned before.  
1 or 3 repeat several times

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/7/07daa58f6e66a6d2e4c12f465db8853739bec683.png)

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

---

<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:** [May 19, 2023, 10:14am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/4 "2023-05-19T10:14:56Z")

</div>

The repeated alternation between 1 and 3 works. It fails if you hit the 1 (or 3) twice in a row, because the PG does not take this into account. A simple solution:

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

---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 23, 2023, 2:29am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/5 "2023-05-23T02:29:30Z")

</div>

Thank you for answering this question  
At present, this problem has seriously affected our project development. Please add an if judgment to deal with the abnormal problem and ensure the normal loading of the scene.

When the full-screen reflective is used in combination with SSAO2, there will be false shadows  
This problem can be reproduced by first turning on the full screen floodlight and then turning on SSAO2  
There is currently no PG post-addition

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/f/4fc9a293d5f8c6632c08ac82f3c52ded26bb9adb.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:** [May 23, 2023, 8:57am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/6 "2023-05-23T08:57:33Z")

</div>

Do you mean using SSR (“full-screen reflective”) and SSAO2 together does not work?

It does work in this PG:

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

If you can provide a repro in the Playground, it will be easier to help.

---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 23, 2023, 10:00am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/7 "2023-05-23T10:00:53Z")

</div>

I can’t make a case for the above problem, because my problem appears in the project, and the operation is more complicated  
I did a case of a similar operation, but the result was different from what I expected. You can see what is going on here.  
I’ll try to make a case for this problem, looking forward to it

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/5/d5c7d5b5f1971b530d95fab70032cd6c108e6fdb.jpeg)  
Modify the parameter scene does not change

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

first createSSAO2();  
second createDefaultPipeline();  
The result is different from the above

---

<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:** [May 23, 2023, 11:40am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/8 "2023-05-23T11:40:43Z")

</div>

Assigned @Evgeni\_Popov on May 23, 2023, 11:40am UTC



---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 23, 2023, 11:47am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/9 "2023-05-23T11:47:12Z")

</div>

I made a new example

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

Call these codes manually in the console  
let defaultPipeline = scene.postProcessRenderPipelineManager.\_renderPipelines[“DefaultRenderingPipeline”];  
defaultPipeline.fxaaEnabled = true;

---

<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:** [May 23, 2023, 12:17pm UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/10 "2023-05-23T12:17:10Z")

</div>

I’m going to have a look at it asap.

---

<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:** [May 26, 2023, 3:15pm UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/12 "2023-05-26T15:15:48Z")

</div>

This PR will fix the problem:

> <https://github.com/BabylonJS/Babylon.js/pull/13905>
>
> See https://forum.babylonjs.com/t/prepassrenderer-fails-with-rendertargettexture…-whose-active-camera-is-not-scene-activecamera/41143 and https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/8

---

<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:** [May 26, 2023, 3:16pm UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/13 "2023-05-26T15:16:01Z")

</div>

Unassigned @Evgeni\_Popov on May 26, 2023, 3:16pm UTC



---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [May 27, 2023, 7:21am UTC](https://forum.babylonjs.com/t/enable-ssao2-scene-render-notify-error/40962/14 "2023-05-27T07:21:46Z")

</div>

Thanks.
