当前位置:网站首页>图形渲染管线
图形渲染管线
2022-06-26 00:24:00 【_Bruce】
图形渲染管线的几个渲染阶段:

图形渲染管线的第一个部分是顶点着色器(Vertex Shader),它把一个单独的顶点作为输入。顶点着色器主要的目的是把3D坐标转为另一种3D坐标(后面会解释),同时顶点着色器允许我们对顶点属性进行一些基本处理。
图元装配(Primitive Assembly)阶段将顶点着色器输出的所有顶点作为输入(如果是GL_POINTS,那么就是一个顶点),并所有的点装配成指定图元的形状;本节例子中是一个三角形。
图元装配阶段的输出会传递给几何着色器(Geometry Shader)。几何着色器把图元形式的一系列顶点的集合作为输入,它可以通过产生新顶点构造出新的(或是其它的)图元来生成其他形状。例子中,它生成了另一个三角形。
几何着色器的输出会被传入光栅化阶段(Rasterization Stage),这里它会把图元映射为最终屏幕上相应的像素,生成供片段着色器(Fragment Shader)使用的片段(Fragment)。在片段着色器运行之前会执行裁切(Clipping)。裁切会丢弃超出你的视图以外的所有像素,用来提升执行效率。
OpenGL中的一个片段是OpenGL渲染一个像素所需的所有数据。片段着色器的主要目的是计算一个像素的最终颜色,这也是所有OpenGL高级效果产生的地方。通常,片段着色器包含3D场景的数据(比如光照、阴影、光的颜色等等),这些数据可以被用来计算最终像素的颜色。
在所有对应颜色值确定以后,最终的对象将会被传到最后一个阶段,我们叫做Alpha测试和混合(Blending)阶段。这个阶段检测片段的对应的深度(和模板(Stencil))值(后面会讲),用它们来判断这个像素是其它物体的前面还是后面,决定是否应该丢弃。这个阶段也会检查alpha值(alpha值定义了一个物体的透明度)并对物体进行混合(Blend)。所以,即使在片段着色器中计算出来了一个像素输出的颜色,在渲染多个三角形的时候最后的像素颜色也可能完全不同。
边栏推荐
- What happens from entering a web address in the browser's input box to seeing the contents of the web page?
- Chrome浏览器开发者工具使用
- UN make (6) conditional execution of makefile
- Brief introduction to the usage of iloc in dataframe
- UN make (6) makefile的条件执行
- 关于strlen与sizeof的区别
- 清甜女孩李斯霞 受邀担任第六季完美童模全球总决赛小主持人
- wifi 的理论速度计算方法
- CS144 环境配置
- 求n的乘阶
猜你喜欢

通俗易懂C語言關鍵字static

Interpretation of script corresponding to postman assertion

Easy to understand C language keyword static

关于strlen与sizeof的区别

Abnova actn4 DNA probe solution

One stop solution EMQ for hundreds of millions of communication of Internet of things

Postman斷言對應脚本的解釋

Sweet girl lisixia was invited to be the little host of the global finals of the sixth season perfect child model

How to add a "security lock" to the mobile office of government and enterprises?

清甜女孩李斯霞 受邀担任第六季完美童模全球总决赛小主持人
随机推荐
Distributed systems (II) understanding of distributed transactions
GUN make (5) makefile中的变量
字节序问题
GUN make (7) 执行make
easyexcel读取文件
Chemical properties and application of trypsin
Dataframe to list
Sunshine boy chenhaotian was invited to be the spokesperson for the global finals of the sixth season perfect children's model
Abnova actn4 DNA probe solution
One stop solution EMQ for hundreds of millions of communication of Internet of things
反向输出一个整数
Chinese and English instructions of collagen enzyme Worthington
Command of gun make (4) rule
Redis7.0的安装步骤
A lost note for konjaku beginner
Talking about interface test (I)
Characteristics and related specificity of Papain
LeetCode 41 ~ 50
关于VS scanf出现‘scanf‘: This function or variable may be unsafe. Consider usi问题的解决方法
元气少女王钰洁 受邀担任第六季完美童模全球总决赛代言人