Skip to content

Instantly share code, notes, and snippets.

@positlabs
Created June 18, 2014 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save positlabs/1d6a5b3c6a56d136dffc to your computer and use it in GitHub Desktop.
Save positlabs/1d6a5b3c6a56d136dffc to your computer and use it in GitHub Desktop.
Shader template for unity materials
Shader "Custom/BaseShader" {
Properties {
_MainTex ("MainTexture", 2D) = "white" {}
_PlateTex ("PlateTexture", 2D) = "white" {}
}
SubShader {
Pass{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
uniform sampler2D _PlateTex;
struct appdata {
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
};
struct v2f {
float4 pos : SV_POSITION;
float4 texcoord : TEXCOORD0;
};
v2f vert (appdata v) {
v2f o;
o.pos = mul( UNITY_MATRIX_MVP, v.vertex );
o.texcoord = v.texcoord;
return o;
}
half4 frag( v2f i ) : COLOR {
half4 color = tex2D(_MainTex, i.texcoord.xy);
half4 plateColor = tex2D(_PlateTex, i.texcoord.xy);
return plateColor;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment