Sign in to follow this  
psycho_munkey

what the .. matrices .. why?

Recommended Posts

I used to make simple as 2d games with a program called "gamemaker" and you just used x,y to position objects. In D3D so far (I have just started), i have just used matrices for each of my objects, and translated them to make them move. I dont particularly like having to do this. is there a better way to position and rotate objects in 3D space?

Share this post


Link to post
Share on other sites
Umm.. sorry to break it to you, but unfortunatelly, no. That's the universally accepted standard, and the only way to avoid it is to use one of the many libraries that encapsulate the matrix operations.

The easiest way to get into the matrix bussines is to just use the provided library functions to set the "actions" that the matrices ought to perform and remember that the order of operations is important. ex:

[rotate 30 deg.] * [move (3,2,1)]

would first rotate and then move the object to the position. It's explaind in more detail in the DX SDK documentation of 3d graphics, and it would be best if you'd read up a bit on linear algebra, to properly understand the theory behind matrix math.

Hope it helped

Ciehoo

Share this post


Link to post
Share on other sites
Matrices are the only way that you have to position objects in Direct3D, you don't really have a choice about it. Though you could store rotations in quaternions and position in a simple vector and build the world matrix when needed, which is what i do. But however you store them, you will need to construct a matrix eventually. Matrices are not that bad once you get the hang of them, I would recommend getting a good book and reading up on them.

Mathematics for 3D Game Programming and Computer Graphics, 2nd Ed Is a very good book for matrices, explains them very well. There are other good books out there too, look at the math and physics gamedev book list.

Share this post


Link to post
Share on other sites
No. If you are moving up to three dimensions then you'll need to know some matrix math. IMO the best thing to do is create a class that handles world positioning with methods like Move(), MoveRelative(), Rotate(), RotateRelative() etc and hides the specifics of the implementation.

A matrix can hold all you translation, rotation and scale data in one entity and can be easily combined with other matrices or, in the case of scale and translation matrices, easily interpolated. You can use a quaternion to store your rotation data and to make rotation interpolation easy.

Check out this site for a primer on 3D math.

Also, this is my most favourite book for 3D math! A must have in anybody's collection.

Share this post


Link to post
Share on other sites
i think its best to use them as they are.

eg sometimes you only want to move so u only use tranpose, but sometimes you want to just rotate or both, or you want to rotate on the origin...or around a point,

all these require different timesing combinations of the matrices, its better to just use them how the come.

They arn't that ugly once you get a little grasp over it, you don't need to really learn the maths behind it

Share this post


Link to post
Share on other sites
When drawing to the screen, you can use untransformed coordinates (using matrices) or transformed coordinates. Transformed coordinates do not use matrices. Instead, you simply specify where on the screen you wish to draw a triangle.

That might be what you're looking for. Look 'em up.

Share this post


Link to post
Share on other sites
3d math and transformation doesn't require matrices "per se", but recall that all matrices represent are sets of linear combinations (ie. ax + by + cz + etc).

While you can go through and derive the math for transforming tuples in 3 dimensions yourself (and in fact this is how they arrived at your fancy "translation" and "rotation" matrices ;), you will arrive at exactly the same thing that 3d APIs use. Representing these sets of equations is simply more convenient in matrix form.

So just always keep in mind what matrices really are, and they will be far less confusing. They really are trying to simplify the representation and concept, not obfuscate it :)

Share this post


Link to post
Share on other sites
It is best that you take this pill and learn the 3D matrices really good. Without them you will never be comfortable programming in 3D.

Took me 1.5 year to finally understand them completely. But I kept at it. What I did wrong was that I consulted just online notes. There are lots of points that you need to take care of while learning them. Most online tutorials start with some un-mentioned assumption..such as they assume you are using left hand system, or column major matrices etc. And since one tutorial will never be complete enough, when you move to a different one, those underlying asusmptions would have changed from tutorial to tutorial.

I intend to do a concise wrteup on these pitfalls myself, but this is indeed a daunting task as there are so many factors to cover.

Meanwhile I would strngly </string> suggest that you read up Norma Lin's Linux 3D Graphics programming.

Do not be misled by its Linux title. It is as good a 3D programming book as there can be.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this