I'm trying to create an outline shader, who has an edited outline.
At the moment it looks like this.
Shader "test/SimpleOutline" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline Width", Range (.002, 1.1)) = .005
}
SubShader {
Tags { "Queue"="Transparent" }
ZWrite off
CGPROGRAM
#pragma surface surf Lambert vertex:vert
struct Input {
float3 viewDir;
float2 uv_MainTex;
};
float _Outline;
float4 _OutlineColor;
void vert (inout appdata_full v) {
v.vertex.xyz += v.normal * _Outline;
}
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o)
{
o.Emission = float4(0, 1, 0,0);
}
ENDCG
ZWrite on
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
I want it like this.
It should be at a distance from the actual object Transparent so you can see the background. Completely circle each object and be arched. Like this horn?
Does anyone have a suggestion on how best to implement this?
Hm, interesting question.
1. How to outline effect in distance from object?
I suggest stencil
Pass1: draw your mesh with no stencil
Pass2: draw mesh with MaskColor 0 with stencil writing some value
Pass3: draw outline mesh in solid color with stencil enabled with bigger "scale" than previous pass
somth like that.
https://www.youtube.com/watch?v=xH5uUfeB2Go try to apply it in Pass3.
P.S. I'm gonna try this effect myself in next couple of days if I would have time.