- Home /
Question by
Brandondpbell · Mar 15, 2014 at 09:53 PM ·
shaderoutlinetoon
Shader Assitance: Sprite Outline Color, Hidden Object
Hi everyone. I'd some help adding Color to an outline sprite shader so it can be changed via inspector and a variant that only shows only the outline. (Blending Zero One and Culling did not work for me so far)
Any help to make these two edits would be greatly appreciated:
Shader "Custom/2DSprite_OutlineShadow" {
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_OutLineSpread ("Outline Spread", Range(0,0.012)) = 0.007
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite On Blend One OneMinusSrcAlpha Cull Off
LOD 110
CGPROGRAM
#pragma surface surf Lambert alpha
struct Input
{
float2 uv_MainTex;
fixed4 color : COLOR;
};
sampler2D _MainTex;
float _OutLineSpread;
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 mainColor = (tex2D(_MainTex, IN.uv_MainTex+float2(_OutLineSpread,_OutLineSpread)) + tex2D(_MainTex, IN.uv_MainTex-float2(_OutLineSpread,_OutLineSpread))) * fixed4(0,0,0,1);
fixed4 addcolor = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
if(addcolor.a > 0.95){
mainColor = addcolor;}
o.Albedo = mainColor.rgb;
o.Alpha = mainColor.a;
}
ENDCG
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
Blend One OneMinusSrcAlpha
Cull Off
Fog { Mode Off }
LOD 100
Pass {
Tags {"LightMode" = "Vertex"}
ColorMaterial AmbientAndDiffuse
Lighting On
SetTexture [_MainTex]
{
Combine texture * primary double, texture * primary
}
}
}
Fallback "Diffuse", 1
}
Comment
Changing the Color of the Outline and a variant that shows only the outline not the object it is on. $$anonymous$$gestions for changes?
Your answer
Follow this Question
Related Questions
Silhouette Toon Shader 0 Answers
Set Color not working on Outline 0 Answers
Outlines Defined by Shading Groups? 0 Answers
"double" outline shader? 0 Answers
Exclude outline only, from fog, in custom toon shader. 1 Answer