The toon aesthetic can be achieved with the following changes to the shader:
- Add a new property for a texture called _RampTex:
_RampTex ("Ramp", 2D) = "white" {}
- Add its relative variable in the CGPROGRAM section:
sampler2D _RampTex;
- Change the #pragma directive so that it points to a function called LightingToon():
#pragma surface surf Toon
- Replace the LightingSimpleLambert function with the following function instead:
fixed4 LightingToon (SurfaceOutput s, fixed3 lightDir, fixed atten) { // First calculate the dot product of the light direction and the // surface's normal half NdotL = dot(s.Normal, lightDir); // Remap NdotL to the value on the ramp map NdotL = tex2D(_RampTex, fixed2(NdotL, 0.5)); // Next, ...