I've been dabbling in OpenGL and DirectX for the past while, and I've noticed that all transformations are done by doing matrix by matrix and matrix by vector multiplication. I think we can all admit that especially matrix by matrix multiplication is not intuitive, and when I learned that matrix by matrix multiplication involved 64 multiplications and 48 additions, I wasn't so hard on myself for not understanding them well.
Anyway, I know that matrix and vector multiplication on modern systems is done with SIMD or SSE instructions, reducing the number of operations (or calculations), but many calculations I've seen programmers make seem unnecessary.
For example if you have a vertex you want to transform, lets just say we want to rotate 45 degrees and then translate (5, 5, 5) locally, the typical way I've seen is the following:
1: Get the identity matrix.
2: Multiply the identity matrix by the rotation matrix.
3: Multiply the resulting matrix by the translation matrix (order matters).
4: Multiply the resulting matrix by the point/vector you want to transform.
If I wanted to translate an object in a certain direction, instead of multiplying its matrix by
{ 1 0 0 translationX }
{ 0 1 0 translationY }
{ 0 0 1 translationZ }
{ 0 0 0 1 }
...couldn't I just add the translations to the appropriate matrix indices, ie., matrix[3][0] += translationX;
The difference is 3 additions instead of 64 multiplications and 48 additions.
Likewise, say I wanted to translate locally, and not in world space, say for example down an object's right vector, then I could multiply the translation vector by the upperleft part of the object's world or model matrix, getting the object's local right vector? That would only be 3x3 matrix times a vector?
So yeah, I've been thinking about this for a while, and I was just wondering if these big matrix by matrix multiplications are entirely unnecessary, at least for some things. Also, I'm aware that scaling adds some complexities, and haven't got my head around the concept of matrices that well yet.