Hello Unity3D i have a question about shaders.Is there a shader that is both diffuse and toon?For example i want my players to have the diffuse body but the toon outline.If anyone knows where i can download this shader.Can you please tell me where?
Toon shading (the flattening of lighting) and outlines are distinct effects. They’re usually used hand in hand, but they don’t have to be.
How 'bout the toon outline shader in standard assets? Not sure how it does it.
You can simply add the outline pass to any existing shader. You can download the source for all of Unity’s default shaders from here.
Here’s an example using the diffuse bumped shader:
Shader "Bumped Diffuse Outline" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
/* Add these two properties from the outline shader here */
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (.002, 0.03)) = .005
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 300
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
/* Add the outline pass from the standard toony shader here */
UsePass "Toon/Basic Outline/OUTLINE"
}
FallBack "Diffuse"
}
I just dropped this in my project and it seemed work so that should be all there is to it.