4-camera view, 360 degree panorama, how to calculate lookat for each camera
I've made a test patch, pasted here, to generate a space and navigate within that space. The space needs to be rendered on 4 cameras, each with a 90deg fov, placed orthogonally to each other on the same tripod which is locked, so they have a total of 360 degree panorama.
This is what is specified: camera position (same for all 4 cameras), lookat for one of the cameras.
Question: how do I figure out the lookat for the other three cameras?
This is the first time I've tackled this sort of thing and my naive solution is to have one camera specified a lookat (call it cam 1), and then get its rotatexyz coords, then extract the y coord and offset it by 90, 180, 270 degrees for the other cameras, and they each look at the correct spot, but only if the pitch is zero degrees.
So my question is how do I do this more generally, so that it works for any pitch (and maybe even any roll) orientation? I think maybe quaternions might be the answer but I don't really understand how to 'offset' a quaternion... ideally I'd want it so that one camera is looking forward in the direction of travel (windshield), one is looking out one side (passenger left), one out the right, and one is the receding rear view. And ideally lookat would be expressed in terms of pitch, yaw and roll wrt the cameras front pov.
Any help or advice greatly appreciated...
Jit.anim.node.
Make an empty object the parent. Connect the 4 cameras to it and set their offset rotation. Changing the parent node should move all the cameras and rotate them at the same time.
Here's a patch I've made in the past to demo this kind of camera rig setup:
One thought is that the lens_angle needs to be at 90 degrees for this to work seamlessly, which is a pretty extreme wide angle. It might be interesting to experiment with more cameras and narrower lenses.
Thanks very much Andrew and Andro-- I managed to adapt your example to my needs; starting to understand how hierarchical nodes work in jitter. I also tried an 8-cam version to reduce distortion (which helps).
One thing I noticed, if the aspect ratio of each camera is 1:1, then the lens angle is a straight arithmetical division of 360 degrees, but if the aspect ratio of each cam is something more usual, like 4x 4:3 -> 16:3, or 4x 16:9-> 64:9, then the lens angle is not predictable. For example an overall 64:9 aspect ratio, split over ten cameras gives 49.26 degrees instead of the more intuitive 36 deg...
Rotating multiple cameras is... surprisingly fun!