I want to overlay two meshes (green and red) (vtkPolyData) on top of a 3D vtkImageData slice, with a certain degree of opacity that allows for visualizing the vtkImageData behind:
However, when the green is overlayed on top of the red one, the colors blend, giving yellow:
How can I ensure that the green mesh always appears green WHILE still having a degree of opacity to view the vtkImageData behind?
Right now these two meshes are being passed to a vtkActor and then added to the same vtkRenderer.
Layers can help with ordering the actors, but since they are all transparent, colors will be still mixed. To avoid color mixing, one solution can be to remove the overlap (cut out the green segment from the red); or do opaque rendering into an image and then render that image as a transparent overlay.
@Bosingwa Low-level tasks, such as how to manage and visualize overlapping segments have been solved many years ago in numerous medical image computing applications. Several of these applications are open-source and maintained and developed with the exact purpose of avoiding spending time with redevelop such features for each project. Instead of spending your valuable time redeveloping - and debugging, testing, supporting - all the basic features (DICOM image import, 3D image reconstruction, viewer in 2D/3D, automatic/manual segmentation, segmentation visualization, image registration, fusion, export to DICOM, etc.), you would be much better off using an existing open-source platform (such as 3D Slicer or MITK) and only spend time on developing unique features of your application.
3D Slicer has been used for prototyping lots of MRI-guided prostate interventions over the years, so there are many modules that you can leverage for planning and guiding such procedures. You can also ask advice from its community of thousands of researchers, clinicians, software developers about how to adapt/extend the software to your application.