
Untitled
By: a guest on
Aug 18th, 2012 | syntax:
None | size: 1.10 KB | hits: 13 | expires: Never
Shader "Custom/MobileMatte(Diffuse)" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Color (RGB)", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
pass {
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
sampler2D _MainTex;
half4 _MainTex_ST;
fixed3 _Color;
half4 unity_LightmapST;
sampler2D unity_Lightmap;
struct v2f
{
half4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
half2 uvLM : TEXCOORD1;
};
v2f vert (appdata_full v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
o.uvLM = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
return o;
}
fixed4 frag (v2f i) : COLOR0
{
fixed4 tex = tex2D (_MainTex, i.uv);
tex.rgb *= _Color;
#ifdef LIGHTMAP_ON
fixed3 lm = DecodeLightmap (tex2D (unity_Lightmap, i.uvLM));
tex.rgb *= lm;
#endif
return tex;
}
ENDCG
}
}
}