Home » Community » Forums » OpenGL » eye and up vectors from view matrix
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 eye and up vectors from view matrix
Post New Topic  Post Reply 
how do i extract the eye and up vectors from a view matrix?

thank you!

 User Rating: 1006   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

assuming the following matrix layout:

m11 m21 m31 m41
m12 m22 m32 m42
m13 m23 m33 m43
m14 m24 m34 m44

You get the up vector from the view matrix like this:

up = (m12, m22, m32)

For the position/eye vector you need the inverse view matrix and then it's
eye = (m41, m42, m43)

 User Rating: 1366   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

mh but position != eye vector, isn't it? in my matrix class, translation is stored in m14, m24, m34. if the camera looks along the negative z-axis, then the up vector should be (0, 1, 0) and the view vector (0, 0, -1), right? with your suggestion, however, the view vector is (0, 0, 0).. any idea what's wrong?
thanks!


[Edited by - Vexator on June 15, 2008 3:06:32 PM]

 User Rating: 1006   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

No, eye = position of camera. What you talk of is the lookAt vector or the looking direction. The eye-vector (0,0,0) is the default camera position.

 User Rating: 1366   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

ok sry, so what i need then is the lookAt-vector.. how would i get that? m13, m23, m33?

[Edited by - Vexator on June 15, 2008 5:08:33 PM]

 User Rating: 1006   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Using the layout I described earlier, yes!

 User Rating: 1366   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Only problem is that most people say look-at and mean a point (position + view_direction). Getting just the direction from the matrix is simple (as above).

 User Rating: 1292   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: