最近在写草的顶点动画时,发现一个很诡异的问题,在相机上下移动的时候,草会不由自主的抖动一下,而在Scene视角,居然看的好好的.百度了一圈,没有找到合适的答案,然后看了一下UnityTerrain Grass的shader 发现他写了这么一句话 "DisableBatching" = "True" 哦 原来Unity自己的草也是禁止合批的.
那为什么官方也会禁止合批呢,查阅官方文档,得到以下内容:
DisableBatching tag
Some shaders (mostly ones that do object-space vertex deformations) do not work when Draw Call Batching is used – that’s because batching transforms all geometry into world space, so “object space” is lost.
DisableBatching
tag can be used to indicate that. There are three possible values: “True” (always disables batching for this shader), “False” (does not disable batching; this is default) and “LODFading” (disable batching when LOD fading is active; mostly used on trees).
来源:https://docs.unity3d.com/Manual/SL-SubShaderTags.html