UNITY statistic中的 SetPass和Batches
U3D文檔釋義:
SetPass:The number of rendering passes. Each pass requires Unity runtime to bind a new?shader
?which may introduce CPU overhead
Batches:“Batching” is where the engine attempts to combine the rendering of multiple objects into a chunk of memory in order to reduce CPU overhead due to resources switching.
?
引擎底層的繪制過程:
setpass(0)
settexture(0, tex)
settexture(1, tex)
setshader(shader)
?
//繪制第一個模型
fillmesh(0)
drawmesh(0)
//繪制第二個模型
fillmesh(1)
drawmesh(1)
?
setpass(1)
settexture(0, tex)
setshader(shader)
?
fillmesh(2)
drawmesh(2)
?
即是說:batches是對模型網(wǎng)格的合批,多個網(wǎng)格的合成一個,減少像模型網(wǎng)格填充到vertexbuffer中的次數(shù),因為每次填充頂點緩存時都要lock,速度慢
setpass是在繪制前設(shè)置材質(zhì)和狀態(tài),一次設(shè)置可以多次渲染。
因此,batches數(shù)量 大于等于 setpass數(shù)量
?
總結(jié)
以上是生活随笔為你收集整理的UNITY statistic中的 SetPass和Batches的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 转,数组遍历的三种方式
- 下一篇: U3D 文档 GPU INSTANCIN