So a common view matrix looks like this:
where n is a vector acting as "z" axis of camera, u as "x" axis and v as "y" axis of camera. u_x, v_x, n_x etc. are coordinates of each vector. c is a vector representing distance of camera from (0,0, 0). u*c, v*c and n*c are dot products
Does somebody know any detailed article which would explain precisely how to create such a matrice from the scratch? Or maybe could someone explain it to me here?
First my assumptions:
When applying this matrix to every object on the scene, this matrix is the first factor of multiplication and a vertex is a second one?
So for example: *
| x |
| y |
| z |
| 1 |
If my assumptions are correct then I don't understand a few things . Why 4th row of the matrix must contain a vector representing how much should I move every vertex on the screen? The 4th coordinate in any vertex is "w" right? So what meaning does it have here? I thought it's actually useless but defined only to enable adding matrices in form of multiplication. Now after such mutiplication as above I would get the following vertex transformation:
|x * u_x + y * v_x + z * n_x + 0 |
|x * u_y + y * v_y + z * n_y + 0 |
|x * u_z + y * v_z + z * n_z + 0 |
|-x * (u*c) -y * (v*c) -z * (n*c) + 1 |
And it seems as the "w" component of the vertex was moved but it doesn't make any sense to me : (.
My second issue is rotation in the view matrix so 3 first rows of the view matrix. I completely don't understand why we can put coordinates of the camera axis vectors as rotation factors.
So if anyone could lend me a hand here I would be really grateful!