· Appendix A 8. 3D coordinate transformation in Direct3D (
Cai Junsheng All rights reserved
)
There are a lot of objects in the game, just take CS, often seeing a lot of wooden boxes inside, how is these wooden box positions? Because these wooden boxes are the same, the same size, the same texture, but the position of the pendulum is different, to indicate this different position, it is to use the 3D coordinate space, and use the coordinates to represent the relative position of the two wooden boxes.
Coordinate transformation is the most basic knowledge in 3D games, and it is always used to transform. For example, from the coordinate space of the model to the world coordinate space, because many models create coordinate spaces in relatively created. For example, create a square, is used to represent a wooden box, its coordinate space is the left hand coordinate, but its center vertex is the origin of the left-handed coordinate system, put this wooden box in different positions, it will pan. To face the user in different directions, it is to rotate. How is these translation and rotation? In fact, learning the three-dimensional geometry knows that the matrix is used to transform. The matrix is the best tool for a 3D transformation. The matrix can save the value of the transformed, and there may be a variety of transformations that can be multiplied by a matrix. The following main introduction matrix is introduced, and how to generate a matrix of transformations such as World, View, Projection.
Matrix World Transform - Transform from the model space to World Space View Transformation - Transform from World Space to View Space Projection Transform - Transform from View Space to Projection Space