# Rendering glitches when using vtkSSAOPass and vtkDepthPeelingPass

**URL:** https://discourse.vtk.org/t/rendering-glitches-when-using-vtkssaopass-and-vtkdepthpeelingpass/15762
**Category:** Support
**Created:** [June 26, 2025, 10:04am UTC](https://discourse.vtk.org/t/rendering-glitches-when-using-vtkssaopass-and-vtkdepthpeelingpass/15762 "2025-06-26T10:04:40Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![ctroesch](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ctroesch](https://discourse.vtk.org/u/ctroesch)
#### Post date: [June 27, 2025, 9:39am UTC](https://discourse.vtk.org/t/rendering-glitches-when-using-vtkssaopass-and-vtkdepthpeelingpass/15762/5 "2025-06-27T09:39:26Z")

</div>

Alright, I managed to make it work by using a custom `vtkRenderPassCollection` and a dedicated SSAO camera pass.

Someone had a similar issue in python:

> [@SSAO peculiar effect with translucent geometry](https://discourse.vtk.org/t/ssao-peculiar-effect-with-translucent-geometry/4410/2):
>
> The odd color behavior is related to an internal color buffer that you are not supposed to see. Note that you will be able to enable SSAO without render passes in VTK 9.1. In the mean time, you can try something equivalent to [F3D render passes](https://gitlab.kitware.com/f3d/f3d/-/blob/master/src/vtkF3DRenderPass.cxx#L125): lightsP = vtk.vtkLightsPass() opaqueP = vtk.vtkOpaquePass() translucentP = vtk.vtkTranslucentPass() volumeP = vtk.vtkVolumetricPass() collection = vtk.vtkRenderPassCollection() collection.AddItem(lightsP) # opaque passes …

For anyone interested this is my final setup to make SSAO & Depth Peeling work together:

```c++
    vtkNew<vtkOpaquePass> opaque;

    vtkNew<vtkCameraPass> ssaoCameraPass;
    ssaoCameraPass->SetDelegatePass(opaque);

    vtkNew<vtkSSAOPass> ssaoPass;
    ssaoPass->SetDelegatePass(ssaoCameraPass); // SSAO applies to opaque geometry
    ssaoPass->SetRadius(20);
    ssaoPass->SetKernelSize(256);

    // Depth peeling for translucent geometry
    vtkNew<vtkDepthPeelingPass> peelingPass;
    peelingPass->SetMaximumNumberOfPeels(16);
    peelingPass->SetOcclusionRatio(0.01);

    vtkNew<vtkTranslucentPass> translucentPass;
    peelingPass->SetTranslucentPass(translucentPass);

    vtkNew<vtkLightsPass> lights;

    // Compose the sequence
    vtkNew<vtkRenderPassCollection> passes;
    passes->AddItem(lights);
    passes->AddItem(ssaoPass); // SSAO for opaque geometry
    passes->AddItem(peelingPass); // Depth peeling for translucent

    vtkNew<vtkSequencePass> sequence;
    sequence->SetPasses(passes);

    // Wrap it into a camera pass
    vtkNew<vtkCameraPass> cameraPass;
    cameraPass->SetDelegatePass(sequence);

    // Set the final pass
    renderer->SetPass(cameraPass);

```

 ![image](https://discourse.vtk.org/uploads/default/original/2X/5/5982b32f1c91c08456b0f7a44bb4a9db22785807.jpeg)

Thanks for the help,

Clément

---

_[View the full topic](https://discourse.vtk.org/t/rendering-glitches-when-using-vtkssaopass-and-vtkdepthpeelingpass/15762)._
