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.