SetOpacity is not working correctly!

I am trying to set opacity for vtkActor but any value less than 1.0 makes it invisible completely.

Opacity test example is working fine. What I am missing here?

Using vtk 8.2.0.

1 Like

If you have semi-transparent actors in the scene then you need to order their cells for correct rendering, for example by enabling depth peeling.

First, I don’t see enabling depth peeling in Opacity example.

I enabled it still no change.

SetOpacity is working by taking out UseShadowsOn(). Without enabling peeling.

1 Like

@lorensen It seems that https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/Opacity/ example is somewhat misleading. It would be better to add at least an option to use depth peeling.

@rai-sam Correct rendering of translucent geometry is shown in this example: https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry/

In some cases, from some viewpoints, some arrangement of objects, translucent objects may look like correctly rendered. However, in general you need to use depth peeling - or other polygon sorting method, or more sophisticated rendering approaches, such as raytracing - to render translucent objects correctly.

@lassoan So this will effect overall performance?

Yes, depth peeling affects rendering speed. 5-10 years ago this was a significant issue but nowadays this performance impact is rarely a problem.