Linear algebra was the last math class I had in college. I did well at first when it came to basic matrix transformations and what not, but I didnt need the credit to graduate and eventually I dropped the course.
I could tell this was the one math class I might find a use for one day...curse me.
So Im trying to learn some game programming using XNA and of course, these concepts are pretty basic starting blocks here.
So, whats the best way to learn these concepts. Like, I sort of get them, but its hazy. So is there a good way to learn the basics to get a bit of a foundation? I read wikipedia and stuff but my brain is having trouble grasping them. I swear, all these tests in the world can claim Im good at math, and...I promise im not! Please help
Either pointing me to tutorials or breaking down the following concepts simply for me would help:
Transformation Matrix
Projection Matrix
View Matrix
Rotation Matrix
From what I think I understand, Projection and Rotation matrices are TYPES of transformation matrices? Rotation simply does what youd expect, rotate the matrix by a certain degree. Projection moves the matrix along a plane?
Am I sort of getting the concepts or am I way off?
I have no clue what a view matrix is.
Posts
I've never heard of a view matrix either =\
http://reference.wolfram.com/mathematica/ref/ViewMatrix.html
But apparently it's something specific to 3D graphics! So that makes me feel a bit better at least. I imagine what you'll be using are more program oriented matrices than pure algebraic matrices.
You are probably going to want to read up some tutorials about computer graphics to learn what that stuff means, perhaps something about OpenGL or DirectX to learn the basics. Some of this can get pretty low level however, and you might not need to directly work with the matrices rather than just have some understanding of how the system works so you can have it do what you want to.
It's dangerous to go alone. Take this.
Ctrl+F (or the search box on the site) to find specific things.
Thanks! Hopefully I'll be up to snuff in no time!
PatrickJMT and Khan Academy got me through college algebra with a near B after a lifetime of crippling math phobia.
I use algebra in my life all the time now. :rotate:
I don't know what a view matrix is, but it might be the relevant identity matrix so that your graphic engine can create what the image/object you're operating on looks like.
Wolfram and Khan are really what you need, and they've been linked. Just make sure you understand the first point in this post, that matrices act on objects to create transformations of the initial object (set of values). Matrices themselves do not rotate, or translate, or anything.
I do not quite understand the difference between a matrix acting on an object to create a transformation or the matrix transforming the object.
Lets say we have a rotation matrix.
We multiply that matrix by a vector and then the result is that vector, rotated by the angle specified by the matrix right?
You might want to read the wikipedia article on Rasterisation, as it provides a very basic overview of how some of this matrix math is commonly used in computer graphics.
But the basic idea is you have a series of matrices multiplied together to transform the vectors and vertices so the drawing primatives can convert your scene properly onto your output, like your monitor. So you want to draw some triangles to make some sort of object, you'll have a series of matrices to scale, translate, and/or rotate it into the proper position and shape, and multiply them together with the matrices you need to project this, potentially using perspective, to your 2D output surface.
The actual multiplying of matrices together and drawing of your primitives like triangles is handled at the low level by the graphics library and the graphics hardware, but you need to have your software call the functions to make sure that the correct matrices are built and applied in the right order so it actually draws what you want it to where you want it to.
The different matrices that you are asking about are the matrices that do the different sorts of transformations you need in order to properly construct a scene.
Still, its something id like to have a firm understanding on rather then just calling a model.rotate() function and wash my hands of it. thanks for the link, Ill check it out.
MS frameworks are solid for the most part, but it could happen.
Well, you want to have some understanding of the math so you know what is happening when you call those functions, and when your program inevitably runs into problems and bugs you have a clue what sort of things you need to do to fix it.
However, a lot of the stuff you are asking about is math specific to computer graphics and graphical applications of linear algebra rather than just being linear algebra in general, so if you want to dig deeper that is where you should focus your efforts.
Which...isnt good enough
Transformation Matrix
For your purposes right this moment, think of a vector as a point in space. Mulitplying by a transformation matrix transforms (moves) that point (or more commonly, a collection of points, i.e. a model). Transformation is a general term which covers several more specific types of matrices:
translate - move in the x, y, or z direction (think dragging a window)
scale - shrink/enlarge
rotate - rotate about the origin by a certain angle
shear - kind of like slanting. If you have a square, then slant the left and right sides in one direction, you've sheared it.
Wikepdia has a few others too if you'd like to see some others.
Projection Matrix
Either perspective or othorgraphic. Perspective if you want depth, orthographic if you don't. I don't remember how these are exactly defined and what happens when you change some of their values. That's all I ever needed to know, though.
View Matrix
Goes from world to screen coordinates. Screen coordinates usually have (0, 0) as the top left, x+ is to the right, and y+ is down. That kind of system doesn't make sense for an infinite 3D space, though. What would top left be in the world? (10, 5, -3) in the world is some point, and if your camera is looking at it (from some arbitrary position), it needs some way to figure out where on your screen to put it. The view matrix does that.
Rotation Matrix
As I mentioned above, this is a kind of transfromation matrix. It rotates by the given angle in whichever axes about the origin. So if you wanted to rotate an object in place you'd have to translate it to the origin, rotate it, then translate it back to where it was, otherwise the entire object would move in an arc when rotated.
One other thing to remember about matrices is that they can be composed (multiplied), but unlike normal multiplication, order matters.
Let me make sure i have view right:
The view matrix multiplied by a vector in a 3D world will give you that vectors position within a 2D view?
Everything else is pretty much what I originally thought. And yeah, I remembered a lot of the basic stuff from my class, like matrix multiplaction, identity matrix, what an inverse matrix was (but not how to determine one...I learned that yesterday thanks to khan ).
I think I may have a decent enough understanding of the math behind the programming concepts now, but I still am a bit lost on some of the concepts (mainly projection matrix).
http://robertokoci.com/world-view-projection-matrix-unveiled/
Im still a bit confused as to how the projection matrix works. Like I get what its purpose is now. Does it basically just scale/move the object based on its depth?
So world matrix takes the object from its own little space and tells you where it would be in the world space? Basically its coordiates and stuff. EX: A vertex may be at -1,-2 on the object space. But if the object is placed at 100,20 in the world that that vertex needs to be at 99,18.
View matrix takes the object from 3D space and tells you where it would be on a 2D view
Projection matrix then uses depth of the object to move and scale the object on the 2D plane to take depth into account.
Is this correct?
For the projection matrix, though, remember that it's a type of matrix. It can either be perspective (depth) or orthographic (no depth), or fucked up (god knows what).