hello, thought I’d give this a go here. I’m not a programmer I’m more of an artist, I managed to find this shader which has what I need for a toon shader. unfortunately this shader does not support cast shadows. i have searched around for others that do but most toon shaders do not support both normal and ramp shading like this one does. I was hoping if somebody is willing to simply write in the code if possible. i dont know if adding in spec support aswell would be possible or even if it would look good but that would be nice. if anybody is willing to add shadow support for point lights etc to this shader i would really appreciate it thank you
Shader "Custom/ToonRampWithNormals"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
_BumpMap("Bumpmap", 2D) = "bump" {}
_Ramp("Toon Ramp", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Ramp
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _Ramp;
half4 LightingRamp(SurfaceOutput s, half3 lightDir, half atten) {
half NdotL = dot(s.Normal, lightDir);
half diff = NdotL * 0.5 + 0.5;
half3 ramp = tex2D(_Ramp, float2(diff,diff)).rgb;
half4 c;
c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten;
c.a = s.Alpha;
return c;
}
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
};
sampler2D _MainTex;
sampler2D _BumpMap;
half _Glossiness;
fixed4 _Color;
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf(Input IN, inout SurfaceOutput o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}