I've been reading several sources in the web about transforming world-space points into camera-space ones. I am building my view-matrix from the following parameters
1. Camera position
2. Point the camera is looking at
3. Up vector
I perfectly understand the meaning of each of the parameters, however, there are still some doubts.
- How is the direction vector built? We have camera position and lookat position, is it camPos-lookatPos or lookatPos-camPos? In other words, does the direction vector aligns with (goes in the same direction of) the world +z-axis or is opposite to it? Direction is a bit confusing since it makes me think it goes the direction the camera lens is pointing to.
- What's the reasoning behind translating the camera to the origin? How does this simplifies math?
My view matrix looks like follows
$$V = \begin{matrix} Rx & Ry & Rz & 0 \\ Ux & Uy & Uz & 0 \\ Fx & Fy & Fz & 0 \\ -CamPosx & -CamPosy & -CamPosz & 1 \end{matrix}$$
- Will this V matrix convert from camera to world or from world to camera coordinates? How can I understand which direction it is going?
-z, maybe a row matrix vs column matrix thing again ? – v.oddou Jun 02 '16 at 06:07-zby default. In DirectX historically I've used LeftHanded systems I guess which made me reverse z. – v.oddou Jun 02 '16 at 06:09lookat - campos? – BRabbit27 Jun 02 '16 at 06:14-1in the projection matrix later on. So any image would still be right. – v.oddou Jun 02 '16 at 06:16camPos-lookatto agree with the image, that's why the projection matrix has the-1in the (2,3) entry to reverse this, right? – BRabbit27 Jun 02 '16 at 06:18