in principle I'd calculate the normal the camera is pointing to behind the scenes in flat space and then do a coordinate transformation to spherical polar coordinates. The thing is, when you set up the transformation matrix J(phi, theta) (and you know phi and theta from the normal you just calculated in your last post), you simply multiply the camera normal with J and get the vector in spherical coordinates. Then, after that, you have to extract pan, tilt and roll from this vector. The transformation (pan, tilt, roll) <--> (nx, ny, nz) can be found everywhere and since it is in flat space I guess you even know how to do it.

for the coordinate transformation jacobian - see here:
http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations
take the inverse of the "To Cartesian coordinates-From spherical coordinates" thingy.

Last edited by Joey; 06/05/11 16:32.