Created
October 18, 2017 23:19
-
-
Save dpid/be0e808586945041ee1b7a7e02d06e60 to your computer and use it in GitHub Desktop.
A depth mask with shadows shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "FX/Matte Shadow Mask" { | |
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" = "Geometry-10" "IgnoreProjector" = "True" "RenderType" = "TransparentCutout" } | |
LOD 200 | |
Blend Zero SrcColor | |
Lighting Off | |
ZTest LEqual | |
ZWrite On | |
ColorMask 0 | |
Pass{} | |
CGPROGRAM | |
#pragma surface surf ShadowOnly alphatest:_Cutoff | |
fixed4 _Color; | |
struct Input { | |
float2 uv_MainTex; | |
}; | |
inline fixed4 LightingShadowOnly(SurfaceOutput s, fixed3 lightDir, fixed atten) | |
{ | |
fixed4 c; | |
c.rgb = s.Albedo*atten; | |
c.a = s.Alpha; | |
return c; | |
} | |
void surf(Input IN, inout SurfaceOutput o) { | |
fixed4 c = _Color; | |
o.Albedo = c.rgb; | |
o.Alpha = 1; | |
} | |
ENDCG | |
} | |
Fallback "Transparent/Cutout/VertexLit" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment