When rotating the camera around a scene with
vtkInteractorStyleTrackballCamera, there is a unsatisfying swinging effect that I would like to avoid. I mainly want to know if you agree with the solution before starting to implement it.
I can start a VTK view with a camera standing horizontally, having an up vector toward the Z axis :
When I start to drag mouse on the left or right, the camera is rotating around the focal point as expected, but also has its up vector oscillating a little on the right then left like the mast of a boat on the sea.
Despite one can continue rotating to get back to a fully horizontal view, I want to avoid this :
Another 3D framework - Jzy3D - does not have this behaviour with its camera mouse controller
The axis always look horizontal whatever the camera rotations.
My understanding is that this VTK behaviour could be due to the recomputation of the camera up vector when rotating, which is the only difference I found with Jzy3D camera rotation (limited to azimuth and elevation increments).
I presume that in VTK, the up vector is updated to allow complete rotation around the object and allow an up-side-down camera (?). In Jzy3D, the up vector is always kept to (0,0,1) (toward increading Z), as elevation increment can not go above the top or bottom position (looking to the ground from the sky or vice versa). OpenGL has always been fine with this, even if a top position may deserve more relevant up vectors like (1, 0, 0) or (0, 1, 0).
I’d like to get your opinion on the appropriate improvements to get a stable camera
- Add a
OrthogonalyzeCameraUpVectorsetting to allow disabling the recomputation of the up vector.
- Add a hook to let the user program this.
I would choose the first solution mainly because I work with Python and Java and that I can not easily override vtk classes from Python or Java (if you know way, please tell me!).
I however fear that this may let the camera in an inconsistent setting and that would not allow such a contribution to be merged in VTK. Not having my solution merged in VTK would require to keep my own build of VTK which I would like to avoid.
What would you suggest?