关于如何使用cg中的discard/clip
Pass { ZTest Always Cull Off ZWrite Off Fog { Mode off } Blend Off CGPROGRAM #pragma vertex vert_img #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" float4 frag (v2f_img i) : COLOR { //Never render the proxy shader in scene //Just use it for shader replace clip( -1.0 );//或者discard; return float4( 1.0, 0.0, 0.0, 1.0 );//但是一定要返回一个值,否则报错 } ENDCG }