Skip to content

Instantly share code, notes, and snippets.

@boj
Created February 11, 2012 07:31
Show Gist options
  • Save boj/1797460 to your computer and use it in GitHub Desktop.
Save boj/1797460 to your computer and use it in GitHub Desktop.
Grayscale Shader
Shader "Custom/Grey Texture" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = dot(c.rgb, float3(0.3, 0.59, 0.11));
o.Alpha = c.a;
}
ENDCG
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment