Still great to know the fundamentals, texture formats, tiling and other things are also really useful pieces to understand when working with 3D pipelines.
Still great to know the fundamentals, texture formats, tiling and other things are also really useful pieces to understand when working with 3D pipelines.
x' = 1*x + 0*y + 0*z
y' = 0*x + 1*y + 0*z
z' = 0*x + 0*y + 1*z
I prefer to teach 3D graphics without matrices because it's really not anything more complicated than a compact notation. Tricks like "invert and transpose to receive the normal matrix" or "take the first column to get your up vector" make no sense unless you work out the algebra of what those things mean.And don't get me started on homogeneous coordinates which are a way to put translation in a matrix by shoving a convenient "1" constant in the input vector, and the perspective matrix which does near/far, perspective transform, and a depth remap in the same matrix, and isn't easily separable because it steals the "w=1" constant for depth remap and also adjusts the "w" afterwards. Equivalent of reusing a local variable because you're short on registers :)
From a programming perspective it's much less verbose. Also the 1:1 mapping of "spaces" (camera space, world space) makes it very clean to manage transformations between them.
> and isn't easily separable because it steals the "w=1" constant for depth remap and also adjusts the "w" afterwards
I'm sure you already know this but x,y,z,w == x/w,y/w,z/w. It's easy enough to move between a 3D rep and a 4D rep of the same coordinates.
Using 4D coordinates may be somewhat awkward as they're not necessary for representations of points in 3D space but it is a very elegant solution for lighting where it is necessary to represent infinity.
[Edit]
Sorry, the point I was making is that I was also bummed to not see matrices in the article. They are a little bit to wrap you head around but they've a very elegant solution to a lot of stuff in 3D.
But without them you lose the ability to smoosh multiple transforms together, making it harder to do anything hierarchical or animated. Personally, I'd place their utility higher than "just" notational convenience.
I feel like we haven't figured out how to teach matrices, that they're inherently easy after you understand them, but we don't know how to introduce or explain them easily. Do you introduce them later & do you have any good resources for them once you do broach the subject with your students?
I like your identity example. I think I really started to "get" matrices after realizing they are literally vectors put in a stack, and that the vectors represent the state of transforming from the identity to those vectors. With that in mind, a matrix can feel much easier than a rotation involving trig functions and hand-coded dot products. You can do all kinds of rotating and other transforming without any trig once you see matrices as transforms rather than an opaque and mysterious brick of numbers. But I admit it took me years to feel that way after my first encounters with matrices.
f(x) = 2*x
and g(x) = x+5
Using basic high school algebra we can find out that: f(g(x)) = 2*x+10
and g(f(x)) = 2*x+5
This applies all the way down. The magic isn't in numbers in a square shape, it's in basic algebra. Matrix multiplication comes down to composition of multiple systems of equations like this, and if you start from that, and nothing more than the distributive property of multiplication, you can easily derive "matrix multiplication".Don't get me wrong. I use matrices in everything "production" for 3D graphics -- the compact notation is extremely convenient. I just wish we'd stop ascribing magical properties to matrices like "without them you lose the ability to smoosh multiple transforms together" because that's clearly false.
While understanding and talking 3D graphics is certainly possible without matrix notation, I really see no reason to purposefully omit it in teaching or other communication. Teaching situation is also a good place to practice standard notation.
You've given a 1-d example. If you tried to do what you're talking about with a character rig, it becomes unwieldy and unfeasible almost immediately. On top of that, the very second you try to do this in 3d with 3+ transforms, you will end up with a square of numbers, you will have derived the concept of a matrix just by trying to avoid them.
I've written lots of 3d transforms by hand using hard-coded dot products just like in your example, and I've written lots of code with matrices too. I've seen others do the same. What I haven't seen is hard-coded matrix multiplies to combine transforms. It is not practical to combine more than a single pair of transforms using manual dot products. In every practical way, you do lose the ability to smoosh transforms together if you don't use matrices. And I never said it was magical, it is simply one of the algebraic benefits of using matrices, and it is easy to understand, and easy to work out the mechanics of. That doesn't mean that it's equivalent in practice, and as it turns out, it is not equivalent in practice. There are significant practical benefits to using matrices once your needs grow past the level of complexity of a basic tutorial.
I switched universities after the first year, and subsequently I took a lot of courses in the "wrong order". I did computer graphics first and then linear algebra. That's the wrong way around as defined in the curriculum, but it was clearly the right way for me. And for most people I believe too.
When the matrices came, they were clearly a practical vessel for the practical things we needed to to in computer graphics and were getting a little unwieldly and we had an inkling there was a pattern lying underneath for.
Sometimes it is both possible and better to teach the practical hands-on craft first, to create hunger for and an appreciation of the theory, and then teach the theory.
(And then go back and blow up the "craft" ideas and go further still.)
It would have saved me a lot of headaches if quaternion based rotation representation would have been introduced to me as the default, which it is in most 3d engines.