当前位置:网站首页>Graphics rendering pipeline

Graphics rendering pipeline

2022-06-26 02:04:00 _ Bruce

Several render stages of the graphics rendering pipeline :

The first part of the graphics rendering pipeline is Vertex shader (Vertex Shader), It takes a single vertex as input . The main purpose of vertex shaders is to transform 3D The coordinates change to another 3D coordinate ( It will be explained later ), At the same time, vertex shaders allow us to do some basic processing of vertex attributes .

Primitive Assembly (Primitive Assembly) Phase takes all vertices output by the vertex shader as input ( If it is GL_POINTS, So it's a vertex ), And all the points are assembled into the shape of the specified element ; The example in this section is a triangle .

The output of the element assembly phase is passed to the geometry shader (Geometry Shader). Geometry shaders take a set of vertices in the form of primitives as input , It can construct new... By generating new vertices ( Or something else ) Elements to create other shapes . In the example , It makes another triangle .

Geometry shaders The output of the is passed into the rasterization phase (Rasterization Stage), Here it maps the primitives to the corresponding pixels on the final screen , Generate for Fragment Shader (Fragment Shader) The fragments used (Fragment). Clipping is performed before the fragment shader runs (Clipping). Clipping discards all pixels beyond your view , To improve the efficiency of execution .

OpenGL One of the clips in is OpenGL All the data needed to render a pixel .

Fragment Shader The main purpose of is to calculate the final color of a pixel , This is all OpenGL Where high-level effects come from . Usually , Fragment shaders contain 3D Scene data ( Like light 、 shadow 、 The color of light and so on ), This data can be used to calculate the final pixel color .

After all corresponding color values are determined , The final object will be passed to the last stage , We call it Alpha Testing and mixing (Blending) Stage . This stage detects the corresponding depth of the fragment ( And template (Stencil)) value ( The back can speak ), Use them to determine whether the pixel is in front of or behind other objects , Decide whether you should discard . This stage will also check alpha value (alpha Value defines the transparency of an object ) And mix the objects (Blend). therefore , Even if the color output of a pixel is calculated in the clip shader , When rendering multiple triangles, the final pixel color may also be completely different .

原网站

版权声明
本文为[_ Bruce]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260023565864.html