3D rendering pipeline

Source: Internet
Author: User




Vertex shader and fragment shader are programmable pipelines.

Vertex array/buffer objects: Vertex data source. In this case, the vertex input of the rendering pipeline usually uses buffer objects.Better efficiency. In today's example, vertex array is used for simplicity;

Vertex shader:Vertex shaderOperations on vertices are implemented in a programmable manner, such as coordinate space conversion and per-vertexcolor calculation.And texture coordinates;

Primitive assembly:MetaassemblyThe vertex processed by the coloring tool is assembled as a basic element in the image Assembly stage. OpenGL ESThree basic elements are supported: points, lines, and triangles that can be rendered by OpenGL ES. Then, the assembled elements areCrop(Clip): Retain the elements completely in the cone, discard the elements completely out of the cone, crop the elements half and half are not in the cone, and then perform operations on the elements in the cone.RemoveProcessing(Cull):This process can be encoded to determine whether to remove the front, back or all.

 Rasterization: Raster. In the grating phase, the basic elements are converted to two-dimensional fragment)Fragment indicates the pixels that can be rendered to the screen. It contains location, color, texture coordinates, and other information. These values are calculated by interpolation of the vertex information of the element. These parts are then sent to the part coloring tool for processing. This is a qualitative process from vertex data to pixels that can be rendered on the display device.

Fragment shader: The bitwise colorant implements the bitwise operation in a programmable manner. In this phase, it receives fragment after raster processing., Color, depth value, template value as input.

Per-fragment operation: In this phase, a series of tests and processing are performed on each piece of the colorant player output, so as to determine the final pixel used for rendering.


Vertex transformation and illumination (T & L)


Before an object is drawn to the screen, it must calculate its illumination and convert it from the 3D world to the two-dimensional coordinate system of the screen (these two processes are called illumination and vertex transformation, that is, T & L, Transformation & Lighting ).

 

World change

 

World transformation is to convert the vertex coordinates of an object from the model space to the world space.

 

TranslationTransform

RotateTransform

 

Rotate θ around the X axis

Rotate θ around the Y axis

Rotate θ around the Z axis

ZoomTransform

Observation and Transformation

 

The camera position is taken as the reference origin, and the camera observation direction is the coordinate system. The established coordinate system is called the observation coordinate system.

 

Projection Transformation

 

A three-dimensional object is projected onto a two-dimensional surface, that is, onto the film of a virtual camera. This process is a projection transformation. The spatial coordinate system with the film center as the reference origin is called the projection coordinate system, and the coordinate of an object in the projection coordinate system is called the projection coordinate system.

 

View area Transformation


An object is expressed as a floating point coordinate in the projection coordinate system. The process of converting a floating point coordinate to a pixel coordinate is called a view area transformation by defining the display area on the screen (usually the display window size, the pixel coordinate value is called the screen coordinate. For example, if the defined community size is 640 pixels in width and 480 pixels in height, the projection coordinate (1.0f, 05.f) is converted to the Community screen coordinate (640,240). If the defined area size is 1024 pixels in width, the height is 800 pixels, and the screen coordinate after the community transformation is (1024,400 ).


Vertexshader)



Attributes: uses a vertex array to encapsulate the data of each vertex. It is generally used for variables with different vertices, such as the vertex position and color.

 Uniforms: Constant data used by the vertex coloring tool, which cannot be modified by the coloring tool. It is generally used for a single 3D composed of the same group of vertices.All vertices in an object are the same variables, such as the position of the current light source.

Samplers: This is optional, a special uniformsIndicates the texture used by the vertex shader.

Shader Program: Source code or executable file of the vertex shader, which describes the operations to be performed on the vertex.

 Varying: the varying variable is used to store the output data of the vertex coloring tool. Of course, it also stores the input data of the chip coloring tool. The varying variable will be linearly interpolated in the raster processing phase. If the vertex coloring er declares the varying variable, it must be passed to the bitwise coloring machine before it can be further passed to the next stage, therefore, the varying variables declared in the vertex coloring tool should be re-declared in the Cell Coloring tool with the same name and the same type of varying variables. OpenGL ES 2.0 also specifies that the maximum number of varying variables to be supported by all implementations cannot be less than 8.


Metaassembly


After the vertex coloring machine, the next stage of the rendering assembly line is assembly of elements, which are a ry that can be drawn using the OpenGL ES drawing command. The drawing command specifies a set of vertex attributes, describes the geometric shape and type of elements. The Vertex coloring tool uses these vertex attributes to calculate the vertex position, color, and texture coordinates, so that they can be uploaded to the sliced color coloring tool. In the metaassembly phase, the vertices processed by these pasters are assembled into an independent geometric element, such as triangles, lines, and vertices. For each element, you must determine whether it is in the visible area of the view body (a 3-dimensional space is displayed in the visible area of the screen). If the element is in the view body, you need to crop it, if the elements are all outside the view body, the elements are discarded directly. After cropping, the vertex position is converted to screen coordinates. The remove operation on the back will also be executed. It is based on the front or back of the element. If it is the back, the element is discarded. After cropping and removing the back, it enters the next stage of the rendering pipeline: raster.


GratingAnd pixel Processing


In the raster phase, elements are converted into a set of elements, which are then submitted to the color palette for processing. These sets indicate the pixels that can be drawn to the screen. As shown in:



Fragmentshader)



The chip colorant implements a general programmable method for the chip element. It operates each segment element generated during the grating phase.

Varying variables: the value of the varying variable output by the vertex coloring tool, calculated by raster interpolation, acting on each element.

Uniforms: constant data used by the Cell Coloring Tool

Samplers: A special uniforms that indicates the texture used by the color palette.

Shader program: the source code or executable file of the bitwise colorant, which describes the operations that will be performed on the bitwise I.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.