4 ms·
What you describe is very standard in 3D graphics, and it's alluded to in the article by the question at the end. You can even use the last row of the matrix as
by shezi 6y ago
What you describe is very standard in 3D graphics, and it's alluded to in the article by the question at the end. You can even use the last row of the matrix as scaling factors (you'll have to re-normalize the output vector).
From a mathematical standpoint, this is now a projective vector space.
Some references:
https://en.wikipedia.org/wiki/Transformation_matrix https://en.wikipedia.org/wiki/Transformation_matrix
https://www.quora.com/Why-does-OpenGL-use-4D-matrices-for-everything https://www.quora.com/Why-does-OpenGL-use-4D-matrices-for-ev...
https://guide.handmadehero.org/code/day362/ https://guide.handmadehero.org/code/day362/
- sannee 6y agoNote that projective spaces are not vector spaces. There is no meaningful way of adding vectors nor multiplying by a scalar. Meaning we have to be very careful about treating our projective transformations as linear maps, as they are, in fact, nothing like that. Of course people doing graphics often pick a section of the projective space ("last component is 1"), then map that onto R^3 and off they go, sort of ignoring the "planes at infinity" and praying for the best. This is messy but I do not see a better way.
- jpeloquin 6y agoYour wikipedia link reminds me that I should have listed rotation, scaling, shear, and reflection transformations. Oops. In your second link, I like the trick of storing positions as [x, y, z, 1] and directions as [vx, vy, vz, 0]. Regarding, "Hey, Markus! How come this matrix is 4x4?", I'm not sure if Markus was referring to an affine transformation, part of a perspective projection, a matrix representation of a quaternion, or something else. The mere fact a matrix is 4x4 (or some other size) unfortunately doesn't say much about what it's meant to do. Which probably contributes to Markus getting so many questions.