Little context
I pick faces of polydata with a custom interactor style and want to display as a highlighted. To do this I create a temporary actor with different color, larger line width, reduce opacity on other actors etc. But the pick is not always clear. Currently I try these properties,
Is it possible to draw this actor last or on top of all the other actors so that the picking is clearly visible?
Note : I cannot change the property of the entire actor as the cells of faces are subset of the actor.
Alternativelly, you can try using two renderers and set one of them to be the topmost:
m_rendererMainScene->SetLayer( 0 ); //the renderer of layer 0 has background and is rendered first.
m_rendererForeground->SetLayer( 1 ); //layers greater than zero have no background and are rendered afterwards.
vtkSmartPointer<vtkRenderer> pDefaultRenderer = vtkSmartPointer<vtkRenderer>::New();
pDefaultRenderer ->SetBackground(0.1, 0.2, 0.3);
pDefaultRenderer ->SetLayer(0);
// Add actors to be rendered on top in pvtkForgroundRenderer
vtkSmartPointer<vtkRenderer> pvtkForgroundRenderer = vtkSmartPointer<vtkRenderer>::New();
pvtkForgroundRenderer->SetActiveCamera(pDefaultRenderer ->GetActiveCamera()); // Set same camera as default render
pvtkForgroundRenderer->SetLayer(1);
vtkSmartPointer<vtkRenderWindow> pVtkRenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
pVtkRenderWindow->SetNumberOfLayers(2);
pVtkRenderWindow->AddRenderer(pDefaultRenderer);
pVtkRenderWindow->AddRenderer(pvtkForgroundRenderer);
pVtkRenderWindow->Render();
In the example above, the label actor is rendered with a foreground renderer. The pilars, containing translucent segments, are rendered in a background renderer. The white text is rendered after all the background renderer’s scene completes rendering, thus it appears unaffected by the alpha blending.