# Apply Convolution2DPass to individual renderers

**URL:** https://discourse.vtk.org/t/apply-convolution2dpass-to-individual-renderers/14604
**Category:** Web
**Created:** [September 23, 2024, 8:24am UTC](https://discourse.vtk.org/t/apply-convolution2dpass-to-individual-renderers/14604 "2024-09-23T08:24:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ataxia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@Ataxia](https://discourse.vtk.org/u/Ataxia)
#### Post date: [September 23, 2024, 8:24am UTC](https://discourse.vtk.org/t/apply-convolution2dpass-to-individual-renderers/14604/1 "2024-09-23T08:24:21Z")

</div>

Hi there, I’ve been trying to figure this out for a few days but so far haven’t come up with an answer.

I’m following the example here for how to apply Convolution2DPasses:

- [vtk.js](https://kitware.github.io/vtk-js/examples/Convolution2DPass.html)

The example applies the passes directly to a view as per this snippet:

```auto
const view = renderWindow.getViews()[0];
...
view.setRenderPasses([renderPass]);
  renderWindow.render();

```

However I have multiple renderers in a scene which are all affected, such as an Orientation Cube. Ideally I’d like to be able to target the pass to a single renderer. Even with looking at the source code I don’t seem to be able to find a hook that works though.

Any help would be greatly appreciated thank you 🙂

---

<div class="post-metadata">

### Author: ![Thibault\_Bruyere](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thibault_bruyere/32/6585_2.png) [@Thibault\_Bruyere](https://discourse.vtk.org/u/Thibault_Bruyere)
#### Post date: [September 23, 2024, 8:30am UTC](https://discourse.vtk.org/t/apply-convolution2dpass-to-individual-renderers/14604/2 "2024-09-23T08:30:49Z")

</div>

Hello!  
Render passes are given to the render window (the `view`)  
The render window contains renderers, so the render pass can filter the right renderers  
For example in the vtkForwardPass, the `traverse` function iterates over all renderers:

```js
const renderers = viewNode.getRenderable().getRenderersByReference();

```

You could select the right renderer or exclude some renderers instead of iterating on all renderers?

---

<div class="post-metadata">

### Author: ![Ataxia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@Ataxia](https://discourse.vtk.org/u/Ataxia)
#### Post date: [September 23, 2024, 11:22am UTC](https://discourse.vtk.org/t/apply-convolution2dpass-to-individual-renderers/14604/3 "2024-09-23T11:22:36Z")

</div>

Hi @Thibault_Bruyere, thank you for responding so quickly! 🙂

Eventually fixed it up by extending the vtkForwardPass twice and modifying the renderers/layers to focus each pass where I wanted it to apply. Then just put each pass on the view in sequence. Worked a treat, thank you again!

```auto
let pass0: Conv2DPass = renderer0Only.newInstance()
        let pass1: Conv2DPass = renderer0Plus.newInstance()

        if (state.conv != null) {
            if (state.conv.gaussianBlur)
                pass0 = applyPass(gaussianBlurPass, pass0)
            pass0 = applyPass(getMaskPass(state.conv.enhancement), pass0)
        }

        this.view.setRenderPasses([pass0, pass1])

```
