Advertisement
Guest User

DiffuseWithColorAndShadows

a guest
Apr 7th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2.  
  3. Shader "Sprites/Diffuse2"
  4. {
  5. Properties
  6. {
  7. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  8. _Color ("Tint", Color) = (1,1,1,1)
  9. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  10. [HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
  11. [HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1)
  12. [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
  13. [PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
  14. _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.5
  15. }
  16.  
  17. SubShader
  18. {
  19. Tags
  20. {
  21. "Queue"="Geometry"
  22. "RenderType"="TransparentCutout"
  23. "CanUseSpriteAtlas"="True"
  24. }
  25. LOD 200
  26.  
  27. Cull Off
  28. ZTest Off
  29. Blend SrcAlpha OneMinusSrcAlpha
  30.  
  31. CGPROGRAM
  32. #pragma surface surf Lambert addshadow fullforwardshadows vertex:vert nofog nolightmap nodynlightmap keepalpha noinstancing
  33. // Use shader model 3.0 target, to get nicer looking lighting
  34. #pragma target 3.0
  35. #include "UnitySprites.cginc"
  36.  
  37. fixed _Cutoff;
  38.  
  39. struct Input
  40. {
  41. float2 uv_MainTex;
  42. fixed4 color;
  43. };
  44.  
  45. void vert (inout appdata_full v, out Input o)
  46. {
  47. v.vertex = UnityFlipSprite(v.vertex, _Flip);
  48.  
  49. #if defined(PIXELSNAP_ON)
  50. v.vertex = UnityPixelSnap (v.vertex);
  51. #endif
  52.  
  53. UNITY_INITIALIZE_OUTPUT(Input, o);
  54. o.color = v.color * _Color * _RendererColor;
  55. }
  56.  
  57. void surf (Input IN, inout SurfaceOutput o)
  58. {
  59. fixed4 c = SampleSpriteTexture (IN.uv_MainTex) * IN.color;
  60. o.Albedo = c.rgb * c.a;
  61. o.Alpha = c.a;
  62. clip(o.Alpha - _Cutoff);
  63. }
  64. ENDCG
  65. }
  66.  
  67. Fallback "Transparent/VertexLit"
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement