Sign in to follow this  

View, World & Projection Matrices

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!

I'm struggling to understand to goal of the mentioned matrices. I only know the meaning behind the World matrix. If I get that right that looks something like this:
Every model has it's own coordinate system wich occasionally may differ from the one we use on our programs. With the WorldMatrix we can convert the model's vertices to our world position with a simple multiplication: mul(vertex.position, worldMatrix);

Now with the other two I have no idea what to do. Could someone give me a slight explanation what are they good for and why?

Thanks,
Joe

Share this post


Link to post
Share on other sites
Model (or world) matrix is used for transforming an individual node or object within the world. View matrix is for transforming the world relative to the camera view, so that the objects that are supposed to be visible as determined by the camera are transformed into the view frustum. The projection matrix is responsible for "flattening" the visible frustum and fitting it to the device coordinates of the screen.

Share this post


Link to post
Share on other sites
You can think about the view matrix the following way:
Camera is just one object in your world. I.e. it has it's own local coordinate system (0 is at camera center, Z axis is oriented in camera direction, X is usually horizontal). Let's call it camera matrix.
Now camera matrix would allow you to transform camera vertexes to world coordinate system. But you need to do the reverse - transform world vertexes to camera coordinate system (the projection to 2D image happens relative to camera, not world).
For that you use the inverse of camera matrix - what is called the view matrix.

Projection is special kind of matrix, which transforms everything in the view frustum of camera into standardized clip space. To be more precise, it is not pure matrix multiplication but multiplication followed by perspective division. As a result the view frustum of camera will be converted to unit cube (-1,-1,-1 - 1,1,1 in case of OpenGL). At that stage polygons are clipped (regions outside of cube removed) and then rasterized to 2D.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

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