This page is designed to help those people who either want to write
a 3D game on their own or want to extend TuxFleet.
This page will summarizes some of the things and problems I learned about 3D math and rotation of objects in 3D space while programming TuxFleet.
When I started the TuxFleet project December 1999, I was a student
of computer-science after my pre-diploma, so this should mean that I am
good in maths (cause I didn't fail), but actually I'm rather bad. Maybe
even worse.
I had no experience with 3D or OpenGL before, or did ever use a matrix
to rotate an object.
When I first discovered plib as an open scene graph, I hoped that the routines in there whould be so easy, that I wouldn't have to think for myself and that the routines would just fall out of the sky - but plib wasn't _that_ easy.
The first mistake I made, was to use euler angles to describe the rotation
of the spaceships.
This completely went wrong, and I used up a lot of time in trying and
trying.
Then I went to the university library to lend out books about Linear Algebra, Vector Analysis and stuff, and it helped me a little bit further.
The one thing I didn't find in all those books was the easy answer to the following question:
And then I stumbled over the following web pages, part of 'The Omniverous Biped OpenGL FAQs', created by Steve Baker, author of plib and Tux:
First of all - Dear Steve Baker, I'd like to kick your butt.If those web pages would have been on the same site as plib or Tux or if you would ship them with plib itself, it would have saved me a lot of time and energy - grrrr!
But after I've kicked your butt, I'd really like to bow my head and
fall down on my knees before Steve, because I think he is a genius - this
simple web page "Matrices can be your friends" was easy to understand and
explained my above understanding problem totally.
This web page, made by a non-professional [1] could do what all those
math-books by Schaum & Co couldn't do
- thanks, Steve!
This proves a suspicion I have - that there are only good and bad teachers,
but not good or bad students.
[1] Steve Baker is a professional - although his explantaion
of matrices was so easy, I was assuming the wrong things
He wrote me this:
* On the math help page you say I'm an amateur - that's not
the case - I've been working as a professional 3D programmer
for 20 years. I've designed PC graphics cards - I've written
commercial games software - SSG is my third or fourth
scene graph API...I forgetand:
Actually - neither being kissed all day long nor having my ass
kicked sound all *that* attractive. :-)Mailing me requests written on the back of $100 bills gets my
attention though ;-)On the "math_help" page - where you are heaping praise on my
FAQ page and running me into the ground for my web-organizational
skills, you describe me as a "non-professional" - that's not too
accurate. I write flight sim graphics for a living.Also, after all you said about the FAQ page, you didn't provide a
link to it!The "matrices can be your friend" document is an example one of
those documents you either love or hate. Several mathematicians have
come close to death threats over it. Offers of 24hr kissings are
also not as uncommon as you might expect. :-)I came across that explanation for how a matrix works completely
by accident. When I was just starting out doing 3D, I was
blinded by the inscrutability of matrices - so I decided to try
to invent a new way to do 3D transforms. I wanted to think about
what happened to the unit cube - and then use extrapolation to
figure out what happened to the rest of the model. So, I wrote
down the coordinates that the unit cube would move to - and
then said "well, a point at (10,12,14) will end up ten times
further than where the X axis of the cube went, 12 times where
the Y axis went and 14 times where the Z axis was."That trick worked *perfectly* - and so - being very proud of
having discovered this brand new way to do rotation/translation/shear,
I showed my supervisor...who pointed out that the math in my
final result was in fact identical to matrix math! Sheepishly,
I went back to my desk - realising that I had not stumbled on
some great new mechanism that would revolutionise 3D rendering.Working back carefully, I realised that by writing down the
final position of the unit cube - I was just writing down the
rows of the damned matrix that I hated so much. At that point,
a bolt of lightning flashed from the heavens - angels sang, etc, etc.I *grokked* matrices by re-inventing them from the ground up.
"grok" is a good word here. It means more than "understand" - it
means that you have 'internalized' not just the bare facts - but
all the reasons *why* it works, *how* it works, etc.Once you have that little unit cube dancing around in your head,
you can never again forget how matrix math implements 3D transformations.If only math teachers could figure out the importance of teaching
*some* students that way.Other people on the other hand, prefer the raw math - and proof in
a symbolic manner - they don't need to visualise what's going on...
and they *HATE* my explanation.