If I understood correctly this is the process of rendering an object:
- Array of 4d vector defining points 3d points(with the fourth component 1) representing object's vertices in object/local space:
{1, 1.21, 2.12}
{1, 1.21, 2.12}
{1, 1.21, 2.12}
{1, 1.21, 2.12}
- Constructing a translation matrix(where x, y, z are the new position on each axis):
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1
Constructing a rotation matrix(here I didn't yet understand how quaternions and rotation work , what I know is that there is a rotation matrix where you fill with the sine and cosine of the angles on each axis)
Construction a scaling matrix(x, y, z scaling amount on axis)
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
Multiplying all tree to obtain the Model/Object Matrix
The view/camera matrix(which handles the position of the scene observer, feed the location of the observer, the direction it is looking and the global up direction in the right places and this will move the scene acorrdingly):
Projection matrix(Handles the aspect ratio, clipping planes, fov)
Multiplying Model with View with Projection matrices. And multiplying the Final matrix with the vertices position.
On each vertex, divide the x, y, z components by their w to project the 3d scene in a 2d screen(obtaining vertices in NDC space ranging from -1, to 1).
Remap the NDC values to match the screen coordinates by doing a simple calculus.
GPU interpolates the pixels positions in screen coordinates and fills them with color accordingly.
In DirectX and OpenGL I know that the matrices are computed in the CPU and sent to GPU in the vertex shader as vertexPOS * MVP(Model * View * Projection). And the GPU handles the perspective w division and the remapping to screen coordinates and interpolating pixels. But why doing the initial multiplication in the CPU if we can just send the parameters to the GPU(translation, rotation, scaling, eye position, eye direction, up, fov, aspect ratio, near/far clipping plane) and the GPU handles the matrix magic behind the scenes. Wouldn't GPU make those matrix multiplication faster than CPU?