Model matrix, view matrix, projection matrix

Source: Internet
Author: User

The role of a model view projection matrix is to transform vertices from a local coordinate system into a canonical cube (Canonical view volnme). In summary, the model view projection matrix = projection matrix x view matrix X model matrix, the model matrix transforms vertices from the local coordinate system into the world coordinate system, the view matrix transforms the vertices from the world coordinate system into the view coordinate system, and the projection matrix transforms the vertices from the view coordinate system into the specification cube.

As shown in the following illustration, suppose you are now rendering triangles in three-dimensional space to the screen. In the triangle's model file, the vertex coordinates are in the local coordinate system (XL-YL-ZL), such as the initial coordinates of the three vertices of the triangle may be (1,0,0), (0,1,0), (0,0,1).

Model Matrix

The model matrix transforms the vertex coordinates under the local coordinate system into the world coordinate system. This involves the position and direction of the local coordinate system relative to the world coordinate system , or how the coordinates change when the position of the points in the space changes.

Consider three basic transformations: pan, rotate, and zoom.

The meaning of "transformation" is to map the coordinates p of the initial position of a point to the position coordinate p ' after translation, rotation, and scaling, i.e.:

⎡⎣⎢xyz⎤⎦⎥→⎡⎣⎢x′y′z′⎤⎦⎥

The translation transformation is the simplest transformation:

⎡⎣⎢x′y′z′⎤⎦⎥=⎡⎣⎢xyz⎤⎦⎥+⎡⎣⎢txtytz⎤⎦⎥

The rotation transformation is somewhat complex, looking at the rotation of the two-dimensional plane first:

It's easy to get:

x′=xcosθ−ysinθy′=xsinθ+ysinθ

The expression in matrix form is more concise:

[X′y′]=[cosθsinθ−

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.