Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (36 sloc)
850 Bytes
This file contains 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 "Custom/SpriteShadow" { | |
| Properties { | |
| _Color ("Color", Color) = (1,1,1,1) | |
| [PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {} | |
| _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.5 | |
| } | |
| SubShader { | |
| Tags | |
| { | |
| "Queue"="Geometry" | |
| "RenderType"="TransparentCutout" | |
| } | |
| LOD 200 | |
| Cull Off | |
| CGPROGRAM | |
| // Lambert lighting model, and enable shadows on all light types | |
| #pragma surface surf Lambert addshadow fullforwardshadows | |
| // Use shader model 3.0 target, to get nicer looking lighting | |
| #pragma target 3.0 | |
| sampler2D _MainTex; | |
| fixed4 _Color; | |
| fixed _Cutoff; | |
| struct Input | |
| { | |
| float2 uv_MainTex; | |
| }; | |
| void surf (Input IN, inout SurfaceOutput o) { | |
| fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; | |
| o.Albedo = c.rgb; | |
| o.Alpha = c.a; | |
| clip(o.Alpha - _Cutoff); | |
| } | |
| ENDCG | |
| } | |
| FallBack "Diffuse" | |
| } |