Skip to content

Instantly share code, notes, and snippets.

@lucabelluccini
Created June 12, 2014 23:10
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 lucabelluccini/b9732dc6496ee2ee6225 to your computer and use it in GitHub Desktop.
Save lucabelluccini/b9732dc6496ee2ee6225 to your computer and use it in GitHub Desktop.
Self Lit, Alpha channel (global), Texture & Bump mapping mapped to UV, Mask mapped to UV2
Shader "Custom/Shader4SWithNormal" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Mask ("Mask", 2D) = "white" {}
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
_BumpMap ("Normal Map", 2D) = "bump" {}
_Illum ("Illumin (A)", 2D) = "white" {}
}
SubShader {
Tags {
"Queue"="Transparent"
"IgnoreProjector"="False"
"RenderType"="Transparent"
}
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _Illum;
sampler2D _Mask;
half _Alpha;
struct Input {
float2 uv_MainTex;
float2 uv_Illum;
float2 uv_BumpMap;
float2 uv2_Mask;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a;
o.Albedo = c.rgb;
o.Alpha = (tex2D(_Mask, IN.uv2_Mask).a * c.a) * _Alpha;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
Fallback "Custom/Shader4S"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment