Spine-Skeleton-Lit-ZWrite.shader 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // - Vertex Lit + ShadowCaster
  2. // - Premultiplied Alpha Blending (Optional straight alpha input)
  3. // - Double-sided, ZWrite
  4. Shader "Spine/Skeleton Lit ZWrite" {
  5. Properties {
  6. _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1
  7. _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
  8. [NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
  9. [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
  10. [Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
  11. [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
  12. [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
  13. // Outline properties are drawn via custom editor.
  14. [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
  15. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  16. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  17. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  18. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  19. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  20. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  21. }
  22. SubShader {
  23. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  24. LOD 100
  25. Stencil {
  26. Ref[_StencilRef]
  27. Comp[_StencilComp]
  28. Pass Keep
  29. }
  30. Pass {
  31. Name "Normal"
  32. Tags { "LightMode"="Vertex" "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
  33. ZWrite On
  34. Cull Off
  35. Blend One OneMinusSrcAlpha
  36. CGPROGRAM
  37. #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
  38. #pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
  39. #pragma vertex vert
  40. #pragma fragment frag
  41. #pragma target 2.0
  42. #define _ALPHA_CLIP
  43. #pragma multi_compile __ POINT SPOT
  44. #include "CGIncludes/Spine-Skeleton-Lit-Common.cginc"
  45. ENDCG
  46. }
  47. Pass {
  48. Name "Caster"
  49. Tags { "LightMode"="ShadowCaster" }
  50. Offset 1, 1
  51. Fog { Mode Off }
  52. ZWrite On
  53. ZTest LEqual
  54. Cull Off
  55. Lighting Off
  56. CGPROGRAM
  57. #pragma vertex vertShadow
  58. #pragma fragment fragShadow
  59. #pragma multi_compile_shadowcaster
  60. #pragma fragmentoption ARB_precision_hint_fastest
  61. #define SHADOW_CUTOFF _ShadowAlphaCutoff
  62. #include "CGIncludes/Spine-Skeleton-Lit-Common-Shadow.cginc"
  63. ENDCG
  64. }
  65. }
  66. CustomEditor "SpineShaderWithOutlineGUI"
  67. }