Last active
August 29, 2015 14:25
-
-
Save yasuakiohama/cf920bb6e23d03dd57c8 to your computer and use it in GitHub Desktop.
Example-Diffuse ShadowColor.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Example/Diffuse ShadowColor" { | |
Properties { | |
_MainTex ("Texture", 2D) = "white" {} | |
_ShadowColor ("ShadowColor", Color) = (0,0,1,1) | |
} | |
SubShader { | |
Tags { "RenderType" = "Opaque" } | |
CGPROGRAM | |
#pragma surface surf SimpleLambert | |
half4 _ShadowColor; | |
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) { | |
half NdotL = dot (s.Normal, lightDir); | |
half4 c; | |
c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * min((atten + _ShadowColor.rgb), 1) * 2); | |
c.a = s.Alpha; | |
return c; | |
} | |
struct Input { | |
float2 uv_MainTex; | |
}; | |
sampler2D _MainTex; | |
void surf (Input IN, inout SurfaceOutput o) { | |
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb; | |
} | |
ENDCG | |
} | |
Fallback "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment