当前位置:网站首页>图形技术之管线概念
图形技术之管线概念
2022-06-24 06:43:00 【Kenight_】
Pipeline:每一步骤的输出都将作为下一步骤的输入,渲染过程在 GPU 中是并行运算的,蓝色背景部分可通过 shader 代码控制

1. Vertex Shader
顶点变换;坐标转换
2. Shape Assembly / 图元装配
将顶点转换为图元(在这里就是三角形面),并裁剪掉视野外的图元数据
3. Geometry Shader
通过增减顶点生成其他图元
4. Rasterization / 光栅化
光栅化是将一个图元转变为一个二维图像的过程,二维图像上每个点都包含了颜色、深度和纹理数据,这样的点就是片元 fragment
一个图元将转换为多个片元,并输入到 fragment shader 中
过程:4 个顶点光栅化后形成一个 10*10 像素的图形,则 fragment shader 将并行处理 100 次(Vertex shader 并行处理 4 次)
5. Fragment Shader
对片元进行纹理映射、灯光计算形成像素点
6. Test and Blend
在最后,fragment Shader 中输出的像素点还需要与 buffer 中存储的对应位置上的像素点(当前帧中渲染的其他物体)进行各种 test 与 blending 之后,形成最终显示在屏幕上的像素
Stencil Test (模板测试):
为 shader 中渲染的像素设置一个参考值 Ref ,然后与 stencil buffer 中对应像素点存储的值进行比较,通过的进行渲染否则丢弃
屏幕上每个像素点都有一个 stencil buffer 值,默认为 0,可被设置为 0 - 255
使用 Stencil test 时,通常做法是先用一个 shader 更新 buffer 值,在通过为其他 shader 设置 Ref 来与之前的 buffer 进行比较产生各种特效
Depth Test (深度测试):
默认情况下,将当前渲染像素的深度值与 Depth buffer 中对应像素点的深度值进行比较,如果比缓存中的值小,则用新的像素值替换缓存中对应像素点的值,有深度测试之后,物体的渲染顺序就不那么重要,都能按照深度值正常显示
ZWrite:开启时才写入深度值到 depth buffer 中,像素如果未写入深度值,则看起来没有远近效果
ZTest:通过 ZTest 的像素才能把深度值与颜色值写入到缓存中(在 ZTest 后,如果颜色值没写入缓存,则渲染像素在最终屏幕上将显示不出来颜色)
Blend (混合):
定义当前渲染像素与帧缓存(G buffer)中已渲染像素之间的混合方式
已渲染像素是指:当前帧中渲染的其他物体的像素,如另一片已渲染完成的草的像素
语法:Blend SrcFactor DstFactor (新渲染像素 * SrcFactor + 屏幕上已有像素 * DstFactor)
其他:
G buffer 中存储着:模板缓存(stencil buffer)、深度缓存(z / depth buffer)、颜色缓存(color / pixel buffer)等信息
参考文档:learnopengl 西川善司
边栏推荐
- L2tp/ipsec one click installation script
- Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
- [GUET-CTF2019]zips
- MySQL - three tables (student, course, score) to query the name, number and score of students whose course is mathematics
- Counter attack from outsourcing to big factories! Android has been developed for 5 years, and after a year of dormancy, it has tried to become an offer harvester. Tencent has a fixed salary of 20*15
- Dichotomous special training
- 相機標定(標定目的、原理)
- bjdctf_2020_babystack
- Étalonnage de la caméra (objectif et principe d'étalonnage)
- Spark stage and shuffle for daily data processing
猜你喜欢

Tutorial on simple use of Modbus to BACnet gateway

get_started_3dsctf_2016

捏脸师: 炙手可热的元宇宙造型师

学会使用楼宇控制系统BACnet网关没那么难

What are the dazzling skills of spot gold?

Maxcompute remote connection, uploading and downloading data files
![[WUSTCTF2020]爬](/img/b6/4a0582144c3125e7a0666bbbbfe29d.png)
[WUSTCTF2020]爬
![buuctf misc [UTCTF2020]docx](/img/e4/e160f704d6aa754e85056840e14bd2.png)
buuctf misc [UTCTF2020]docx

Dichotomous special training

与(&&)逻辑或(||),动态绑定结合三目运算
随机推荐
How to delete / select an input method on your computer
Accessing user interface settings using systemparametersinfo
Deploy L2TP in VPN (Part 2)
[vulhub shooting range]] ZABBIX SQL injection (cve-2016-10134) vulnerability recurrence
[WUSTCTF2020]alison_ likes_ jojo
捏脸师: 炙手可热的元宇宙造型师
[WordPress website] 6 Article content copy prevention
[image fusion] image fusion based on NSST and PCNN with matlab code
Reconfiguration of nebula integration testing framework based on BDD theory (Part 2)
相機標定(標定目的、原理)
Face pincher: a hot meta universe stylist
L2tp/ipsec one click installation script
Étalonnage de la caméra (objectif et principe d'étalonnage)
Shell script for MySQL real-time synchronization of binlog
get_ started_ 3dsctf_ two thousand and sixteen
Dichotomous special training
[learn FPGA programming from scratch -41]: vision chapter - Moore's era and Moore's law and the arrival of the post Moore Era
20个不容错过的ES6技巧
MySQL case: analysis of full-text indexing
[WUSTCTF2020]alison_likes_jojo