Created
March 30, 2013 21:03
-
-
Save N-Carter/5278318 to your computer and use it in GitHub Desktop.
AlphaOnly.shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Mine/Alpha Only" | |
{ | |
Properties | |
{ | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_MainColor ("Tint Color", Color) = (1, 1, 1, 1) | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Transparent" } | |
// LOD 200 | |
Blend SrcAlpha OneMinusSrcAlpha | |
// AlphaTest Greater .01 | |
// ColorMask RGB | |
Lighting Off | |
ZWrite Off | |
Cull Off | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma fragmentoption ARB_precision_hint_fastest | |
// #pragma multi_compile_builtin | |
#include "UnityCG.cginc" | |
uniform sampler2D _MainTex; | |
uniform float4 _MainTex_ST; | |
uniform float4 _MainColor; | |
struct appdata_vert | |
{ | |
float4 vertex : POSITION; | |
float4 texcoord : TEXCOORD0; | |
float4 color : COLOR; | |
}; | |
struct v2f | |
{ | |
float4 pos : POSITION; | |
float2 uv : TEXCOORD0; | |
float4 color : COLOR; | |
}; | |
v2f vert(appdata_vert v) | |
{ | |
v2f o; | |
o.pos = mul(UNITY_MATRIX_MVP, v.vertex); | |
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); | |
o.color = v.color * _MainColor; | |
return o; | |
} | |
fixed4 frag(v2f i) : COLOR | |
{ | |
fixed4 c = i.color; | |
c.a *= UNITY_SAMPLE_1CHANNEL(_MainTex, i.uv); | |
return c; | |
} | |
ENDCG | |
} | |
} | |
// FallBack "Unlit/Transparent" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment