Skip to content

Instantly share code, notes, and snippets.

@kakilemon
Last active October 18, 2022 05:48
Show Gist options
  • Save kakilemon/0b78e646900a63ff10523ce142f422f1 to your computer and use it in GitHub Desktop.
Save kakilemon/0b78e646900a63ff10523ce142f422f1 to your computer and use it in GitHub Desktop.
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