Shader not working with Deffered Lighting

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"
}

It looks like you’re missing a lot of spaces in your shader. Did you copy and paste in a weird way, or perhaps the new forum software is breaking your stuff?

I just copied it, however here’s the shader file.
Really hope you can help me.

Cheers

1652448–103169–Toon Diffuse.shader (2.17 KB)

Someone might be able to help you if you explain the problem in detail. “Not working” is about as vague as descriptions of problems get.

I’m so sorry.
The problem is that the outline is not showing in deffered.

Looking at the code, I’m not sure why that would be. Unless extra passes aren’t executed on surface shaders under deferred lighting, you should still get the outlines rendered in the right places.

I do not think that there could be any problem with my PC, I tried it on 3 different PC (MAC and Windows). COuld you try it on you PC? With both deffered and forward rendering.