当前位置:网站首页>[TA frost wolf \u may hundred people plan] Figure 3.5 early-z and z-prepass
[TA frost wolf \u may hundred people plan] Figure 3.5 early-z and z-prepass
2022-07-28 02:40:00 【zczplus】
【TA- Frost Wolf _may-《 Hundred people plan 》】 graphics 3.5 Early-Z and Z-prepass
【TA- Frost Wolf _may-《 Hundred people plan 》】 graphics 3.5 Early-Z and Z-prepass
3.5.1 Depth testing

Used to solve the occlusion problem of visible objects
You can customize the conditions of depth test
Problems caused by in-depth testing
Blocked objects will not appear on the screen, resulting in performance waste .
3.5.2 Early-Z

The depth test is introduced before the calculation of the slice shader , Eliminate unnecessary pieces .
Add
Early-Z You can also add template tests in the process of
Failure conditions
- Turn on Alpha Test or clip/discard Wait for the discard fragment operation ;
- Manually modify GPU The depth obtained by interpolation : The situation is the same 1
- Turn on Alpha Blend: Generally, objects with transparency blending turned on will turn off depth writing ,ZWrite Off
- Turn off depth test Depth Test
Efficient use of Early-Z
If the rendering order in the following figure is from far to near (3-2-1), There is no optimization effect 
Ideal situation : Sort objects from near to far, and then render
3.5.3 Z-prepass
Use two Pass:
- At the first Pass namely Z-Prepass Only the depth is written in , No color is calculated and output ;
- In the second Pass Turn off depth writing , And set the depth comparison function to equal ;
- If the test fails, no subsequent slice calculation will be carried out , Save resources ;
thus , Each object will render these two pass, Of all objects Z-Prepass As a result, a minimum depth buffer is automatically formed Z-Buffer.
The difference lies in : If it is manual sorting, it costs a lot cpu Calculation , If it is Z-Prepass Words , still GPU Calculation .
Pseudo code implementation :
The resulting problems —— Dynamic batch processing
An object has multiple pass Of shader It is impossible to perform dynamic batch processing , That is to make drawcall Double , as follows :
The way 2: Separated in advance PrePass
- The original first Pass( namely Z-Prepass) Separate out as a single Shader, And use this first Shader Put the whole scene Opaque Object rendering side .
- At this time, only the second material is left Pass, Still turn off deep writing , And set the depth comparison function to equal .

3.5.4 Z-Prepass Other questions
Z-Prepass The calculated consumption of : Through experiments, we can see that efficiency may not be improved in small scenes ;
Whether to use... Should be selected according to the actual situation Z-Prepass
By combining the two methods , Achieve the correct rendering effect .( Can render the back of hair )
Homework
preZ Test the effect of
Not written in advance Zbuffer The effect of 
By adding the following Pass, achieve preZ Purpose
// Extra pass that renders to depth buffer only
Pass {
ZWrite On
ColorMask 0
}
preZ Result display 
summary earlyZ The limitation of
- Early-Z It is a function supported by hardware , Unable to get API To make the call
- If it does Alpha Clip Or deep write , Can cause EarlyZ invalid
- Early-Z Usually by preZ To achieve , But in DrawCall Used in particularly high scenes preZ Will cause negative optimization ( A lot of sorting takes up performance )
- If it's on Alpha Test(Discard), It can lead to Early-Z invalid , Even occlusion will occur again Pixel Calculation ;
- Alpha Blend You can talk to Early-Z At the same time , Can carry out the correct Early Calculation ( Because deep writing is turned off )
边栏推荐
- 一文读懂Plato Farm的ePLATO,以及其高溢价缘由
- 1313_pyserial的安装以及文档的生成
- Canvas 从入门到劝朋友放弃(图解版)
- Understand the "next big trend" in the encryption industry - ventures Dao
- 关于Sqli-labs单引号不报错的问题
- Detailed explanation of the lock algorithm of MySQL lock series (glory Collection Edition)
- Sword finger offer special assault edition day 12
- retainface使用报错:ModuleNotFoundError: No module named 'rcnn.cython.bbox'
- Leetcode hot topic Hot 100 - > 2. Add two numbers
- Plato Farm在Elephant Swap上铸造的ePLATO是什么?
猜你喜欢

Mysql Explain 详解(荣耀典藏版)

支付宝小程序授权/获取用户信息

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(3)后台功能

ERD online 4.0.0 free private deployment scheme

Use of Day6 functions and modules

Hardware standard

Important arrangements - the follow-up live broadcast of dx12 engine development course will be held at station B

Soft test - database (2) relational model

修改MySQL密码的四种方法(适合初学者)

What is eplato cast by Plato farm on elephant swap?
随机推荐
[hcip] routing strategy, strategic routing
Design of edit memory path of edit box in Gui
regular expression
With elephant & nbsp; Eplato created by swap, analysis of the high premium behind it
Say yes, I will love you, and I will love you well
mysql: error while loading shared libraries: libtinfo.so. 5 solutions
0 dynamic programming medium leetcode873. Length of the longest Fibonacci subsequence
【ELM分类】基于核极限学习机和极限学习机实现UCI数据集分类附matlab代码
第二季度邮件安全报告:邮件攻击暴增4倍,利用知名品牌获取信任
别人发你的jar包你如何使用(如何使用别人发您的jar包)
"The faster the code is written, the slower the program runs"
MySQL high availability and master-slave synchronization
[advanced ROS] Lecture 9 robot model motion based on rviz and arbotix control
pytorch优化器设置
基于stm32的恒功率无线充电
Plato Farm在Elephant Swap上铸造的ePLATO是什么?
【HCIP】路由策略、策略路由
Mysql Explain 详解(荣耀典藏版)
What can you say to comfort your girlfriend or daughter-in-law
Compile and use Qwt in qt|vs2017