Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's nothing magical about matrix multiplication. Smooshing multiple transforms together just comes down to taking those systems of equations and combining them. If I have one transform that scales space by 2, and another that scales translates space +5 (OK, yeah, this is an affine transform, not a linear one, but I wanted to focus on one coordinate for now), then I have:

    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.



I would quickly start drifting if I attended a class on 3D graphics and the teacher started writing everything open without matrices like that. You must admit the usefulness of a short notation when communicating ideas.

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.


I appreciate the response, but I find it rather strange, if you are really teaching 3d graphics to students. I mean, you are technically right at a pedantic level, sure, yes, you can hand-code your matrix multiplies. I didn't mean to suggest that it was impossible, and I'd appreciate some benefit of the doubt before you claim I'm making false statements. I was trying to communicate that it's not practical to do so once you start using animation or hierarchies, and despite your objections and example, I still believe that's true.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: