Understanding Transformations (understood transform)

Monday to Friday, a day, 7 am Beijing time on time updates -

If you think about it, most 3D graphics are not really 3D (with kidney Imagine all know, in fact, not true 3D image 3D) We use 3D concepts and terminology to describe what something looks like;. Then this 3D data is "squished" onto a 2D computer screen (3D we use the concepts and techniques to describe how things look, and then put Men such 3D data to the "dry" to the 2D display). we call the process of squishing 3D data down into 2D data projection (3D data we have become operational data is called 2D projection). we refer to the projection whenever we want to describe the type of transformation (orthographic or perspective) that occurs during vertex processing, but projection is only one of the types of transformations that occur in OpenGL (we mentioned here refers to a projection transformation that occurs in OpenGL vertex processing stage in) Transformations also allow you to rotate objects around;. move them about; and even stretch, shrink, and warp them (transformation allows you can rotate the same composition , Moving objects, rubbing, kneading, pinch, etc. are possible. Anyway, the object is to make them happen there would have been the fate of the scheduled operation)

Coordinate Spaces in OpenGL (coordinates in OpenGL)

A series of one or more transforms can be represented as a matrix, and multiplication by that matrix effectively moves a vector from one coordinate space to another series of operations can be expressed by a matrix (and with the vector by a matrix, the vector can also go from one space to another space). Several coordinate spaces are commonly used in OpenGL programming (OpenGL is used in many common coordinate system). Any number of geometric transformations can occur between the time you specify your vertices and the time they appear on the screen, but the most common are modeling, viewing, and projection (geometric transformation can be done prior to their display on the screen after you define vertex data, but generally relates to pass the model , viewport, projection). in this section, we examine each of the coordinate spaces commonly used in 3D computer graphics (and summarized in Table 4.1) (in this section, the main Laijiangjiang Men in 3D graphics used in several coordinate systems, listed in table 4.1 in a), and the transforms used to move vectors between them (that is to vector conversion toss back and forth between these coordinates, think also had a miserable day, why people want to hurt each other)
Understanding Transformations (understood transform)
A matrix that moves coordinates from one space to another is normally named for those spaces (a-like in terms of our matrix name on behalf of what they did, such as the vertex of the object to the viewport coordinate system from the model coordinate system the model is called the viewport matrix matrix). For example, a matrix that transforms an object's vertices from model space into view space is commonly referred to as a model-view matrix

Object Coordinates (model coordinate system)

Most of your vertex data will typically begin life in object space, which is also commonly known as model space (most droplets vertex data are defined in the model coordinate system, the coordinate system in the model, all positions are relative to the model origin of the coordinate system defined drops). in object space, positions of vertices are interpreted relative to a local origin. Consider a spaceship model. the origin of the model is probably going to be somewhere logical, such as the tip of the craft's nose , at its center of gravity, or where the pilot might sit (such as a cosmic gray ship, wide capacity, its origin in the aircraft nose children, may also be in the center of gravity, it is also possible in the pilot sitting position, then and eggs ). in a 3D modeling program, returning to the origin and zooming out sufficiently should show you the whole spaceship. the origin of a model is often the point about which you might rotate it to place it into a new orientation (3D modeling in the software, return to the origin, then zoom should let you see the spaceship Body, too ashamed of, nothing to look at other people think of the body). It would not make sense to place the origin far outside the model,

World Coordinates (world coordinate system)

The next common coordinate space is world space. This is where coordinates are stored relative to a fixed, global origin (under a coordinate system is the world coordinate system, the world coordinate system where things are relatively fixed with reference to the origin of the world coordinate system come). to continue the spaceship analogy, this could be the center of a play-field or other fixed body such as a nearby planet. Once in worldspace, all objects exist in a common frame (or in the poor spacecraft Example the origin of the world coordinate system is usually somewhere in that space to play it, such as a fixed place of what the planet). Often, this is the space in which lighting and physics calculations are performed (usually, this is local and lighting calculations for physical simulation)

View Coordinates (viewport coordinate system)

An important concept throughout this chapter is that of view coordinates, also often referred to as camera or eye coordinates (another important concept is the viewport coordinate system, or some people call it the camera eye coordinate system). View coordinates are relative to the position of the observer (hence the terms "camera" and "eye") regardless of any transformations that may occur; (the eyes are usually represented by an observer, you can imagine a viewer absolute coordinates) you can think of them as "absolute" coordinates. Thus, eye coordinates represent a virtual fixed coordinate system that is used as a common frame of reference. Figure 4.7 shows the view coordinate system from two viewpoints (Figure 4.7 from two perspective viewport coordinate system) . On the left, the view coordinates are represented as seen by the observer of the scene (that is, perpendicular to the monitor) (on the left of this show is seen by an observer of the scene). On the right,the view coordinate system is rotated slightly so you can better see the relation of the z axis (the right side of this figure, the viewport coordinate system it is slightly bit rotation, so that you can see it better in relation to the z-axis) . positive x and y are pointed right and up, respectively, from the viewer's perspective (from the perspective of the observer's point of view, x, y points to the positive direction to the right and above). positive z travels away from the origin toward the user, and negative z values ​​travel farther away from the viewpoint into the screen. the screen lies at the 0 (positive direction of the z-axis from the origin point to the observer coordinate z, z-axis negative direction from the point to the observer inside the screen, z coordinates at the screen is 0)
Understanding Transformations (understood transform)
When you draw in 3D with OpenGL, you use the Cartesian coordinate system. In the absence of any transformations, the system in use is identical to the eye coordinate system just described (when you use OpenGL painting, you are using the flute Carl coordinate system, the coordinate system can only work in the viewport coordinate system just described, in the absence of any conversion)

Clip and Normalized Device Space (trimming coordinates and NDC)

Clip space is the coordinate space in which OpenGL performs clipping(剪裁坐标系是OpenGL执行剪裁的地方). When your vertex shader writes to gl_Position, this coordinate is considered to be in clipspace(当你在vertex shader中给gl_Position赋值之后,这个坐标被认为是在剪裁空间中). This is always a four-dimensional homogenous coordinate(这个坐标永远是一个四元齐次坐标). Upon exiting clip space, all four of the vertex’s components are divided through by the w component(到离开剪裁空间的时候,所有的顶点的元素都会被w分量除). Obviously, after this, w becomes equal to 1.0. If w is not 1.0 before this division, the x, y, and z components are effectively scaled by the inverse of w(很明显,在这波操作后,w变成了1,如果w在除法操作之前不是1,则x、y、z就会被缩放). This allows for effects such as perspective foreshortening and projection(这种操作就可以产生透视、投影这样的效果). The result of the division is considered to be in normalized device coordinate space (NDC space)(这个操作结束后,坐标变到了NDC坐标系下,Normalized Device Coordinate的缩写). Clearly, if the resulting w component of a clip space coordinate is 1.0, then clip space and NDC space become identical.(很明显,如果在剪裁空间中的w分量是1.0,那么剪裁空间中的坐标和NDC空间中的坐标是一样的)

Translations of this day to get here, see you tomorrow, bye ~

Get the latest plot first time, please pay attention to the Eastern Han Dynasty academy and the heart of the public graphic No.

Han College, waiting for you to play Oh

Guess you like

Origin blog.51cto.com/battlefire/2426552
Recommended