-
-
Save kakilemon/0b78e646900a63ff10523ce142f422f1 to your computer and use it in GitHub Desktop.
This file contains 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 "Custom/CustomSprite" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Texture", 2D) = "white" {} | |
} | |
SubShader | |
{ | |
Tags | |
{ | |
"Queue" = "Transparent" | |
"RenderType" = "Transparent" | |
} | |
Blend One OneMinusSrcAlpha | |
Cull Off | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
struct appdata | |
{ | |
float4 vertex : POSITION; | |
float4 color : COLOR; | |
float2 uv : TEXCOORD0; | |
}; | |
struct v2f | |
{ | |
float2 uv : TEXCOORD0; | |
fixed4 color : COLOR; | |
float4 vertex : SV_POSITION; | |
}; | |
sampler2D _MainTex; | |
v2f vert (appdata v) | |
{ | |
v2f o; | |
o.vertex = UnityObjectToClipPos(v.vertex); | |
o.color = v.color; | |
o.uv = v.uv; | |
return o; | |
} | |
fixed4 frag(v2f i) : SV_Target | |
{ | |
fixed4 col = tex2D(_MainTex, i.uv) * i.color; | |
col.rgb *= col.a; | |
return col; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment