4 ms·
Kinda of a shame they omitted matrices. They're one of the foundational bit of any 3D api and one of the few things that translates well from fixed function/sw
by vvanders 10y ago
Kinda of a shame they omitted matrices. They're one of the foundational bit of any 3D api and one of the few things that translates well from fixed function/sw raster to modern 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.
- jsharf 10y agoI think once you know this math, the jump to using matrices is pretty trivial. I can understand not wanting to include it... not that I feel strongly about either direction. I just don't think it's necessary for the scope of this super useful article.
- mxfh 10y agoAlso describing rotations in euler angles creates more problems than it solves in the long run. 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.
- Jasper_ 10y agoMatrices are just a convenient notational trick for a set of linear algebra expressions. They seem confusing until you realize that an identity matrix represents: 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 :)
- vvanders 10y agoTotally, I just think that matrices are a great abstraction around transformations. As long as certain constraints are followed you don't have to care what the previous operations are.
- Hydraulix989 10y agoYes, and you can learn them with your run-of-the-mill Metal tutorial that this tutorial was trying hard not to be.
- mbenjaminsmith 10y ago> I prefer to teach 3D graphics without matrices because it's really not anything more complicated than a compact notation. 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.
- panic 10y agoLook up projective geometry -- homogeneous coordinates are points in 3-d projective space. The defining characteristic of projective points is you can multiply all their coordinates by the same (nonzero) factor without changing the underlying point. (1 0 2 1) equals (2 0 4 2) equals (0.001 0 0.002 0.001). A cool fact about projective space is that every two distinct lines intersect in a point, including parallel lines!
- dahart 10y agoTrue, matrices are convenient for notation, and they tend to be confusing at first. A tutorial like this is better off without the detour through linear algebra. 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.