Shader "Custom/KinectShader" { Properties { _Color ("Color", Color) = (1,1,1,1) _MainTex ("Albedo (RGB)", 2D) = "white" {} _MaskTex("Mask Texture", 2D) = "white" {} _Glossiness("Smoothness", Range(0,1)) = 0.5 _Metallic ("Metallic", Range(0,1)) = 0.0 _CutRange("CutRangeHalf",Range(0,0.5)) = 0.1 _Cutoff("Alpha cutoff", Range(0,1)) = 0.5 } SubShader { Tags{ "RenderType" = "Transparent" } LOD 200 //ZWrite Off //ZTest On Cull Off Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Standard alphatest:_Cutoff #pragma multi_compile __ DEBUG // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 sampler2D _MainTex; sampler2D _MaskTex; struct Input { float2 uv_MainTex; }; half _Glossiness; half _Metallic; fixed4 _Color; float _CutRange; void surf (Input IN, inout SurfaceOutputStandard o) { // Albedo comes from a texture tinted by color float2 uv = float2(IN.uv_MainTex.x, 1 - IN.uv_MainTex.y); fixed4 c = tex2D(_MainTex, uv); fixed4 maskcol = tex2D(_MaskTex, uv); o.Albedo = c.rgb; // Metallic and smoothness come from slider variables o.Metallic = _Metallic; o.Smoothness = _Glossiness; #if DEBUG o.Alpha = 1; #else o.Alpha = maskcol.r; #endif //if (IN.uv_MainTex.x < _CutRange || IN.uv_MainTex.x> 1 - _CutRange) // o.Alpha = 0; } ENDCG } FallBack "Diffuse" }