# Incorrect visualization crossing objects (python, windows, vtk9.0.1)

**URL:** <https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543>\
**Category:** Development\
**Created:** [November 1, 2020, 8:01pm UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543 "2020-11-01T20:01:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![l1va](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/898d66/32.png) [@l1va](https://discourse.vtk.org/u/l1va)\
**Post date:** [November 1, 2020, 8:01pm UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/1 "2020-11-01T20:01:50Z")

</div>

Good day!  
I built exe for the windows using cx\_Freeze, python3.8, pyQt5, vtk9.0.1 and see that visualization is not correct. It works correctly for the previous (it might be vtk8.1) version. Cut by plane part of the object should be in front:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e768066f2f2f5cf71491a62b92dfda22b99b7a2e.png)  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/7/756d5d878b1196b312874ff6b98fb618ad3e7608.png)

The correct version:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/ba895e7da6ac9c280117823ed5f475a308c6c01f.png)  
What can be wrong? I am using just stlReader for the model and simple Cylinder.  
Thanks!

---

<div class="post-metadata">

**Author:** ![fraseyboo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/fraseyboo/32/2411_2.png) [@fraseyboo](https://discourse.vtk.org/u/fraseyboo)\
**Post date:** [November 1, 2020, 8:55pm UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/2 "2020-11-01T20:55:22Z")

</div>

It looks like the problem is that there’s no depth peeling enabled for translucent objects in your scene, see if you have it enabled in the renderer. If that doesn’t work you can try using your own rendering passes.

---

<div class="post-metadata">

**Author:** ![l1va](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/898d66/32.png) [@l1va](https://discourse.vtk.org/u/l1va)\
**Post date:** [November 2, 2020, 8:15am UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/3 "2020-11-02T08:15:51Z")

</div>

Thank you for the answer!  
Yes, it is not enabled. It was not set for the previous versions too, but worked. I did not see any examples with this parameter and I do not understand who needs such incorrect visualization of crossing objects - why it became by default?  
When I set `renderer.SetUseDepthPeeling(True)` my planes(cylinders) disappeared. Then I removed `actor.setOpacity(0.3)` for planes and after that, all seems work correctly. Could somebody explain the behavior? And how to set Opacity now?

---

<div class="post-metadata">

**Author:** ![l1va](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/898d66/32.png) [@l1va](https://discourse.vtk.org/u/l1va)\
**Post date:** [November 8, 2020, 10:14am UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/4 "2020-11-08T10:14:16Z")

</div>

@fraseyboo, do you know?

---

<div class="post-metadata">

**Author:** ![fraseyboo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/fraseyboo/32/2411_2.png) [@fraseyboo](https://discourse.vtk.org/u/fraseyboo)\
**Post date:** [November 8, 2020, 12:00pm UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/5 "2020-11-08T12:00:03Z")

</div>

So I’m not 100% sure what the root cause of all of this is, FWIW I don’t see this behavior in my work so it could be something specific to your build like the depth peeling class failing and defaulting to a fallback one. I’ve attached an excerpt of my code that gives me reasonably good rendering. Using multipass rendering allows for more advanced techniques to be added to the rendering pipeline but might create other issues.

```
        lightsP = vtk.vtkLightsPass()
        opaqueP = vtk.vtkOpaquePass()
        translucentP = vtk.vtkTranslucentPass()
        volumeP = vtk.vtkVolumetricPass()

        collection = vtk.vtkRenderPassCollection()
        collection.AddItem(lightsP)

        # opaque passes
        ssaoCamP = vtk.vtkCameraPass()
        ssaoCamP.SetDelegatePass(opaqueP)
        collection.AddItem(ssaoCamP)

        ddpP = vtk.vtkDualDepthPeelingPass()
        ddpP.SetTranslucentPass(translucentP)
        ddpP.SetVolumetricPass(volumeP)
        collection.AddItem(ddpP)

        overP = vtk.vtkOverlayPass()
        collection.AddItem(overP)

        sequence = vtk.vtkSequencePass()
        sequence.SetPasses(collection)

        fxaaP = vtk.vtkOpenGLFXAAPass()
        fxaaP.SetDelegatePass(sequence)

        camP = vtk.vtkCameraPass()
        camP.SetDelegatePass(fxaaP)

        renderer.SetPass(camP)

```

You should look up what other passes can be added to this code too.

---

<div class="post-metadata">

**Author:** ![l1va](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/898d66/32.png) [@l1va](https://discourse.vtk.org/u/l1va)\
**Post date:** [November 12, 2020, 8:08am UTC](https://discourse.vtk.org/t/incorrect-visualization-crossing-objects-python-windows-vtk9-0-1/4543/6 "2020-11-12T08:08:40Z")

</div>

Thank you! Seems very interesting and not understandable for me) Seems I need to learn deeper all this stuff about passes and sequences.
