Shadow2DRemoveSelf.shader 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Shader "Hidden/Shadow2DRemoveSelf"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. [PerRendererData][HideInInspector] _ShadowStencilGroup("__ShadowStencilGroup", Float) = 1.0
  7. }
  8. SubShader
  9. {
  10. Tags { "RenderType"="Opaque" }
  11. Cull Off
  12. BlendOp Add
  13. Blend One One
  14. ZWrite Off
  15. Pass
  16. {
  17. Stencil
  18. {
  19. Ref [_ShadowStencilGroup]
  20. Comp Equal
  21. Pass Keep
  22. Fail Keep
  23. }
  24. HLSLPROGRAM
  25. #pragma vertex vert
  26. #pragma fragment frag
  27. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  28. struct Attributes
  29. {
  30. float4 vertex : POSITION;
  31. float2 uv : TEXCOORD0;
  32. };
  33. struct Varyings
  34. {
  35. float2 uv : TEXCOORD0;
  36. float4 vertex : SV_POSITION;
  37. };
  38. sampler2D _MainTex;
  39. float4 _MainTex_ST;
  40. float _ReceivesShadows;
  41. Varyings vert (Attributes v)
  42. {
  43. Varyings o;
  44. o.vertex = TransformObjectToHClip(v.vertex.xyz);
  45. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  46. return o;
  47. }
  48. half4 frag(Varyings i) : SV_Target
  49. {
  50. half4 main = tex2D(_MainTex, i.uv);
  51. half4 col;
  52. col.r = 0;
  53. col.g = 0;
  54. col.b = main.a;
  55. col.a = 0;
  56. return col;
  57. }
  58. ENDHLSL
  59. }
  60. }
  61. }