Silhouette shader - based on dot(N,V)

I’m trying to achieve silhouette effect using the dot(N,V) equation, but my shader currently fails to draw the edges properly. Anyone see where the error could be located???

v2f vert(appdata v) {
	v2f o;
	
	float3 V = normalize(ObjSpaceViewDir(v.vertex));
	//float3 objSpaceCameraPos = mul(_World2Object, float4(_WorldSpaceCameraPos.xyz, 1)).xyz * unity_Scale.w;
	//float3 V = normalize(objSpaceCameraPos - v.vertex.xyz);
	float3 N = v.normal;
	
	o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
	o.color = _OutlineColor;
	o.edge = max(0, dot(V, N));
	
	return o;
}

half4 frag(v2f i) : COLOR 
{ 
	return i.edge;// < 0.05f ? 1 : 0;// * i.color; 
}

for smooth geo,the Dot(N,L) fall off smoothly,you can do some math trick,like pow(),for geo like cube, i dont think it can be done
Edit: and i think do that in fragment func will make it more smoothly

I’m not talking about the computation of the surface lighting - I assume L stands for light vector in your post

You probably want saturate(-dot(V,N)) ? Otherwise it’ll always come up black 'cause the view direction is facing away from your surface normal.

But doing that in the fragment shader with normalized vectors will give a smoother result. Also, if you want it constant sized, you’ll need to do something like;
-dot(V,N) / o.pos.w

Otherwise the effect increases and decreases as you get closerto /further from your object.

I’m guessing you’re after something like this;
http://forum.unity3d.com/threads/152561-Non-uniform-outline-shader

Yes this is exactly what I was asking for, Thanks a lot