Shader "Custom/Toon" {
Properties {
_MainTex ("Main Tex", 2D) = "white" {}
_RampTex("Ramp Tex",2D)=""{}
}
SubShader {
Tags { "Queue"="Transparent" "IngnoreProjector"="True" "RenderType"="Transparent" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Toon alpha:fade nolighting
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _RampTex;
struct Input {
float2 uv_MainTex;
};
fixed4 LightingToon(SurfaceOutput s,fixed3 lightDir,fixed atten)
{
half NdotL = dot(s.Normal,lightDir);
fixed4 col = tex2D(_RampTex,fixed2(NdotL,0.5));
fixed4 c;
c.rgb = s.Albedo*_LightColor0.rgb*col*atten;
c.a = s.Alpha;
return c;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex,IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
渐变纹理模拟光照
最新推荐文章于 2022-07-11 09:08:01 发布