# SSAO per material, is that even possible?

**URL:** <https://forum.babylonjs.com/t/ssao-per-material-is-that-even-possible/37778>\
**Category:** Questions\
**Tags:** lighting, material, effect\
**Created:** [January 31, 2023, 6:18am UTC](https://forum.babylonjs.com/t/ssao-per-material-is-that-even-possible/37778 "2023-01-31T06:18:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 31, 2023, 11:38am UTC](https://forum.babylonjs.com/t/ssao-per-material-is-that-even-possible/37778/2 "2023-01-31T11:38:03Z")

</div>

You can use a second camera to render the meshes that should not receive SSAO and use the technic described in this post to make it work:

> [@Sharing depth buffer between two cameras](https://forum.babylonjs.com/t/sharing-depth-buffer-between-two-cameras/34971/8):
>
> Here’s how to make it work with the current Babylon.js codebase (MSAA not fully supported): You need to create the depth/stencil texture for the Edge post process, so that the depth can be shared with the 2nd camera: postProcess.onSizeChangedObservable.add(() =\> { if (!postProcess.inputTexture.depthStencilTexture) { postProcess.inputTexture.createDepthStencilTexture(0, true, false, 4); postProcess.inputTexture.\_shareDepth(rtt.renderTarget); } }…

As an example:

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

---

_[View the full topic](https://forum.babylonjs.com/t/ssao-per-material-is-that-even-possible/37778)._
