Skip to content

Instantly share code, notes, and snippets.

@dshook
Created February 21, 2017 00:21
Show Gist options
  • Select an option

  • Save dshook/cc96686ae1cbb3e8a3ef2a90c9c090bc to your computer and use it in GitHub Desktop.

Select an option

Save dshook/cc96686ae1cbb3e8a3ef2a90c9c090bc to your computer and use it in GitHub Desktop.
Shader "Custom/HpBorder"
{
Properties
{
_Scale("Scale", Range(0.0, 1.0)) = 0.5
}
SubShader
{
Tags {"RenderType"="Transparent" "Queue"="Transparent"}
LOD 200
Lighting Off
ZWrite Off
Cull Off
Fog { Mode Off }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
half4 color : COLOR;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
half4 color : COLOR;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
o.uv = v.uv;
return o;
}
float _Scale;
half4 frag (v2f i) : SV_Target
{
//return i.color;
return half4(i.uv.x * _Scale, i.uv.y * _Scale, 0, 0);
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment