Unity 半透明粒子特效无法动态合批问题

您所在的位置:网站首页 dnf特效装备出血转换伤害吗 Unity 半透明粒子特效无法动态合批问题

Unity 半透明粒子特效无法动态合批问题

2023-08-10 13:58| 来源: 网络整理| 查看: 265

半透明粒子特效 Prefab,内含多个 ParticleSystem,复制多个后 DrawCall 增加明显,在 FrameDebugger 里发现粒子特效无法动态合批,说是材质球不同,但其实材质球明明是相同的,令人疑惑。

查阅官方文档 https://docs.unity3d.com/Manual/DrawCallBatching.html,发现下边这一段话:

Semi-transparent Shaders usually require GameObjects to be rendered in back-to-front order for transparency to work. Unity first orders GameObjects in this order, and then tries to batch them, but because the order must be strictly satisfied, this often means less batching can be achieved than with opaque GameObjects.

表述有些模糊,但判断和 RenderQueue 有关。

之后将相同材质球单独设置不同的 RenderQueue。

Prefab里有四个东西,都是ParticleSystem组件:

1、最靠前的硬币 设为 3004

2、其次的背光 设为3003

3、星星闪光 设为3002

4、最后一条竖光 设为 3001

设好后,发现合批成了4个 DrawCall ,非常舒服。(如果其他场景有共用材质球得注意一下,别乱改,层级会乱,得新建一个)

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3