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

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:

The correct version:

What can be wrong? I am using just stlReader for the model and simple Cylinder.

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.

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?

1 Like

@fraseyboo, do you know?

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()

        # opaque passes
        ssaoCamP = vtk.vtkCameraPass()

        ddpP = vtk.vtkDualDepthPeelingPass()

        overP = vtk.vtkOverlayPass()

        sequence = vtk.vtkSequencePass()

        fxaaP = vtk.vtkOpenGLFXAAPass()

        camP = vtk.vtkCameraPass()


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

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