Hi everyone,
I want to obtain this kind of effect on my game (see below), I don’t know if it’s a shader or an other kind of texture.
Finally I would change the color of the line when I want to.
Thanks!
Hi everyone,
I want to obtain this kind of effect on my game (see below), I don’t know if it’s a shader or an other kind of texture.
Finally I would change the color of the line when I want to.
Thanks!
I believe some wireframe shader can do this but you can also make a simple white outline texture and apply unlit color shader which you can adjust the white part color.
I find this shader, but it work only with simple polygon.
I don’t no how shaders works so I need some help to correct it.
Right now it apply shader to object but not to every vertex.
Shader "WireFrameShader"
{
Properties
{
_LineColor ("Line Color", Color) = (1,1,1,1)
_GridColor ("Grid Color", Color) = (0,0,0,0)
_LineWidth ("Line Width", float) = 0.05
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform float4 _LineColor;
uniform float4 _GridColor;
uniform float _LineWidth;
// vertex input: position, uv1, uv2
struct appdata {
float4 vertex : POSITION;
float4 texcoord1 : TEXCOORD0;
float4 color : COLOR;
};
struct v2f {
float4 pos : POSITION;
float4 texcoord1 : TEXCOORD0;
float4 color : COLOR;
};
v2f vert (appdata v) {
v2f o;
o.pos = mul( UNITY_MATRIX_MVP, v.vertex);
o.texcoord1 = v.texcoord1;
o.color = v.color;
return o;
}
float4 frag(v2f i ) : COLOR
{
float2 uv = i.texcoord1;
float d = uv.x - uv.y;
if (uv.x < _LineWidth) // 0,0 to 1,0
return _LineColor;
else if(uv.x > 1 - _LineWidth) // 1,0 to 1,1
return _LineColor;
else if(uv.y < _LineWidth) // 0,0 to 0,1
return _LineColor;
else if(uv.y > 1 - _LineWidth) // 0,1 to 1,1
return _LineColor;
else
return _GridColor;
}
ENDCG
}
}
Fallback "Vertex Colored", 1
}
You could also do it with postprocessing; I think this is more common. Unity comes with a edge highlight post process shader, see here: http://docs.unity3d.com/Manual/script-EdgeDetectEffect.html
You would just have to change the highlight color from black to white.