Layered rendering with multiple renderers

Hello developers,

I am stuck in a problem that seems a bit basic but still could not solve it yet.

I am using multiple rendering layers to render different kinds of Fiber tracts (Red and orange) overlaid each other. As shown in the Figure below. Red fibers are rendered always on the top of the orange fibers as they are rendered on another renderer.


This is what I needed and it worse really well. The problem rises when I visualize slices on the ordering window. Since the slices are rendered on the bottom layer, the red fibers are always rendered on the top and slices are not cutting those fibers. This is due to the fact that red fibers are rendered on the top.


Now I want some suggestions on how to solve this problem? I want the slices to cut all the fibers regardless of their rendering layers. Please note that I always want red fibers on the top of orange.

Are their any other method to achieve this?

@lassoan Can you help me with this, Thanks in advance, :slight_smile:

By using layers, you would degrade your true 3D rendering to something like 2.5D rendering. If you want to make the red tracts always appear in front of orange then you can simply display red tracts using 1% larger diameter tubes than orange tubes.

Thanks for your response @lassoan , the red tubes are actually center tubes and they lie between yellow tubes. Since the number of yellow tubes is very large. you cannot see the red ones due to occlusion. To remedy this, I rendered red tubes in another rendering layer. This is what I needed.

The problem occurs when I add slices. Since slices are not able to cut red tubes as they are in another rendering layer.

Do you have any solution such that the red tubes rendered on the top of yellow tubes and at the same time slices should be able to cut all the tubes?

I hope I am clear. looking forward to your response.

If you add a layer then it improperly occludes everything - not just slices but everything else that Slicer can display (models, markups, segmentations, etc.). Adding a new rendering layer solves one problem and introduces many other problems that may be much harder to resolve.

Instead of breaking occlusion computation, I would suggest to experiment with the followings:

  • Make sure the red tubes are always visible by making orange tubes semi-transparent.
  • Change coincident topology offset parameters in the mapper (for example, use SetRelativeCoincidentTopologyPolygonOffsetParameters to push back the orange tracts)
  • Ask for more advice on the VTK forum

Thank you so much for your suggestions @lassoan . I will try them.


I have been busy with solving other problems in pipeline, now I am getting back to solve this problem. I have tried SetRelativeCoincidentTopology. It somehow add other artifacts like crossing tubes, pushing back the lines when altering the Z-buffer, hence loosing the actual depth perception.

Are there any other ideas to solve this problem?

I have also asked in VTK forum, but could not get any help there.

Thank you and looking forward to your response.

I see that you posted on the VTK forum we can continue the discussion here after you got some suggestions there.

yes sure, I am waiting for the suggestions… but unfortunately no one replied yet. Do you have any suggestion @lassoan

People on the VTK forum are not that responsive. You can ask on the same topic every 3-4 days for 1-2 weeks, each time describing what you have tried in the meantime and how it worked. If you keep your posts short and clear, add nice illustrative images, and make it clear that you are making an effort then the chances that you get help are much higher.

If you want guaranteed response time then probably you need to ask for a paid consultation, for example you can use Kitware’s webshop to buy VTK expert’s time to help you.

I think your requirements are self-contradicting (you cannot have correct 3D composition but at the same time some structures “always on top”), that’s why it is very hard to solve it. There are several straightforward solutions if you redefine your requirements, for example if you just want to make sure that red fibers are always distinguishable then you can achieve that by changing color, radius, transparency; you can use multiple tube filters and you can also parameters by specifying point scalar arrays in the vtkTubeFilter input.

Thank you @lassoan or your suggestion. Yes, my problem is indeed a bit contradicting. I do need my red tubes to be on the top and at the same time, I want the planes to cut the tubes. Changing the tube parameters (color.radius, transparency) won’t solve the problem, as it gets occluded by the orange poly lines.

Are there any other filters which I can use to render red tube and make it visible even if its occluded by orange polylines?

Thank you.