What is the left-hand coordinate system (LH) and the right-hand coordinate system (RH)

Source: Internet
Author: User

Since we first came into contact with the left-hand Cartesian coordinate system of Direct 3D, we developed an inertial thinking that camera should look forward along the Z axis regardless of the coordinate system, therefore, I cannot understand why zaxis = normal (eye-at) in d3dxmatrixlookatrh ). Now we finally understand that if we set our eyes to camera, we will see the forward of the Z axis in the left-hand coordinate system, and the negative of the Z axis in the right-hand coordinate system, what we see is naturally ahead of us, and the forward direction of the Z axis points to us behind us, So zaxis = normal (eye-).
It is worth mentioning that no matter in which coordinate system, the three transformation matrices of rotation, displacement, and scaling are consistent.
In the left-hand coordinate system, the vertex is drawn clockwise from the forward direction of the triangle (the left-hand thumb is directed to itself, and the four fingers are bent ), therefore, the default value of DX's cull render state is d3dcull_ccw, which is to cut the triangles drawn counterclockwise because these triangles are carried back to camera.

Let's talk about the transformation matrix in the two coordinate systems.
World transformations are the same in two coordinate systems. As mentioned earlier, the zaxis method is different. It is worth mentioning that projection transformation. In either coordinate system, the projection transformation is the depth information (after normalization) in which zcoordinate is transformed to 0 to 1. The closer it is to 1, the larger the depth is. Therefore, no matter which coordinate system tool the 3D model was created in, the corresponding MVP transformation form is the same. For example, the coordinates of a point with a "depth" of 1 in the LH modeling system are (0, 0, 1), and the coordinates in the Rh modeling system are (0, 0, -1 ). The two points are in the same form after the transformation of the LH and rh mvp transformation matrices with the same parameters.
That is to say, if we do not consider the default transformation matrix used by Dx and OpenGL, the difference between the two APIs that use different Cartesian coordinate systems is that the default cull mode is different, and DX is CCW, openGL is CW. With this in mind, it is no longer confusing to use any API to render the model of any coordinate system.

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.