Unity 的官方文档是说: Avoid alpha-testing shaders; instead use alpha-blended versions.
Alpha Testing
The fixed-function AlphaTest - or its programmable equivalent, clip()
- has different performance characteristics on different platforms:
- Generally you gain a small advantage when using it to remove totally transparent pixels on most platforms.
- However, on PowerVR GPUs found in iOS and some Android devices, alpha testing is resource-intensive. Do not try to use it for performance optimization on these platforms, as it causes the game to run slower than usual.
《RealTime rendering 》 又说: However, alpha blending requires rendering the blended polygons after the opaque ones, and in back-to-front order. In addition, fully transparent pixels are not discarded, so they use merge unit resources and memory bandwidth.
Alpha testing (conditionally discarding pixels with alpha values below a given threshold, in the merge unit or pixel shader) enables polygons to be rendered in any order, and transparent pixels are discarded
综上所述:当alpha test 能丢弃很多透明像素点的时候 或者渲染不透明再到透明会很耗的时候,才比AlphaTest优先一点,我觉得是RTR 这本书有点过时了? 有实际测过了的同学可以留言指教一下