Skip to content

Instantly share code, notes, and snippets.

@MattRix
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattRix/4986b1c9e76a87da93b2 to your computer and use it in GitHub Desktop.
Save MattRix/4986b1c9e76a87da93b2 to your computer and use it in GitHub Desktop.
Futile Basic shader rewritten for Unity 5 (no fixed function stuff)
//from http://forum.unity3d.com/threads/68402-Making-a-2D-game-for-iPhone-iPad-and-need-better-performance
Shader "Futile/Basic" //Unlit Transparent Vertex Colored
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
ZTest Always
Blend SrcAlpha OneMinusSrcAlpha
Fog { Mode Off }
Lighting Off
Cull Off //we can turn backface culling off because we know nothing will be facing backwards
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color;
return OUT;
}
fixed4 frag(v2f IN) : COLOR
{
return tex2D( _MainTex, IN.texcoord) * IN.color;
}
ENDCG
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment