Jump to content
  • Advertisement
Sign in to follow this  

Camera Coordinate System

This topic is 4353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey i'm working on the topic of Camera Coordinate System. here are the lecture notes i'm following (pages 13-16) basically it says that i can deduce Vx, Vy, Vz based on a matrix M that i should compute.
M = 
( Cy    0   Sy   )
( -SxSy Cx  SxCy )
( -CxSy -Sx CxCy )


Vx = ( Cy    0   Sy   )
Vy = ( -SxSy Cx  SxCy )
Vz = ( -CxSy -Sx CxCy )

where Cx = cos(x), Sx = sin(x)

however i dont understand somthing - Cx and Sx (and Cy etc) are functions R -> R that take some x or y, so i'm getting a matrix M which is also a function of (x,y) - but what are these x and y? in other words, lets take two points in space - COP (that is my eye) and POI (that is where i'm looking at), how do you compute M based on these? thanks

Share this post

Link to post
Share on other sites
Well, cos and sin are trigonometric functions. Their argument is an angle. The matrix has the typical structure of a composite of 2 rotation matrices in 3D. Hence your x and y are rotation angles. From the matrix structure I assume them being Euler angles. I'm too lazy to check the order of the terms, but the nomenclature suggests x being the angle to rotate around the principal x axis, and y the angle around the principal y axis (IMHO the names x and y are not well chosen for this).

Computing the rotation matrix for a "look at" function can be done directly using Euler angles. For this purpose you have to compute the both angles to rotate the standard "look to" vector (e.g. [0,0,1]) into the direction of POI - COP. Simple trigonometrics and some case distinctions are suitable for this.

For another way (the way normally used for this purpose) you have to know that a rotation matrix is what a "ortho-normal basis" is named in math. Umpf, what's that? Well, an orientation in 3D space has 3 degrees of freedom (DOF), but the corresponding matrix has 9 values. So there is the need to have 6 constraints, so that 9-6==3 DOF's will actually remain. These constraints are: Each particular vector of the matrix (in your snippet these are Vx, Vy, Vz) are to be of unit length; these are 3 conditions. Unit length vectors are also called "normalized". Next the 3 vectors need to be pairwise perpendicular or orthogonal; these are the other 3 conditions. Together they are meant to be "ortho-normal". You can simply check these conditions on your matrix M, considering that sin2(a)+cos2(a)==1. A basis, to complete the meandering, is a kind of co-ordinate system for directions.

However, you have to pick which vectors of Vx, Vy, and Vz are the "look to", "up", and "side" vector. The "look to" (e.g. Vz) is then obviously given to (remember that the vectors of M have to be of unit length):
Vz := ( POI - COP ) / || POI - COP ||
Given this, and using the aforementioned constraints, the other vectors can be computed from cross-products and normalization.

Please ask if interested in more details of the one or other method.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!