vtkCamera when does the ProjectionTransform get set ???

I have a case where I pull off all of the vtkCamera attributes and save them so as a vtkCamera can not be pass around. Later I want to replicate that view, I have all of the parameters and create a new vtkCamera. However, my view is not correct (not the same). I examined the originating and new camera and noticed that the ProjectionTransform in the new camera is the identity matrix. Whereas in the source it scaling and shear:

        0.800222 0 0 0 
        0 0.853571 0 0 
        0 0 -1.96107 -1.86603 
        0 0 0 1 

I believe this difference to be the issue. If so then how does it get set?? If this difference is not the issue how would one go about creating two views via replicating the vtkCamera attributes as one can not set this ProjectionTransform ???

Possible workaround would be to deep copy instead of trying to copy all of its parameters?

vtkNew<vtkCamera> myCamToStoreForLater;

If storing out in a file then I would ask what parameters are you storing?

Also its worth noting the projection matrix is not computed until later because it needs the aspect ratio from the window. So it can’t be standalone computed until one of it’s getters is called, which happens elsewhere internally (and may even change on window resize):

vtkCamera::GetProjectionTransformMatrix(double aspect, double nearz, double farz)

OR pass the renderer in:

vtkCamera::GetProjectionTransformMAtrix(vtkRenderer* ren)

1 Like

Thanks for these details. Especially about the projection matrix not being computed until later because it needs the aspect ratio from the window. In my case I was printing the camera details too early. Thus the identity matrix. I printed it later in the pipeline and the results are the same as the original pipeline. As such, my camera setting is correct. Unfortunately, that means there is something else. Probably a data transform that I am not accounting for.