Unity中合批失败的原因汇总

  |   0 评论   |   0 浏览

声明

本文中的内容属于对《BatchBreakingCause》中内容的汇总及翻译,如果您认为侵犯了您的权益,请您指出,我将尽快修改。

本文内容摘自:《BatchBreakingCause》

摘要

在Unity开发中为了保证性能,降低DrawCall,会进行合批处理(静态/动态合批),但是在处理完毕后,使用Frame Debug工具查看时会看到很多合批失败的情况,本文将《BatchBreakingCause》提到的合批失败的情况进行了翻译转述。

合批失败原因

使用Frame Debug进行采样查看时,合批失败时会提示失败的原因

失败提示

各种合批失败的情况如下:

  • Additional Vertex Streams
    • 原文:the object has additional vertex streams set using MeshRenderer.additionalVertexStreams.
    • 译文:此物体通过MeshRenderer.additionalVertexStreams设定了额外的顶点信息流
  • Deferred Objects on Different Lighting Layers
    • 原文:the object is on a different light layer.
    • 译文:此物体位于另外一个不同的光照层上
  • Deferred Objects Split by Shadow Distance
    • 原文:one of the objects is within shadow distance, the other one is not.
    • 译文:对应的两物体其中一个在阴影距离范围内,另一个不在范围内
  • Different Combined Meshes
    • 原文:the object belongs to another combined static mesh.
    • 译文:此物体属于另一个已经静态合并(合批)后的网格
  • Different Custom Properties
    • 原文:the object has a different MaterialProperyBlock set.
    • 译文:此物体设定了不同的MaterialProperyBlock属性
  • Different Lights
    • 原文:the object is affected by a different forward light.
    • 译文:此物体受不同的前向渲染光照的影响
  • Different Materials
    • 原文:the object has a different material.
    • 译文:此物体使用了不同的材质
  • Different Reflection Probes
    • 原文:the object is affected by a different reflection probe.
    • 译文:此物体受不同的反射探针的影响
  • Different Shadow Caster Hash
    • 原文:the objects either have different shadow caster shaders, or have different shader properties / keywords that affect the output of the shadow caster pass.
    • 译文:此物体使用了不同的阴影投射着色器,或者设定了不同的属性/关键字,进而影响到了阴影的输出
  • Different Shadow Receiving Settings
    • 原文:the objects either have different "Receive Shadows" settings, or some objects are within the shadow distance, while some other objects are not.
    • 译文:此物体设定了不同的Receive Shadows,或者一些物体在阴影距离范围内而另外一些不在范围内
  • Different Static Batching Flags
    • 原文:the object has different static batching settings.
    • 译文:此物体设定了不同的静态合批参数
  • Dynamic Batching Disabled to Avoid Z-Fighting
    • 原文:dynamic batching is turned off in Player Settings or disabled temporarily in the current context to avoid z-fighting.
    • 译文:在Player Settings中关闭了动态合批,或者在当前的环境中为了避免深度冲突而临时关闭了合批
  • Instancing Different Geometries
    • 原文:rendering different meshes or sub-meshes with GPU instancing.
    • 译文:使用GPU instancing渲染了不同的网格或者子网格
  • Lightmapped Objects
    • 原文:the object uses a different light map or has different light map uv transformations within the same light map.
    • 译文:此物体使用了不同的光照贴图,或者虽然使用了相同的光照贴图但是UV的变换不同
  • Lightprobe Affected Objects
    • 原文:the object is affected by different light probes.
    • 译文:此物体被不同的光探针影响
  • Mixed Sided Mode Shadow Casters
    • 原文:objects have different "Cast Shadows" settings.
    • 译文:此物体的Cast Shadows设定不同
  • Multipass
    • 原文:the object is using a multi-pass shader.
    • 译文:此物体使用了多通道的着色器
  • Multiple Forward Lights
    • 原文:the object is affected by multiple forward lights.
    • 译文:此物体受多个前向光的影响
  • Non-instanceable Property Set
    • 原文:non-instanced properties are set for an instanced shader.
    • 译文:为instanced着色器设定了non-instanced的属性
  • Odd Negative Scaling
    • 原文:the object has odd negative scaling (e.g. (1, -1, 1)).
    • 译文:此物化的缩放值使用了负数
  • Shader Disables Batching
    • 原文:the shader explicitly disables batching with the "DisableBatching" tag.
    • 译文:着色器使用DisableBatching标签显示关闭了批处理
  • Too Many Indices in Dynamic Batch
    • 原文:there are too many indices (more than 32k) in a dynamic batch.
    • 译文:动态合批时索引过多(超过了32K)
  • Too Many Indices in Static Batch
    • 原文:there are too many indices in the combined mesh of a static batch. The limit is 48k indices on OpenGL ES, 32k on OSX and 64k on other platforms.
    • 译文:静态批处理中合并的网格索引过多。对于Opengl ES来说上限是48K,OSX是32K,其它平台是64K
  • Too Many Vertex Attributes for Dynamic Batching
    • 原文:a submesh we are trying to dynamically batch has more than 900 vertex attributes.
    • 译文:动态合批时顶点的属性过多,超过了900个
  • Too Many Vertices for Dynamic Batching
    • 原文:a submesh we are trying to dynamically batch has more than 300 vertices.
    • 译文:动态合批时顶点的数量过多,超过了300个

标题:Unity中合批失败的原因汇总
作者:liyubin
地址:http://www.liyubin.com/articles/2020/12/09/1607508135662.html