Public Group

# matrix and Transformation and cameras Questions

This topic is 4211 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Matrix questions: 1. So when you multiply matrixes its really just adding them together? I dont get that part. 2. Is you use a matrix to display 2-d sprites positions to the screen does the z parameter have to be 0 or 1? isnt z depth? 3. Matrixes are kinda hard for me to get. so they are just an array of vectors? Transformations: 1. I guess the big words gets me confused about the topics. So transformations just transforms a matrix into another one that can have scaling rotations and other things? 2. How does combining two matrixes accomplishes this? Cameras: 1. I dont get the idea behind a camera. What is a camera? I thought its like the point of view but when you have a 2-d camera? I just dont get it lol. When i look at code for a 2-d camera its like a vector and when I run the code it just looks the same just maybe lets the whole scene move when you move instead of the player? I dont know. I guess thats it. Might seem like stupid questions. lol programming is just hard for me to get and i think im pretty intelligent. Anthony out Thanks, any responces appreciated.

##### Share on other sites
Quote:
 Original post by writtensoulsMatrix questions:1. So when you multiply matrixes its really just adding them together? I dont get that part. 2. Is you use a matrix to display 2-d sprites positions to the screen does the z parameter have to be 0 or 1? isnt z depth? 3. Matrixes are kinda hard for me to get. so they are just an array of vectors? Transformations:1. I guess the big words gets me confused about the topics. So transformations just transforms a matrix into another one that can have scaling rotations and other things?2. How does combining two matrixes accomplishes this? Cameras:1. I dont get the idea behind a camera. What is a camera? I thought its like the point of view but when you have a 2-d camera? I just dont get it lol. When i look at code for a 2-d camera its like a vector and when I run the code it just looks the same just maybe lets the whole scene move when you move instead of the player? I dont know.I guess thats it. Might seem like stupid questions. lol programming is just hard for me to get and i think im pretty intelligent.Anthony outThanks, any responces appreciated.

1) Matrix multiplication is matrix multiplication. It is often used to transform matrices and vectors.
2) It sounds to me like you're displaying your your sprites in a false 2D environment. The z coordinate generally determines height. For example, in real life the y axis might lie on a north-south line and the x axis might lie on the east-west line. In this case the z coordinate corresponds to the height above the ground. When you're using a 2D environment, you generally set the z-coordinate to 0. Any higher and you'll make the sprites closer to your camera.
3) Matrices are, well, matrices. Generally you use a 4x4 matrix in game programming in order to represent scaling, rotation, and translation. A matrix is much like a table or grid. It has cells that contain certain information.
T1) A transformation is something that changes something else. How would you scale a certain value by 3? You would multiply it by 3. y(x) = 3x in this case is a transformation of x.
T2)In games programming you use matrices to transform other matrices and vectors -- that is to manipulate them by controlling their rotation, translation, and scale by certain values that you determine. By multiplying certain matrices you can transform them. For example, if one matrix contains the information to rotate about the z axis 90 degrees and another contains the information to rotate about the z axis -30 degrees, their product will result in a matrix that rotates about the z axis 60 degrees.
C1) A camera is essentially the eye of your program. Without a camera you can't see any of the sprites or polygons that you process. Think of it like a television camera and your game like a television program. You determine where the camera is and which direction it is pointing. Your computer takes this information and transforms all of your vertices/sprites appropriately. In a false 2D environment, generally the camera is looking down the Z axis at the XY plane.

Your questions will probably be better answered by a good class in linear algebra.

##### Share on other sites
Math sucks lol. Well I guess I get the terms in its simpliest form, i just dont get them well enough to use them in actual code. The terms just makes things more confusing. Matrix and Transformations and Translations . Its hard for me to learn things if I dont understand them 100 percent. matrixes I know is 4x4 other web pages said about them representing x y z and w. Whatever w is lol. I just dont get why people times the matrixes together all the time in code. why not just add them. I dont know... as for transformations I know it changes one thing to another but using it im lost. and the cameras well... i just dont get how you can have a camera in 2-d lol. like if you turn the camera to a spot that has no images what happens. I dont know its evil and all linked together LOL. I was tring code though and kinda failed lol well Im going to keep tring

Anthony out

##### Share on other sites
Quote:
 1. So when you multiply matrixes its really just adding them together? I dont get that part.

I don't know what you mean by adding them. Matrix-matrix multiplication is the way two linear transformations are composed in matrix representation.

Quote:
 2. Is you use a matrix to display 2-d sprites positions to the screen does the z parameter have to be 0 or 1? isnt z depth?

I think it depends on the convention. In 2D one might treat z as the homogeneous coordinate.

Quote:
 3. Matrixes are kinda hard for me to get. so they are just an array of vectors?Transformations:

You can think of them as an array of vectors, or as a table of numbers.

Quote:
 1. I guess the big words gets me confused about the topics. So transformations just transforms a matrix into another one that can have scaling rotations and other things?

A matrix represents a linear transformation. The function S(x,y,z) = (ax, by, cz) is a linear transformation which scales the x-coord by a, y-coord by b, z-coord by c. You can form the matrix representation of S, call it A. Then Av (A times the vector v) is the same as applying S(x,y,z) = S(v). Again, matrix-matrix multiplication is the composition of two linear transformations.

Quote:
 I just dont get why people times the matrixes together all the time in code. why not just add them.

Because addition doesn't mean one of the following two useful things:

1) Av -- transform v by A
2) AB -- form the composition of A and B

As CrimsonSun said, get a good linear algebra book, and get a good graphics textbook.

1. 1
2. 2
3. 3
Rutin
14
4. 4
frob
12
5. 5
khawk
11

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633670
• Total Posts
3013262
×