Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Mobile/Diffuse" {
- Properties {
- _MainTex ("Base (RGB)", 2D) = "white" {}
- _ColorTint ("Color", Color) = (1.0, 1.0, 1.0, 1.0)
- _isBoolean ("Is alfa boolean (alfa > .5 counts as 1)", Float) = 0
- }
- SubShader {
- Tags { "RenderType"="Opaque" "RenderQueue"="Opaque"}
- LOD 150
- CGPROGRAM
- #pragma surface surf SimpleLambert fullforwardshadows
- half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) {
- half NdotL = dot (s.Normal, lightDir);
- half4 c;
- half3 zer;
- zer.rgb=0;
- c.rgb = s.Albedo * _LightColor0.rgb * (NdotL* atten);
- c.a = 1;
- return c;
- }
- sampler2D _MainTex;
- fixed4 _ColorTint;
- fixed _isBoolean;
- struct Input {
- float2 uv_MainTex;
- };
- void surf (Input IN, inout SurfaceOutput o) {
- fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
- o.Alpha = c.a;
- if(_isBoolean>0)
- {
- if(c.a>0.5)
- o.Albedo = c.rgb * _ColorTint;
- else
- o.Albedo = c.rgb;
- } else
- o.Albedo = c.rgb * lerp (fixed4(1, 1, 1, 1), _ColorTint, c.a);
- }
- ENDCG
- }
- Fallback "Mobile/VertexLit"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement