Audio and video coordinate system under study notes -OpenGL understand

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/shengpeng3344/article/details/90736223

Left-handed and right-handed coordinate system

Here Insert Picture Description
Note that in OpenGL coordinate system of the object, the world, the camera coordinate system they are all right-handed coordinate system, and standardized equipment using a left-handed coordinate system

Coordinate System

After each desired OpenGL vertex shader, we found normalized device coordinates of vertices (Normalized Device Coordinate, NDC), that is to say each of the top off the x, y, z values are between -1 and 1, beyond the range vertices are not visible
under normal circumstances, we will own a set range of coordinates, then again in the vertex shader these coordinates to device coordinates conversion table. Then these words marked the device coordinate incoming rasterizer (Rasterizer), they will be converted into two-dimensional coordinates and the pixels on the screen.
The coordinates to normalized device coordinates, then reconverted into screen coordinates division process is usually carried out, which is similar to the line that way. In the pipeline, prior to the final vertex object coordinates into screen will be transformed to a plurality of coordinate systems (Coordinate System). The advantages of the coordinates of the object coordinate system is transformed into several transition (Intermediate Coordinate System) is that in these particular systems, and some operations more convenient and easier to particular operation, it will soon become apparent, summarize important coordinate system 5

  • Local space (Local Space, otherwise known as the control object (Object Space))
  • World space (World Space)
  • Observation space (View Space, otherwise known as visuospatial (Eye Space))
  • Clip space (Clip Space)
  • Screen space (Screen Space)
    all different states is a vertex above before the final segment need to be converted to experience. In order to convert coordinates from one coordinate system to another coordinate system, we need to use several transformation matrix, the most important ones are the model (the Model), observed (View), the projection (Projection) three matrix , object starting as a local coordinate space (object space), where he called for the local coordinates, then it will become the world coordinates (World coordinate), the last in screen coordinates measured coordinate (View coordinate), cutting the coordinates (Clip coordinate), and ( end Screen Coordinate) form .
    In 3D graphics, a coordinate system used is as follows:
  • The world coordinate system
  • Object coordinate system
  • Camera coordinate system
  • Inertial coordinate system
    in the world coordinate system : the world coordinate system is a system of absolute coordinate system, all of the coordinate points on the screen before not established user coordinate system can be used to determine the respective positions at the origin of the coordinate system, the world coordinate system It is always the same.
    Object coordinate system: each object has their independent coordinate systems, when the physical movement or change direction, the object associated with the coordinate system will move or change
    the object coordinate system is based on the object itself, for example, I first you send instructions to "take a step forward," is to send commands to your object coordinate system. I do not know you will move the world coordinate system to which direction in the world coordinate system, the former may be to the north.
    Camera (camera) coordinate system : camera coordinate system is a coordinate system and the observer closely related. Similar to the camera coordinate system and the screen coordinate system, the difference lies in the camera coordinate system in the 3D space, and screen coordinate system in the 2D plane

Here Insert Picture Description
Inertial coordinate system : it refers to a world coordinate system to the "halfway" reference object coordinate system of a coordinate system. Coordinate origin and the origin of the object coordinate system coincides with the inertia, the axis inertial coordinate system is parallel to the axis of the world coordinate system.
Why should enter the inertial coordinate system ? Because the object coordinate system into the inertial coordinate system only needs to be rotated, converted from an inertial coordinate system to the world coordinate system only needs translation.
Here Insert Picture Description
Global Coordinate Transformation of
OpenGL final rendering device is a 2D image display, we need to convert the 3D scene into a final 2D form, previously used model transformation and optionally transformed converted object coordinates to the camera coordinate system, the need for projection conversion, the coordinates from the camera -> after clipping coordinate system after perspective division, conversion to the normalized device coordinates (the NDC), finally viewport transformation, transforming 3D coordinates into 2D coordinates only on the screen, into the next process shown in FIG. :
Here Insert Picture Description
in the above figure, some of us the reach, OpenGL defines only cut the coordinate system, standardization of equipment coordinates, screen coordinates, while the local coordinate system (model coordinate system), the world coordinate system and camera coordinate system are for convenience user-defined coordinate systems design, we usually do not come into contact with, OpenGL which has done a deal:
Here Insert Picture Description

  • The process includes the left in FIG model transformation, view transformation, projection transformation, these transformations may be formulated themselves as needed by the user, the content in the vertex shader completion;
  • FIG right in two steps, including a perspective division, viewport transformation , these two steps are performed automatically OpenGL, after completion of the vertex shader stage process.

The coordinate system together

Here Insert Picture Description
OpenGL performs coordinate then cut perspective division, so as to transform them into normalized coordinates. OpenGL uses a parameter in the maps glViewPort normalized device coordinates to screen coordinates, are associated with each coordinate point on a screen. This process is called a viewport transformation

Model transformation

Local coordinate system (model coordinate system) is a coordinate system in order to facilitate the establishment of the structural model, when modeling we do not care about the final position which the object is displayed on the screen.
The main purpose of the model is transformed: by transforming the vertex attributes are defined by the model or 3D modeling software configuration can be as required, by reducing, translation and other operations in the scene placed in the appropriate location . After the adoption of model transformation object is placed in a global world coordinate system, the world coordinate system is a coordinate system common to all objects interact.

Depending transformation

Depending conversion is to facilitate the observation of the object and the scene coordinate system set in the camera coordinate system is the concept of hypothetical, is introduced in order to facilitate calculations. Coordinate in the camera coordinate system, the angle of the camera is from the world coordinate system to explain the location of objects
Here Insert Picture Description
in OpenGL camera is always located at the origin, point -Z axis. -Z-axis direction to observe the right side of a cube, there are two ways:
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/shengpeng3344/article/details/90736223
Recommended