OpenGL Super Treasure 5th edition &&GLSL normal transform

Source: Internet
Author: User

In GLSL, there are some situations where a vector or point in a local coordinate system needs to be converted to a viewpoint coordinate system, such as illumination calculation, which needs to be transformed into a viewpoint coordinate system . If a point p in the model is converted to a viewpoint coordinate system, the direct (Model-view matrix) *p can be, but the normals are vectors, not a point, and cannot do so. We need to use a line matrix to transform normals.

Normal matrix:

The normal matrix is usually the reversal matrix (inverse transpose) of the upper-left corner of the model viewpoint matrix (Model-view matrix) of the 3x3 matrix.

But if our Model-view matrix does not contain any non-uniform scaling (non-uniform scalings), then we can directly use the upper-left-corner 3x3 matrix of the Model-view matrix as the normal matrix to convert normal.

OpenGL Super Treasure 5th edition &&GLSL normal transform

Related Article

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.