当前位置:网站首页>Opengl rendering pipeline
Opengl rendering pipeline
2022-07-24 20:23:00 【thefist11】
1. Basic knowledge of

1.1 Vertex data (Vertex Data)
Vertex data is a set of vertices . A vertex (Vertex) It's a 3D A collection of coordinate data . Vertex data uses vertex attributes (Vertex Attribute) It means , It can contain any data we want to use .
Suppose each vertex consists of only one 3D Location ( Translation notes 1) And some color values .
eg.
float vertices[] = {
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f
};
1.2 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, you can do some basic processing for vertex attributes .
It will be GPU Create memory on to store our vertex data , To configure OpenGL How to explain these memory , And specify how it is sent to the graphics card . The vertex shader then processes the number of vertices we specify in memory .
1.2 Primitive Assembly (Primitive Assembly)
Any call of drawing instruction will pass the primitive to OpenGL.eg. GL_POINTS、GL_TRIANGLES、GL_LINE_STRIP.
Take 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 .
1.3 Geometry shaders (Geometry Shader)
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 .
1.4 Grating stage (Rasterization Stage)
The output of the geometry shader will be passed in , Here it maps the primitives to the corresponding pixels on the final screen , Generate for fragment shaders (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 .
1.5 Fragment Shader
The main purpose 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 .
Alpha Testing and mixing (Blending) Stage
After all corresponding color values are determined , The final object will be passed to the last stage , The corresponding depth of the detection segment at this stage ( 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 .
边栏推荐
- [mathematical modeling / mathematical programming model]
- clip:learning transferable visual models from natural language supervision
- Xiaomi 12s ultra products are so powerful, but foreigners can't buy Lei Jun: first concentrate on the Chinese market
- Safe way -- Analysis of single pipe reverse connection back door
- [training Day9] light tank [dynamic planning]
- Processing of null value of Oracle notes
- Synthesis of peptide nucleic acid PNA labeled with heptachydrin dye cy7 cy7-pna
- [training Day10] linear [mathematics] [thinking]
- API data interface for historical data of A-share index
- (posted) differences and connections between beanfactory and factorybean
猜你喜欢
![[training Day10] silly [simulation] [greed]](/img/31/94c32e05b498f8ad192f8ec2c500ca.png)
[training Day10] silly [simulation] [greed]

TCP sliding window, singleton mode (lazy and hungry) double checked locking / double checked locking (DCL)
![[training Day6] triangle [mathematics] [violence]](/img/57/d603886c202de7d46ea03487b633f5.png)
[training Day6] triangle [mathematics] [violence]

Azide labeled PNA peptide nucleic acid | methylene blue labeled PNA peptide nucleic acid | tyrosine modified PNA | Tyr PNA Qiyue Bio
![[training Day10] linear [mathematics] [thinking]](/img/bf/0082dbe88c579bbb7adc014c60a0be.png)
[training Day10] linear [mathematics] [thinking]

Rhodamine B labeled PNA | rhodamine b-pna | biotin modified PNA | biotin modified PNA | specification information

(posted) differences and connections between beanfactory and factorybean

How does starknet change the L2 landscape?

Todolist case

"Hualiu is the top stream"? Share your idea of yyds
随机推荐
A circle is displayed and can be moved
Storage category
Are network security and data security indistinguishable? Why is data security important?
Mass modify attribute values in objects in JS
[trial experience of Yuxin micro Wiota ad hoc network protocol development kit] RT thread BSP Software package production
MySQL advanced
Safe way -- Analysis of single pipe reverse connection back door
[shader realizes the flicker effect of three primary colors of television signal _shader effect Chapter 5]
2019 Hangzhou Electric Multi School Game 7 6651 final exam [Law + thinking]
Unity's ugui text component hard row display (improved)
MySQL stored procedure
Is the incremental update of SQL Server database identified according to the where clause? Can't do stream update? Each table should
Microservice architecture | service monitoring and isolation - [sentinel] TBC
Apache atlas version 2.2 installation
Istio一之Envoy工作原理
Usage and introduction of MySQL binlog
Introduction to fastdfs high availability
Methods of using tyrosine modified peptide nucleic acid PNA | Tyr PNA | BZ Tyr PNA | 99Tcm survivinmrna antisense peptide nucleic acid
From code farmer to great musician, you only need these music processing tools
Markdown to PDF API data interface