Public Group

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

Recommended Posts

Hi I guess my question is simple but i can not find the answer How do the three matrices ( world matrix, view matrix , projection matrix ) work ? I am not talking about math here. my idea is that if i draw a triangle before using any of these three matrices and then use as a first step world matrix, will this triangle look different and how ? and by adding another matrix (view matrix), how different will be again ? i think what i am trying to know is what these matrices really do. I read what microsoft wrote but that was not enough for me to understand thanks for help

Share on other sites
The world matrix is used for moving your objects around the world. You can do without it if you either have static objects, or you constantly change the vertices of your models instead of using a world matrix (But that'd be far less efficient).
The view matrix is like a camera. It defines where the camera is looking, what lens it has, and so on.
The projection matrix is used to get perspective working, so objects further away seems smaller (Assuming you're using a perspective projection matrix).

At the very least you need a projection matrix, although you could combine both together and only set one matrix. But there's no real reason for this. It mightalso be worth noting that OpenGL doesn't have a world matrix. It uses a "modelview" matrix, which is essentially the world and view matrices combined together into one matrix.
If you were to draw a triangle without setting a view and projection matrix, you wouldn't see anything, because the graphics API has no way to translate the 3D world space coordinates into 2D screen space. If you're lucky you might see something, but it's very difficult to work out how to get things looking right.

Share on other sites
To expand a little bit:

The world matrix as was said earlier moves the object to the world coordinate sytem. What you want to do is apply an rotations to the object and then move it to its world position. The view matrix basically moves the object into the relative position of the camera. The projection matrix basically sets the view cone and converts to screen coordinates by dividing by z. I can give you a quick example.

I know you said no math, but it is easier to explain with it.

The world matrix should look like this if no rotations have been applied.
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1

What this does is add the x, y and z coordinates to 0,0,0 which is the objects local coordinates.

The camera is going to be position with a look vector, and a position vector. The look vector is used to calculate what will be rendered. So basically the camera's position is subtracted from the objects position. This allows for camera movement in the 3D world. Rotations also have to be applied in the Z, Y, X order.

Now for the projection matrix, it basically accounts for the view cone, which is normally between 60 and 90 degrees. I usually use a 60 degree. This takes and determines if the object will be seen, and shrinks and expands the object according to its position to the camera. It also converts the coordinates to screen space so it can be rendered. What is basically happening is moving the world around because there is really no actual camera in the world.

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 9
• 13
• 19
• 14
• 9
• Forum Statistics

• Total Topics
632940
• Total Posts
3009328
• Who's Online (See full list)

There are no registered users currently online

×