vtkVolume is not rendered when RenderPass is set (vtkSSAOPass)

Hi @all,

I’m experimenting around with vtkSSAOPass right now.
I noticed that when I assign it to my renderer via ‘.SetPass(…)’, no vtkVolume objects are displayed.
If I remove the assignment, the volume object is displayed.

Code snippet of my volume creation:

// set volume mapper
vtkOpenGLGPUVolumeRayCastMapper mapper = new vtkOpenGLGPUVolumeRayCastMapper();
mapper.UseJitteringOn();		
mapper.SetInputData(imagedata);
mapper.SetAutoAdjustSampleDistances(1);	
mapper.AutoAdjustSampleDistancesOff();	
mapper.SetBlendModeToComposite();
		
// volume property
vtkVolumeProperty volProp_Default = GetVolumeProperty_Default();

vtkVolume volume = new vtkVolume();
volume.SetMapper(mapper);
volume.SetProperty(volProp_Default);
volume.SetOrientation(getActor().GetOrientation());
volume.SetPosition(getActor().GetPosition());

Could it be due to the mapper used?
Any hint is welcome!

SSAO and Volume are incompatible afaik

Okay, that means I would have to remove the RenderPass when switching to Volume and set it again when switching to SSAO? Simultaneous rendering is then not possible.
Or is there a better solution?

That would require multiple mappers.

I’ve tested this in 3D Slicer and I can confirm that SSAO does not interfere with volume rendering (vtkGPUVolumeRaycastMapper), when the it is activated by simply calling renderer.SetUseSSAO(True).

Thanks for checking Andras !

That sounds good, so it’s possible.

Unfortunately, I can’t solve the problem by enabling it with “SetUseSSAO” and changing the mapper to “vtkGPUVolumeRaycastMapper”, at least not completely.
The volume object is approximately visible, but when the camera changes, the volume representation partially disappears completely (see screenshot on the right).

It seems that it doesn’t work when RenderPass is set.
The differences between set RenderPass and de-/activated UseSSAO can be seen in the following screenshot. A vtkActor with vtkVolume is displayed.

From left to right:
no RenderPass + SetUseSSAO(false) | no RenderPass + SetUseSSAO(true) | with RenderPass + SetUseSSAO(true))

Could other settings possibly solve the problem?

You can give this a try in 3D Slicer and if it works well there then look for differences compared to your environment. Things that may alter rendering result include difference in VTK version, depth peeling, clipping planes, presence of opaque surfaces.

If you develop a medical application then I would recommend to consider building it on 3D Slicer, instead of rebuilding everything from scratch. For example, if you encounter a rendering bug in 3D Slicer then you just report this issue and it gets fixed. It often takes several weeks and involvement of several Slicer and VTK developers to fix problems like this after each major VTK and Slicer update, on all platforms (Windows, Linux, macOS). Sometimes problems occur only on certain platforms, certain graphics cards or driver versions, so if you want all potential users to have a good experience then you need to test on thousands of configurations every day and get feedback if something is wrong and fix it. You get this with 3D Slicer for free, with the same restriction-free license as VTK. You also get all the essential features that users expect (DICOM import/export, slice and 3D visualization, segmentation, registration, annotation, quantification, etc.) and lots of specialty features (such as surgical planning, radiation therapy, shape analysis, etc.) See www.slicer.org for details or ask anything discourse.slicer.org.

Thanks, I’ ll try it with 3D Slicer.

1 Like