I’m having issues with the vtkOpenGLGPUVolumeRayCastMapper class. What seems to work with the vtkFixedPointVolumeRaycastMapper doesn’t seem to work with the GPU variant.
To be more precise, I’m flipping the X and Y axis of the vtkCamera projection transform by setting the 0th and 5th values of the matrix to -1
Here are some screenshots of it working perfectly with the vtkFixedPointVolumeRaycastMapper:
When only flipping X or Y we can see the tips of the model, so it’s almost working but not quite.
Seemingly the signs cancel when flipping both X and Y, which makes things work again?
On a probably related note, I’m also having issues with the lighting when reversing the Z axis.
I’ve taken a look at the shader of vtkOpenGLGPUVolumeRayCastMapper but did not manage to figure out why would this happen.
What I’m doing is similar to what’s being done in this thread:
It also works for CPU volume rendering (unfortunately, ray computation seem to be implemented with some custom logic in the GPU volume renderer, so that would need some fixes).
seems to imply that it would be possible to fix, if that’s the case what would be the potential fix or lead to explore?
Yes, GPU volume rendering ray computation would need an update to allow reverse perspective rendering. This rendering mode is essential for fluoroscopy fusion applications, but not for much else, so waiting for some project to fund the development could take years. If you need it sooner then you can try to implement it yourself or give a small contract to Kitware or other developers experienced with VTK rendering to implement it for you.
Regarding the computation of rayOrigin you pointed to, by default UseDepthPass is turned off so this part of the shader is not executed from my observations (I’m outputing the compiled shader to file inside the BuildShader method, I’m not sure this is the best method but I haven’t found another solution)
Simply enabling UseDepthPass seems to break the rendering. Barely anything renders: