现在的位置: 首页 > 综合 > 正文

关于如何使用cg中的discard/clip

2013年08月18日 ⁄ 综合 ⁄ 共 336字 ⁄ 字号 评论关闭
 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

        }

抱歉!评论已关闭.