How to Ensure One Actor Always Renders on Top of Another Actor in VTK Without Z-Fighting?

I am working with two actors in a 3D scene, where I need one actor (highlightActor) to always appear on top of another actor (currentActor), even when they are in close proximity or overlapping. Currently, I’m facing Z-fighting issues in certain views, where the two actors seem to compete for visibility, especially when viewed from different camera angles.

I have tried using the following approaches to resolve the issue:

mapper->SetRelativeCoincidentTopologyPolygonOffsetParameters(-1, -100);
mapper->SetResolveCoincidentTopologyToPolygonOffset();

While this works in some views, it doesn’t entirely solve the problem as the highlightActor sometimes still appears behind the other actor, depending on the camera angle.
Like this:

I would like to know if there is a more reliable method in VTK to ensure that one actor always renders on top of another, regardless of camera angle or geometry.

Thank you for your help!

Hello,

You can try adding a second renderer to your render window:

    _rendererMainScene  = vtkSmartPointer<vtkRenderer>::New();
(...)
    _rendererForeground = vtkSmartPointer<vtkRenderer>::New();
    // Foreground renderer will use the same camera of the main renderer
    _rendererForeground->SetActiveCamera( _rendererMainScene->GetActiveCamera() ); 
    /* Renderers assigned to layers greater than zero have no background and
    are rendered last. */
    _rendererForeground->SetLayer( 1 ); 

(...)

    _vtkwidget->renderWindow()->AddRenderer(_rendererMainScene);
    _vtkwidget->renderWindow()->AddRenderer(_rendererForeground);

This way, actors added to _renderedForeground will always be on top of those added to _rendererMainScene.

best,
PC

Please see:

Thanks a lot for your suggestion — adding a second renderer with different layers is a clever idea.
However, I’d prefer not to set up separate interactors for each renderer. My goal is to maintain a single interactor for user input handling, as managing multiple interactors complicates the interaction logic in my application. What I actually want to do is to make sure that the two actors do not interfere with each other:

I try multiple layer and I have a problem like this:

I try but I have same problem like topology: