How to realize this feature in VTK

The power is inside of the car, but it can be saw, I can sure it doesn’t use transparent method, how to do in VTK?
< < Picture removed according to original author desire > >

Hello,

My two cents: as far as I know, the alpha channel value in color lookup tables of VTK are used to set translucency. To have custom alpha blending effects like in that example, you can refer to this primer: https://www.kitware.com/vtk-technical-highlight-dual-depth-peeling/ .

It likely involves customizing the shader code in vtkDualDepthPeelingPass class: VTK/vtkDualDepthPeelingPass.cxx at master · Kitware/VTK · GitHub or related classes.

Maybe someone out there with more experience in this has a simpler approach to customizing the alpha belnding behavior in VTK rendering.

take care,

Paulo

In OpenGL, it set GL_DEPTH_TEST, it is easy to realize, but I haven’t found the method in VTK

Dear Paulo, do you have an example to show how to use vtkDualDepthPeelingPass? Thanks

Unfortunately I couldn’t find any examples. I just proposed a starting point. Hence the “my two cents”. Changing the default alpha blending behavior written in VTK without getting into the bowels of OpenGL likely involves writing a custom shader.

Anyway, if you’re familiar with OpenGL, you can study the class vtkOpenGLState (https://vtk.org/doc/nightly/html/classvtkOpenGLState.html#details) to manage the OpenGL context between VTK calls. The OpenGL state is managed by carefully scoping the objects so the state is restored once they go out of scope, thus making it less likely to break VTK innards:

(...) //VTK calls unaffected by state change.
{ 
  vtkOpenGLState *ostate = renWin->GetState(); 
  vtkOpenGLState::ScopedglDepthMask dmsaved(ostate); // the prior state is now saved ...
  ostate->glDepthMask(GL_TRUE); // change something 
  (...) //make VTK calls with modified OpenGL state.
} // prior state will be restored here as it goes out of scope
(...) //VTK calls unaffected by state change.

regards,

Paulo

maybe you can draw onto 2 separate layers which share the same camera.

I have a similar feature on my software and im using 2 layers, one in the back and one in the front. When i select a part of the 3d model i move the selected cells to the front renderer. Like what Marco suggested.

looks like the part was rendered twice - once opaque with depth test on, and once with transparency on and depth test off. 2 actors (or a prop assembly), 1 renderer layer.

I would like to know how to set depth test on in VTK?