Skip to content

Instantly share code, notes, and snippets.

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 retorillo/6b2fdec74a23ad176c12b5f54887b834 to your computer and use it in GitHub Desktop.
Save retorillo/6b2fdec74a23ad176c12b5f54887b834 to your computer and use it in GitHub Desktop.
// Licensed under CC0, No Rights Reserved
Shader "Custom/TransparentCutoutDoubleSidedDiffuseShader" {
Properties {
_Color ("Color", Color) = (1, 1, 1, 1)
_Alpha ("Alpha Map", 2D) = "white" {}
_Normal ("Normal Map", 2D) = "bump" {}
_Cutout ("Cutout", Range(0, 1)) = 0.5
}
SubShader {
Tags {
"Queue"="AlphaTest"
"IgnoreProjector"="True"
"RenderType"="TransparentCutout"
}
LOD 200
Cull Off
Lighting On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutout addshadow
#pragma target 3.0
struct Input {
float2 uv_Normal;
float2 uv_Alpha;
};
fixed4 _Color;
sampler2D _Normal;
sampler2D _Alpha;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutput o) {
fixed4 norm = tex2D (_Normal, IN.uv_Normal);
fixed4 alpha = tex2D (_Alpha, IN.uv_Alpha);
o.Albedo = _Color;
o.Alpha = alpha.a;
o.Normal = UnpackNormal(norm);
}
ENDCG
}
FallBack "Transparent/Cutout/Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment