Skip to content

Instantly share code, notes, and snippets.

@xDavidLeon
Created December 7, 2013 15:34
Show Gist options
  • Save xDavidLeon/7844012 to your computer and use it in GitHub Desktop.
Save xDavidLeon/7844012 to your computer and use it in GitHub Desktop.
Unity Deferred Shader Test
Shader "Leon/Test" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Emissive ("Emissive", 2D) = "black" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Leon
half4 LightingLeon_PrePass (SurfaceOutput s, half4 light) {
// your new code?
half4 c;
c.rgb = s.Albedo * light.rgb;
c.a = s.Alpha;
return c;
}
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};
sampler2D _MainTex;
sampler2D _Emissive;
sampler2D _BumpMap;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
float3 emissive = tex2D (_Emissive, IN.uv_MainTex).rgb;
o.Emission = emissive;
}
ENDCG
}
Fallback "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment