Advertisement
bepisXDDD

Shader

Jun 28th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1.  Shader "Mobile/Diffuse" {
  2.  Properties {
  3.      _MainTex ("Base (RGB)", 2D) = "white" {}
  4.      _ColorTint ("Color", Color) = (1.0, 1.0, 1.0, 1.0)
  5.      _isBoolean ("Is alfa boolean (alfa > .5 counts as 1)", Float) = 0
  6.  }
  7.  SubShader {
  8.      Tags { "RenderType"="Opaque" "RenderQueue"="Opaque"}
  9.      LOD 150
  10.  
  11.  CGPROGRAM
  12.  #pragma surface surf SimpleLambert fullforwardshadows
  13.    half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) {
  14.               half NdotL = dot (s.Normal, lightDir);
  15.               half4 c;
  16.               half3 zer;
  17.               zer.rgb=0;
  18.               c.rgb = s.Albedo * _LightColor0.rgb * (NdotL* atten);
  19.               c.a = 1;
  20.               return c;
  21.           }
  22.  sampler2D _MainTex;
  23.  fixed4 _ColorTint;
  24.  fixed _isBoolean;
  25.  struct Input {
  26.      float2 uv_MainTex;
  27.  };
  28.  
  29.  void surf (Input IN, inout SurfaceOutput o) {
  30.      fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
  31.      o.Alpha = c.a;
  32.      if(_isBoolean>0)
  33.      {
  34.         if(c.a>0.5)
  35.             o.Albedo = c.rgb * _ColorTint;
  36.         else
  37.             o.Albedo = c.rgb;
  38.      } else
  39.         o.Albedo = c.rgb * lerp (fixed4(1, 1, 1, 1), _ColorTint, c.a);
  40.  }
  41.  ENDCG
  42.  }
  43.  Fallback "Mobile/VertexLit"
  44.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement