Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active December 14, 2017 01:53
Show Gist options
  • Save unitycoder/a5b6f8da27dc3619ba44 to your computer and use it in GitHub Desktop.
Save unitycoder/a5b6f8da27dc3619ba44 to your computer and use it in GitHub Desktop.
Sprites/OpaqueSnapNoTint - shader
Shader "Sprites/OpaqueSnapNoTint"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Geometry"
"IgnoreProjector"="True"
"RenderType"="Opaque"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ PIXELSNAP_ON
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
};
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = UnityPixelSnap(mul(UNITY_MATRIX_MVP, IN.vertex));
OUT.texcoord = IN.texcoord;
return OUT;
}
sampler2D _MainTex;
fixed4 frag(v2f IN) : SV_Target
{
fixed4 c = tex2D(_MainTex, IN.texcoord);
return c;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment