The projection matrix that transforms the observation coordinates into clipping coordinates can be in two different forms, each of which defines a different frustum. This step is automatically performed at the end of each vertex shader run.Īfter this stage, the final coordinates will be mapped into screen space (using the settings in glViewport) and transformed into fragments. In this process, we divide the x, y and z components of the position vector by the homogeneous w components of the vector Perspective division is the process of transforming 4D clipping space coordinates into 3D standardized equipment coordinates. Once all vertices are transformed into the clipping space, the final operation - perspective Division will be performed. The process of converting coordinates in a specific range to the standardized equipment coordinate system (and it is easy to be mapped to 2D observation space coordinates) is called projection, because 3D coordinates can be projected to the standardized equipment coordinate system that is easy to be mapped to 2D using the projection matrix. The viewing box created by the projection matrix is called frustum, and each coordinate appearing within the range of frustum will eventually appear on the user's screen.
The transformation from observation space to clipping space is realized by projection matrix. All coordinates outside the range will not be mapped between - 1.0 and 1.0, so they will be cropped out. The projection matrix then transforms the coordinates within this specified range into the range of standardized equipment coordinates (- 1.0, 1.0). Clip space: in order to transform vertex coordinates from observation to clipping space, we need to define a projection matrix, which specifies a range of coordinates, such as - 1000 to 1000 in each dimension.The transformation from world space to observation space is realized by view matrix. View space: the observation space is the result of converting the world space coordinates into the coordinates in front of the user's field of view.World space: the coordinates of the object will be transformed from local to world space The transformation is implemented by a model matrix.There are five different coordinate systems that are important to us: The advantage of transforming the coordinates of an object into several intermediate coordinate systems is that in these specific coordinate systems, some operations or operations are more convenient and easy, which will soon become obvious.
In the pipeline, the vertices of the object will be transformed into multiple coordinate systems before they are finally transformed into screen coordinates. The process of converting coordinates to standardized equipment coordinates and then to screen coordinates is usually carried out step by step, which is similar to the pipeline.