Jump to content
  • Advertisement
Sign in to follow this  
jozsef.horvath

View, World & Projection Matrices

This topic is 2279 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!