# vtkOutlineGlowPass in multiview

**URL:** https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053
**Category:** Support
**Tags:** code
**Created:** [December 3, 2022, 10:12am UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053 "2022-12-03T10:12:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![micheleivani](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@micheleivani](https://discourse.vtk.org/u/micheleivani)
#### Post date: [December 3, 2022, 10:12am UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/1 "2022-12-03T10:12:27Z")

</div>

Hello,

I’m using Activz (vtk c#). I have a multiview following the example [https://kitware.github.io/vtk-examples/site/Cxx/Visualization/MultipleViewports/](https://kitware.github.io/vtk-examples/site/Cxx/Visualization/MultipleViewports/) and the main viewport has a glow effect following the example [https://kitware.github.io/vtk-examples/site/Cxx/Rendering/OutlineGlowPass/](https://kitware.github.io/vtk-examples/site/Cxx/Rendering/OutlineGlowPass/)

 ![image](https://discourse.vtk.org/uploads/default/original/2X/9/939c5f7aa8a4924188b106d385aa84b2068d5308.jpeg)

If there is just a render, the glow effect works fine on camera rotation. If I add multiple views, I have an issue with the main viewport and glow effect.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/9/9158841520bc058e3e3c2bb7bf0808cff3c0d0ec.jpeg)

Here is some code

```auto
// RenderWindowControl view;

var lightKit = vtkLightKit.New();

var xmins = new double[4] { 0, .5, 0, .5 };
var xmaxs = new double[4] { 0.5, 1, 0.5, 1 };
var ymins = new double[4] { 0, 0, .5, .5 };
var ymaxs = new double[4] { 0.5, 0.5, 1, 1 };

var colors = new Color[4] { App.Preferences.Window3DColor, Color.DarkGray, Color.DarkSlateGray, Color.Indigo };

var renderWindow = view.RenderWindow;
renderWindow.SetAlphaBitPlanes(1);
renderWindow.SetMultiSamples(3);

var renderer0 = renderWindow.GetRenderers().GetFirstRenderer();

for (int i = 0; i < 4; i++)
{
    double[] c1 = Utility.ColorToDouble(colors[i]);

    var renderer = i != 0 ? vtkRenderer.New(): renderWindow.GetRenderers().GetFirstRenderer();

    renderer.GetActiveCamera().ParallelProjectionOn();
    renderer.SetOcclusionRatio(0.0);
    renderer.SetMaximumNumberOfPeels(100);
    renderer.SetUseDepthPeeling(1);
    renderer.SetUseHiddenLineRemoval(1);
    renderer.SetBackground(c1[0], c1[1], c1[2]);
    renderer.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);

    lightKit.AddLightsToRenderer(renderer);

    if (i != 0)
    {
    renderWindow.AddRenderer(renderer);

        var sphere = new Sphere();
        sphere.Create(0, 0, 0);
        renderer.AddActor(sphere.Actor);
        renderer.ResetCamera();
    }
}
            
var basicPasses = vtkRenderStepsPass.New();
var glowPass = vtkOutlineGlowPass.New();
glowPass.SetDelegatePass(basicPasses);
glowPass.SetOutlineIntensity(2.5f);

var outlineRender = vtkRenderer.New();
outlineRender.SetViewport(xmins[0], ymins[0], xmaxs[0], ymaxs[0]);
outlineRender.InteractiveOff();
outlineRender.SetLayer(1);
outlineRender.SetPass(glowPass);
outlineRender.SetActiveCamera(renderer0.GetActiveCamera());

renderWindow.SetNumberOfLayers(2);
renderWindow.AddRenderer(outlineRender);

```

Any idea?

Thank you.

---

<div class="post-metadata">

### Author: ![micheleivani](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@micheleivani](https://discourse.vtk.org/u/micheleivani)
#### Post date: [December 5, 2022, 7:53pm UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/2 "2022-12-05T19:53:50Z")

</div>

Is this a VTK bug? Thank you. @LucasGandel

---

<div class="post-metadata">

### Author: ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)
#### Post date: [December 6, 2022, 12:59pm UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/3 "2022-12-06T12:59:03Z")

</div>

Indeed, it looks like the depth/color buffers are not cleared for the outline renderer. In addition, the outline is always rendered on the bottom left even if you set different viewport values. I don’t think such render passes support multiple viewports, but it should not be too hard to fix.

In the meantime, adding an extra vtkCameraPass as delegate should fix the depth/color issue:

```auto
    var cameraPass = vtkCameraPass.New();
    cameraPass.SetDelegatePass(glowPass);
   ...
    outlineRender.SetPass(cameraPass);

```

---

<div class="post-metadata">

### Author: ![micheleivani](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@micheleivani](https://discourse.vtk.org/u/micheleivani)
#### Post date: [December 8, 2022, 8:08am UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/4 "2022-12-08T08:08:48Z")

</div>

> [@LucasGandel](#):
>
> ```auto
> outlineRender.SetPass(cameraPass);
> 
> ```

Thank you, Lucas, for your suggestion, but adding an extra delegate does not fix the issue.

---

<div class="post-metadata">

### Author: ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)
#### Post date: [December 8, 2022, 1:52pm UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/5 "2022-12-08T13:52:35Z")

</div>

Interesting, I tried it again with 9.1 and 9.2 and both work fine when adding an extra camera pass and making sure the viewport is (0, 0, 0.5, 0.5) for the renderer in overlay. But I confirm any other viewport values and render pass setup fails as described.

---

<div class="post-metadata">

### Author: ![micheleivani](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a88e4f/32.png) [@micheleivani](https://discourse.vtk.org/u/micheleivani)
#### Post date: [December 23, 2022, 8:27am UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/6 "2022-12-23T08:27:19Z")

</div>

Thank you, Lucas. Indeed in my official application, I use the lower-right viewport. Do you think this bug could be fixed in a future release?

---

<div class="post-metadata">

### Author: ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)
#### Post date: [January 4, 2023, 2:13pm UTC](https://discourse.vtk.org/t/vtkoutlineglowpass-in-multiview/10053/7 "2023-01-04T14:13:08Z")

</div>

As this is a very specific use case, I don’t think this will be addressed unless someone provides funding for it. But I think it should not be too hard too fix, so you might want to open a new issue on the vtk repository in case someone wants to address it.
