Hi VTK experts.
I am experimenting with Volume Rendering in my VTK-based Java application, and I am facing some issues with the GPU-based volume mapper. On the other side, my code seems to work fine (but slow) with the CPU-based volume mapper
Foreword: I am still using VTK version 6.1, so if you believe the issues that I’ll describe here may be fixed just by upgrading to the latest VTK version, please let me know, and I will work in this direction.
As I anticipated above, I am working in Java. Here is how my pipeline looks like:
=====
// Initialize opacity function
opacityFunct = new vtkPiecewiseFunction();
// ...(code)...
// Initialize the gradient opacity function
gradientOpacityFunct = new vtkPiecewiseFunction();
// ...(code)...
// Initialize the color transfer function
colorTransfFunct = new vtkColorTransferFunction();
// ...(code)...
// Initialize the volume's properties
vtkVolumeProperty volumeProperty = new vtkVolumeProperty();
volumeProperty.ShadeOn();
volumeProperty.SetInterpolationTypeToLinear();
volumeProperty.SetScalarOpacity(opacityFunct);
volumeProperty.SetGradientOpacity(gradientOpacityFunct);
volumeProperty.SetColor(colorTransfFunct);
volumeProperty.SetAmbient(0.4);
volumeProperty.SetDiffuse(0.8);
volumeProperty.SetSpecular(0.2);
// Initialize the mapper
volumeMapper = new vtkFixedPointVolumeRayCastMapper();
// If I replace the line above with:
// volumeMapper = new vtkOpenGLGPUVolumeRayCastMapper();
// then I won't see any volume in my render scene. Why?
volumeMapper.AutoAdjustSampleDistancesOn();
volumeMapper.SetBlendModeToComposite();
volumeMapper.SetSampleDistance(1.0);
volumeMapper.SetInputConnection(getVTKImageReader().GetOutputPort());
// Initialize the actual volume prop
volume = new vtkVolume();
volume.SetMapper(volumeMapper);
volume.SetProperty(volumeProperty);
vtkRenderer existingCanvasRenderer = GetRenderer();
existingCanvasRenderer.AddViewProp(volume);
=====
In brief, if I use vtkFixedPointVolumeRayCastMapper as my volume mapper, then rendering works fine, and I can see the volume as show in this screenshot:
https://drive.google.com/open?id=1rembBgloqJalqeUTMZlpp7sPku4B3yeI
However, interaction with the volume is extremely slow.
On the other side, if I use vtkOpenGLGPUVolumeRayCastMapper (or also vtkSmartVolumeMapper), then I cannot see any volume in my rendering panel, and the scene looks like this:
https://drive.google.com/open?id=1w_rXP2Q03frRdafG5BtacTK9LJ52g8Ji
Can you see any obvious reason for that?
Can it be an issue of my graphics adapter (NVIDIA GeForce GTX 1060 6 GB) or of its driver?
Or, can it be an issue related to VTK 6.1?
Thank you in advance for your comments.
Regards,
Marco