I have observed a strange behavior of VTK.
Same program run on computer with GPU is much slower than computer only have CPU.
applied:
volume_mapper = vtk.vtkGPUVolumeRayCastMapper()
On computer1(only have CPU) : takes 1 second to finish rendering
On computer2 (Nvidia GPU1080): takes 10 seconds to finish rendering
If your GPU does not have enough memory to store your entire data set in its dedicated memory then vtkGPUVolumeRaycastMapper will be probably slower than vtkFixedPointVolumeRayCastMapper.
The question is, even I run the rendering on a multi-GPU machine which has 32G memory, the speed is same (very low). And the data is not big (512512120 bytes) at all.
One strange thing is when the rendering is running:
On computer1(only have CPU) : memory monitoring showing memory usage increased by 800M
On computer2 (Nvidia GPU1080): memory monitoring showing memory usage almost no change
What could be the reason? Seems the GPU memory is not used by the rendering at all.
Volume rendering of a 512 x 512 x 120 volume on an NVidia GeForce 1080 using vtkGPUVolumeRaycastMapper should not take 10sec, but approximately 0.01sec. Maybe something is wrong with the graphics driver or some system configuration. What operating system do you use? Does volume rendering in 3D Slicer work well in 3D Slicer? What is the scalar type of the volume (short, float, double…)?
vtkFixedPointVolumeRaycastMapper precomputes gradients and space leap volume, while vtkGPUVolumeRaycastMapper computes these on-the-fly. So, it is normal that the CPU mapper uses more memory. 800MB seems too much, though. If send a link to your source code then we can have a quick glance to see if there is anything suspicious.
The overall appearance is mainly determined by the transfer functions and lighting. You can decrease the sampling distances and increase the render window size to show finer details.