I found this shader here on the forum and it’s working but not in Deffered Lighing. What should I have to do to make it work with Deffered?
Shader"DiffuseToon" {
Properties
{
_Color ("MainColor", Color) = (.5,.5,.5,1)
_OutlineColor ("OutlineColor", Color) = (0,1,0,1)
_Outline ("Outlinewidth", Range (0.002, 0.03)) = 0.01
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD200
CGPROGRAM
#pragmasurfacesurfLambert
sampler2D_MainTex;
fixed4_Color;
structInput {
float2uv_MainTex;
};
voidsurf (InputIN, inoutSurfaceOutputo) {
fixed4c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
Pass
{
Name"OUTLINE"
Tags { "LightMode" = "Always" }
CGPROGRAM
#pragmaexclude_renderersgles
#pragmaexclude_renderersd3d11xbox360
#pragmavertexvert
structappdata {
float4vertex;
float3normal;
};
structv2f {
float4pos : POSITION;
float4color : COLOR;
floatfog : FOGC;
};
uniformfloat_Outline;
uniformfloat4_OutlineColor;
v2fvert(appdatav) {
v2fo;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
float3norm = mul ((float3x3)UNITY_MATRIX_MV, v.normal);
norm.x *= UNITY_MATRIX_P[0][0];
norm.y *= UNITY_MATRIX_P[1][1];
o.pos.xy += norm.xy * o.pos.z * _Outline;
o.fog = o.pos.z;
o.color = _OutlineColor;
returno;
}
ENDCG
CullFront
ZWriteOn
ColorMaskRGB
BlendSrcAlphaOneMinusSrcAlpha
SetTexture [_MainTex] { combineprimary }
}
}
Fallback"Diffuse"
}