Is it possible with the free version of Unity to render 3D objects with a decently thick neon outline and a silhouette body? I’m looking for an effect similar to the 2D example below.
I know that there is a Toon Shader in the Asset Store but I only need this one feature and I’m not sure if it would be supported by the free version of Unity even if I did buy the Shader. All I want to know is whether or not Unity Free would support something like this (a “how” explanation is not necessary).
It is supported, but you better know how to make some shaders! There are not many available out there.
Like this?
Create a new shader, paste this in. Then assign the Neon-OutlineSilhouette shader to the material attached to your object:
Shader "Neon-OutlineSilhouette" {
Properties {
_OutlineColour ("Outline Colour", Color) = (0.95,0.5,0.5,0.5)
_OutlineWidth ("Outline Width", Float) = 0.01
}
CGINCLUDE
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
struct a2v {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : SV_POSITION;
};
uniform fixed4 _OutlineColour;
uniform half _OutlineWidth;
ENDCG
SubShader {
Tags {
"Queue" = "Geometry+100"
"IgnoreProjector" = "True"
}
Pass {
Name "SILHOUETTEINTERIOR"
Cull Back
Blend One Zero
Lighting Off
CGPROGRAM
v2f vert (a2v v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
fixed4 frag (v2f IN) : COLOR
{
return fixed4(0.0,0.0,0.0,1.0);
}
ENDCG
}
Pass {
Name "OUTLINE"
Cull Front
Offset 10, 10
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#include "UnityCG.cginc"
v2f vert (a2v v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 vOffset = TransformViewToProjection(norm.xy);
o.pos.xy += vOffset * o.pos.z * _OutlineWidth;
return o;
}
fixed4 frag (v2f IN) : COLOR
{
return _OutlineColour;
}
ENDCG
}
}
}