> Learn how to use the SSAO Rendering Pipeline in Babylon.js.

Source: https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/SSAORenderPipeline

# How To Use the SSAO rendering pipeline

BABYLON.SSAORenderingPipeline is a rendering pipeline (chained post-processes) that computes the ambient occlusion of a given scene from screen space.
You can find an example in our playground:

- [Playground: SSAO Rendering Pipeline Example](https://playground.babylonjs.com/#N96NXC#106) - Simple example of using the SSAO rendering pipeline.

The post-processes chain is defined by:

- Original scene color post-process: saves the original scene color
- SSAO post-process
- Horizontal blur post-process
- Vertical blur post-process
- Combine post-process: blends the Vertical blur post-process output with the original scene color

Using it is pretty straightforward:

```javascript
const ssao = new BABYLON.SSAORenderingPipeline("ssaopipeline", scene, 0.75);
```

The third argument is the ratio used by the SSAO, Horizontal blur, and Vertical blur post-processes.
You can also set an array of cameras as the fourth argument. The constructor will then automatically attach the rendering pipeline to the given cameras:

```javascript
const ssao = new BABYLON.SSAORenderingPipeline('ssaopipeline', scene, 0.75, [camera1 etc.]);
```

If you want to attach the rendering pipeline manually, use the scene rendering pipeline manager:

```javascript
const ssao = new BABYLON.SSAORenderingPipeline("ssaopipeline", scene, 0.75);
scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline("ssaopipeline", cameras);
```

**Warning: To improve performance, you should compute the SSAO/blurH/blurV with a ratio lower than 1.0.**

If you want to detach and destroy the rendering pipeline, you can just call the `dispose()` method.

```javascript
ssao.dispose();
```

You can see the SSAO post-process output by detaching the combine post-process like this:

```javascript
scene.postProcessRenderPipelineManager.disableEffectInPipeline("ssaopipeline", ssao.SSAOCombineRenderEffect, cameras);
```

**Note: SSAO uses the depth map renderer and activates it by default. You can disable the depth map renderer by passing `true` as the argument to the `dispose()` method.**

For more customization, you can specify the SSAO and Combine post-process ratios like this:

```javascript
const ssao = new BABYLON.SSAORenderingPipeline('ssaopipeline', scene, { ssaoRatio: 0.5, combineRatio: 1.0 }, [camera1 etc.]);
```
