- Home /
 
How to add alpha cutout shader to this curveworld shader
I got the curveworld shader from a youtube tutorial and it works just fine but i have a texture that needs alpha cutout when i add this shader it looks like the picture
 plss i need help. thank you in advance for helping me.
this is the shader
 Shader "Custom/Bendy diffuse - Radial"
 {
 Properties
 {
     _Color ("Main Color", Color) = (1,1,1,1)
     _MainTex ("Albedo", 2D) = "white" {}
 }
 SubShader 
 {
     Tags { "RenderType"="Opaque" }
     LOD 200
     
     CGPROGRAM
     #pragma surface surf Lambert vertex:vert addshadow
 
     uniform half3 _CurveOrigin;
     uniform fixed3 _ReferenceDirection; 
     uniform half _Curvature;
     uniform fixed3 _Scale; 
     uniform half _FlatMargin;
     uniform half _HorizonWaveFrequency;
     sampler2D _MainTex;
     fixed4 _Color;
     struct Input 
     {
         float2 uv_MainTex;
     };
     half4 Bend(half4 v)
     {
     half4 wpos = mul(unity_ObjectToWorld, v);
     half2 xzDist = (wpos.xz - _CurveOrigin.xz) / _Scale.xz;
     half dist = length(xzDist);
     half2 direction = lerp(_ReferenceDirection.xz, xzDist, min(dist, 1));
     half theta = acos(clamp(dot(normalize(direction), _ReferenceDirection.xz), -1, 1));
     dist = max(0, dist - _FlatMargin);
     //wpos.y -= dist * dist * _Curvature * cos(theta * _HorizonWaveFrequency);
     wpos.x += dist * dist * _Curvature * cos(theta * _HorizonWaveFrequency);
     wpos = mul (unity_WorldToObject, wpos);
     return wpos;
     }
     void vert (inout appdata_full v)
     {
     half4 vpos = Bend(v.vertex);
     v.vertex = vpos;
     }
     void surf (Input IN, inout SurfaceOutput o)
     {
     fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
     o.Albedo = c.rgb;
     o.Alpha = c.a; 
     }
     ENDCG
 }
 FallBack "Legacy Shaders/Diffuse"
 }
 
               
                 
                capture.png 
                (437.6 kB) 
               
 
              
               Comment
              
 
               
              Answer by Namey5 · May 21, 2017 at 05:53 AM
  Shader "Custom/Bendy diffuse - Radial"
  {
  Properties
  {
      _Color ("Main Color", Color) = (1,1,1,1)
      _MainTex ("Albedo", 2D) = "white" {}
      _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
  }
  SubShader 
  {
      Tags { "RenderType"="Opaque" }
      LOD 200
      
      CGPROGRAM
      #pragma surface surf Lambert vertex:vert alphatest:_Cutoff addshadow
  
      uniform half3 _CurveOrigin;
      uniform fixed3 _ReferenceDirection; 
      uniform half _Curvature;
      uniform fixed3 _Scale; 
      uniform half _FlatMargin;
      uniform half _HorizonWaveFrequency;
      sampler2D _MainTex;
      fixed4 _Color;
      struct Input 
      {
          float2 uv_MainTex;
      };
      half4 Bend(half4 v)
      {
      half4 wpos = mul(unity_ObjectToWorld, v);
      half2 xzDist = (wpos.xz - _CurveOrigin.xz) / _Scale.xz;
      half dist = length(xzDist);
      half2 direction = lerp(_ReferenceDirection.xz, xzDist, min(dist, 1));
      half theta = acos(clamp(dot(normalize(direction), _ReferenceDirection.xz), -1, 1));
      dist = max(0, dist - _FlatMargin);
      //wpos.y -= dist * dist * _Curvature * cos(theta * _HorizonWaveFrequency);
      wpos.x += dist * dist * _Curvature * cos(theta * _HorizonWaveFrequency);
      wpos = mul (unity_WorldToObject, wpos);
      return wpos;
      }
      void vert (inout appdata_full v)
      {
      half4 vpos = Bend(v.vertex);
      v.vertex = vpos;
      }
      void surf (Input IN, inout SurfaceOutput o)
      {
      fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
      o.Albedo = c.rgb;
      o.Alpha = c.a; 
      }
      ENDCG
  }
  FallBack "Legacy Shaders/Diffuse"
  }
 
              Your answer