Jump to content
  • Advertisement
Sign in to follow this  
ajit_kamat

Camera (View) Matrix - Help.

This topic is 4846 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

Hi, I am having hard time understanding the camera (view) matrix: Ux Vx Nx 0 Uy Vy Ny 0 Uz Vz Nz 0 -E.U -E.V -E.Z 1 How is this matrix constructed? Why are there dot products in the translation section of this matrix? How is rotation and translation actually achieved by this matrix? Cheers, ~Ajit

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I am having hard time understanding the camera (view) matrix:

Ux Vx Nx 0
Uy Vy Ny 0
Uz Vz Nz 0
-E.U -E.V -E.Z 1

How is this matrix constructed?
Why are there dot products in the translation section of this matrix?
How is rotation and translation actually achieved by this matrix?
I'm not sure what the 'E' stands for, but let's call it 'T' for translation. Also I think entry 43 is supposed to be T.N rather than T.Z?

The standard 'forward' version of this matrix might look like this:

Ux Uy Uz 0
Vx Vy Vz 0
Nx Ny Nz 0
Tx Ty Tz 1

The upper-left 3x3 portion is a rotation matrix; U, V, and N are the direction vectors of the camera. The matrix overall is the product of the matrix multiplication:

M = R*T

Where R is the rotation portion and T is the translation portion. This matrix has the effect of rotating a vector by R, and then translating it by T. For a view matrix, we need the inverse of M. Applying some matrix properties we get:

M-1 = (R*T)-1 = T-1*R-1

R-1 is simply transpose(R), and T-1 is simply T with the translation vector negated. Work through the multiplication and you'll see that it results in the matrix you posted. The effect of this matrix is to translate by -T, and then rotate by transpose(R). In other words it is the opposite of the 'forward' camera transform, and has the effect of transforming objects in world space into local camera space.

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!