Author Topic: How to compute camera from TM matrix  (Read 12622 times)

2013-06-06, 13:02:14

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9048
  • Turning coffee to features since 2009
    • View Profile
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
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2013-06-19, 07:54:07
Reply #1

ohsnapitsjoel

  • Active Users
  • **
  • Posts: 54
    • View Profile
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?  :)


2013-06-19, 10:42:15
Reply #2

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9048
  • Turning coffee to features since 2009
    • View Profile
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
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)