Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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