Inverted perspective divide in VTK

Hi Andras, David, Sankhesh,

I was able to achieve the desired fluoroscopy perspective by combining several of your suggestions.

The solution I ended up with required a combination of two steps:

  1. Setting the camera position to the point exactly opposite of the focal point, as seen from the camera position (i.e. rotating the camera position around the focal point 180 degrees, with the same viewUp). This gives the desired depth inverted perspective scaling, with cells of the 3D model farther away from the original camera position appearing larger than equally-sized cells closer to the camera.
  2. Inverting the sign of both the X- and the Z-values in the camera’s projection transform by setting the Camera’s UserTransform matrix to an identity matrix, with -1 on both the X and Z:
    -1 0 0 0
    0 1 0 0
    0 0 -1 0
    0 0 0 1
    Inverting the sign of X corrects for the Left-Right flip that results from rotating the camera around the focal point.
    Inverting the sign of Z places the cells cells in the back our 3D model on the front and vice versa. This corrects for the Front-Back flip that results from rotating the camera around the focal point.

Thanks a lot for helping me out.

1 Like