(一)一次Drawcall 的产生都经历了哪些过程:

(二)Static Batching


(三)SRP Batching


(四) GPU Instancing


(五)GPU Instancing的介绍
(1)直接勾选 Material.enableInstancing
由unity自动排序,裁剪
(2)用Graphic.DrawInstancedIndirect( 此接口每一帧都会调用 ,但是消耗很小)
用 CommandBuffer.DrawInstancedIndirect( 用CommandBuffer,只调用一次就够用)
请注意此接口: DrawMeshInstancedIndirect,
此接口中的mesh: 不会被视锥体裁剪, 如果是Transparent类型也不会被排序
(3)相同Instanced DrawCall数量下 , DrawMeshInstanced形式的额外开销更小
(4)对于不透明物体: 建议直接使用“打勾”



以上总结了 static Batch , SRP, GpuInstancing的主要使用范围
最近飘了,好好反思!!!!!!!
本文详细探讨了Unity中Drawcall的产生过程,重点介绍了Static Batching静态批处理,SRP Batching自定义着色器管线批处理,以及GPU Instancing GPU实例化技术。GPU Instancing通过开启Material.enableInstancing或使用DrawInstancedIndirect接口实现性能提升,特别是对于不透明物体,直接启用实例化更为推荐。同时,DrawMeshInstancedIndirect接口避免了视锥体裁剪和排序,且在相同实例数量下,其额外开销较小。
1265





