Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
- Shader "Sprites/Diffuse2"
- {
- Properties
- {
- [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
- _Color ("Tint", Color) = (1,1,1,1)
- [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
- [HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
- [HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1)
- [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
- [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
- _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.5
- }
- SubShader
- {
- Tags
- {
- "Queue"="Geometry"
- "RenderType"="TransparentCutout"
- "CanUseSpriteAtlas"="True"
- }
- LOD 200
- Cull Off
- ZTest Off
- Blend SrcAlpha OneMinusSrcAlpha
- CGPROGRAM
- #pragma surface surf Lambert addshadow fullforwardshadows vertex:vert nofog nolightmap nodynlightmap keepalpha noinstancing
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 3.0
- #include "UnitySprites.cginc"
- fixed _Cutoff;
- struct Input
- {
- float2 uv_MainTex;
- fixed4 color;
- };
- void vert (inout appdata_full v, out Input o)
- {
- v.vertex = UnityFlipSprite(v.vertex, _Flip);
- #if defined(PIXELSNAP_ON)
- v.vertex = UnityPixelSnap (v.vertex);
- #endif
- UNITY_INITIALIZE_OUTPUT(Input, o);
- o.color = v.color * _Color * _RendererColor;
- }
- void surf (Input IN, inout SurfaceOutput o)
- {
- fixed4 c = SampleSpriteTexture (IN.uv_MainTex) * IN.color;
- o.Albedo = c.rgb * c.a;
- o.Alpha = c.a;
- clip(o.Alpha - _Cutoff);
- }
- ENDCG
- }
- Fallback "Transparent/VertexLit"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement