Skip to content

Instantly share code, notes, and snippets.

@sim2kid
Created November 12, 2021 19:08
Show Gist options
  • Save sim2kid/5ecf3fc11380cb2ed014dd62ff4e58c1 to your computer and use it in GitHub Desktop.
Save sim2kid/5ecf3fc11380cb2ed014dd62ff4e58c1 to your computer and use it in GitHub Desktop.
Two Sided Cutout Shader Unity
Shader "Transparent/TwoSidedCutOut"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader
{
Tags {"Queue" = "AlphaTest" "IgnoreProjector" = "True" "RenderType" = "TransparentCutout"}
Cull off
LOD 300
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 MAIN = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = MAIN.rgb;
o.Alpha = MAIN.a;
}
ENDCG
}
FallBack "Transparent/Cutout/Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment