Extracting viewing direction..

2b97deded6213469bcd87b65cce5d014
0
Mihail121 102 Sep 05, 2005 at 14:20

Hi! Does anybody know how to extract the viewing direction from an arbitaty camera matrix?

Thanks you!

6 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Sep 05, 2005 at 16:10

If you are using OpenGL, the viewing direction is the negative of the 3rd row of the viewing matrix. (This is assuming your viewing transform uses only translations and rotations, not anything weird…)

2b97deded6213469bcd87b65cce5d014
0
Mihail121 102 Sep 05, 2005 at 17:46

Well the problem is i need to be able to extract viewing directions from ALL kind of viewing matrices, not only from the OGL one or from UVN one, etc. I need a way to figure a viewing vector, only looking at the camera matrix.

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Sep 05, 2005 at 21:31

This should work for any view matrix afaik.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Sep 06, 2005 at 05:12

What I meant by saying “assuming you are using OpenGL” is that it depends on the eye space convention. OpenGL uses a right-handed eye space, so the -Z axis is in front of the eye; in D3D, the eye space is left-handed, so the +Z axis is in front (and in this case you would just take the third row rather than its negative).

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Sep 06, 2005 at 05:49

The only other thing that would matter is row vs. collum major…

2b97deded6213469bcd87b65cce5d014
0
Mihail121 102 Sep 06, 2005 at 07:02

Thanks to all of you! It actually works!!! *YAY*