Created
June 18, 2014 21:06
-
-
Save positlabs/1d6a5b3c6a56d136dffc to your computer and use it in GitHub Desktop.
Shader template for unity materials
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/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