No opacity from VtkImageData

Hi,

I would like to open a vti image and show it according to SimpleRayCast C++ example.

At first, I successfully ran SimpleRayCast.

I tried to open a vti file instead. The size [-0.003;+0.003[, [-0.003;+0.003[, [0;+0.010[ and the absolute value [0;5600[.

I replaced:

  • the reader from vtkStructuredPointsReader by vtkXMLImageDataReader. I applied a vtkImageMathematics.SetOperationToAbsoluteValue to keep only absolute value.
  • The opacity is 0 at 0 and 1 at 5618.
  • The color is blue at 0 and red at 5618.
  • I set SetScalarOpacityUnitDistance to 0.0003
  • I tried mapper vtkFixedPointVolumeRayCastMapper, vtkGPUVolumeRayCastMapper and vtkSmartVolumeMapper without success. I had to set volumeMapper->SetSampleDistance(0.0001) to see something with vtkFixedPointVolumeRayCastMapper

Instead of transparency, I have black pixels.

I read lots of message about opacity problem in the forum. I tried to enable depth peeling in renderer, alpha bit planes in window renderer without success.

I’m under Windows with vtk 9.2.0 built with vcpkg.

Please find enclosed the vti file and the C++ source.

vti file

main.cpp (3.7 KB)

Do I missed some thing ? With Paraview, I can easily use opacity and colormap like I want.

What I have: You can see that I only see pixels at the edges.

What I want:

Thanks, Best regards,

I finally got it. My vti file has 2 components. So Paraview shows the magnitude. In my example, I only show the first component. This component has different values and different range.