Draw call batching 绘制调用(DC)合批 性能系列2

本文详细介绍了Unity中的两种合批技术——动态合批和静态合批,以优化绘制调用(DC)并提升性能。动态合批适用于移动游戏对象,而静态合批适合静态对象且能节省更多CPU资源,但会增加内存开销。合批的关键在于共享材质,同时,文章也提醒注意合批的限制和注意事项,如顶点数量、Shader类型等。
摘要由CSDN通过智能技术生成

Draw call batching 绘制调用(DC)合批

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.3版本
参考链接:https://docs.unity3d.com/Manual/DrawCallBatching.html

To draw a GameObject on the screen, the engine has to issue a draw call to the graphics API (such as OpenGL or Direct3D). Draw calls are often resource-intensive, with the graphics API doing significant work for every draw call, causing performance overhead on the CPU side. This is mostly caused by the state changes done between the draw calls (such as switching to a different Material), which causes resource-intensive validation and translation steps in the graphics driver.
在屏幕上绘制GameObject,引擎必须对图形API(如OpenGL或Direct3D)发出DC。DC通常是资源密集型的,图形API为每次绘制调用做大量工作,导致CPU方面的性能开销。这主要是由于DC之间所做的状态更改(例如切换到不同的材质)造成的,这会导致图形驱动程序中的资源密集型验证和转换工作。

Unity uses two techniques to address this:
Unity使用了两个技术来解决这个问题:

  • Dynamic batching: for small enough Meshes, this transforms their vertices on the CPU, groups many similar vertices together, and draws them all in one go.
    动态合批:对于足够小的网格,把CPU上相似的顶点转移到一起,并一次性将它们全部绘制出来。

  • Static batching: combines static (not moving) GameObjects into big Meshes, and renders them in a faster way.
    静态合批:将静态(不移动)游戏对象组合成大的网格,并以更快的方式渲染它们。

Built-in batching has several benefits compared to manually merging GameObjects together; most notably, GameObjects can still be culled individually. However, it also has some downsides; static batching incurs memory and storage overhead, and dynamic batching incurs some CPU overhead.
与手动合并游戏对象相比,内置合批有很多好处;最值得注意的是,游戏对象仍然可以单独剔除。然而,它也有一些缺点;静态合批会导致内存和存储开销,而动态合批会导致一些CPU开销。

Note: Dynamic batching is not compatible with graphics jobs (see Player Settings). If graphics jobs are enabled, dynamic batching are disabled in Standalone builds.
注意:动态合批与graphics jobs不兼容(参见Player设置)。如果启用了graphics jobs,则在Standalone构建中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值