Spine-Skeleton-Lit.shader 2.4 KB

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