Vulkan

关于如何使用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

        }

posted on 2013-08-27 13:42  Vulkan  阅读(210)  评论(0编辑  收藏  举报

导航