General Category > Corona Standalone

How to compute camera from TM matrix

(1/1)

Ondra:
Suppose you only have the camera transformation matrix and want to compute camera parameters from it. The easiest way to do this is to just transform these points with the inverse of the camera TM:
a: 0, 0, 0
b: 0, 0, -1
c: 0, 1, -1
Camera origin is then A, camera target is B, and camera roll is (C-A) normalized. This makes sense if you realize that the camera transformation matrix does nothing else than transforming points from world space to a space where camera origin is at 0 0 0, view direction is in the negative z axis, and "up" is in the y axis. It is possible that your 3D application uses another convention, then just modify the three input points.

If your camera does not provide FOV information, then again just compute point D projected into (0, 0) image point and point E projected into (0, width/2), and do acos(dot(norm(D-A), norm(E-A))), where A is the projected 0, 0, 0 point

ohsnapitsjoel:
Man, I wish I understood all this but I don't think I'm smart enough!  Could you by chance dumb it down a shade for me?  :)

Ondra:
just ignore the explanation and transform the three points with the inverse of camera matrix ;). Or contact me on skype, my id is ondra.karlik

Navigation

[0] Message Index

Go to full version