Skip to content

Instantly share code, notes, and snippets.

@JonRurka
Created May 14, 2016 00:28
Show Gist options
  • Save JonRurka/fefc066d869a9c6e4e3d16e158089254 to your computer and use it in GitHub Desktop.
Save JonRurka/fefc066d869a9c6e4e3d16e158089254 to your computer and use it in GitHub Desktop.
Shader "GUI/3D Text Shader" {
Properties
{
_MainTex("Font Texture", 2D) = "white" {}
}
SubShader
{
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
//Pass
//{
Blend SrcAlpha OneMinusSrcAlpha
ZWrite On
CGPROGRAM
//#pragma vertex vert
#pragma surface surf Lambert vertex:vert
//#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
struct Input {
float4 pos : SV_POSITION;
//fixed4 color : COLOR;
float2 uv_tex : TEXCOORD0;
};
//float4 _MainTex_ST;
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
//o.color = v.color;
//o.uv_tex = TRANSFORM_TEX(v.texcoord, _MainTex);
//o.uv_tex = v.texcoord;
//v2f o;
//o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
//o.color = v.color;
//o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
//return o;
}
void surf(Input IN, inout SurfaceOutput o) {
o.Alpha = o.Alpha * tex2D(_MainTex, IN.uv_tex).a;
}
/*fixed4 frag(v2f o) : COLOR
{
// this gives us text or not based on alpha, apparently
o.color.a *= tex2D(_MainTex, o.uv).a;
return o.color;
}
ENDCG
//}
}
//Fallback "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment