Getting params from the LookAt matrix

steved

Regular
Joined
Mar 28, 2003
Messages
82
Location
Regina, SK
This probably has a really simple answer.

Does anyone know how to derive paramaters from the LookAt matrix?

i.e. I want to do the inverse of this:
viewMatrix = Matrix.LookAtLH( eyePosition, targetPoint, upVector);

That is, to derive eyePosition, targetPoint, and upVector from viewMatrix.

Ideas?
 
If my logic serves me, it's non-deterministic, meaning multiple (infinite I think) Camera locations and orientations could come up with the exact same matrix. For instance if the camera is at (0,0,0) facing up in the positive Y direction (standard), the View Matrix would be the same whether the camera is pointed at (3,6,-2) or (6,12,-4) [double the first set of values]. Because of the PC Mathematics involved, you might come up with slightly different results for those matrics, but that would simply be rounding error.

Basically, if you took the line that goes through the Camera's position and the Camera's LookAt point, depending on which side the camera is on, it can be anywhere on the line and come up with the same matrix.
 
I wanted to make a quick addendum. If you know some of the indicated information you may be able to ascertain the rest through complex trigonometry.

May I ask why you are doing this? I can't seem to think of a reason to, since you usually know the information or you wouldn't have been able to create the matrix.
 
I came to the same conclusion as you, reanjr. It appears as though the LookAt matrix is generated using normalization and vector cross products, which can't be reversed.

I wanted to use it to make a cool rotation algorithm I found compatible w/ the rest of my app's standards. But it's probably not worth the trouble.

Thanks for the reply!
 
Back
Top