Seven is the number.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.7 KiB

3 years ago
  1. Shader "Hidden/TrueShadow/PostProcess"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. _Offset ("Offset", Vector) = (0,0,0,0)
  7. }
  8. SubShader
  9. {
  10. Cull Off ZWrite Off ZTest Always
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. struct appdata
  18. {
  19. float4 vertex : POSITION;
  20. float2 uv : TEXCOORD0;
  21. };
  22. struct v2f
  23. {
  24. float2 uv : TEXCOORD0;
  25. float4 vertex : SV_POSITION;
  26. };
  27. v2f vert(appdata v)
  28. {
  29. v2f o;
  30. o.vertex = UnityObjectToClipPos(v.vertex);
  31. o.uv = v.uv;
  32. return o;
  33. }
  34. uniform sampler2D _ShadowTex;
  35. uniform sampler2D _MainTex;
  36. uniform float2 _Offset;
  37. uniform float _OverflowAlpha;
  38. uniform float _AlphaMultiplier;
  39. fixed4 frag(v2f i) : SV_Target
  40. {
  41. half4 shadow = tex2D(_ShadowTex, i.uv);
  42. half alpha = shadow.a;
  43. half alphaBoosted = saturate(alpha * _AlphaMultiplier);
  44. shadow.a = alphaBoosted;
  45. shadow.rgb = shadow.rgb / alpha * alphaBoosted;
  46. float cutOut;
  47. float2 cutoutUv = i.uv + _Offset;
  48. if (any(cutoutUv > 1) || any(cutoutUv < 0))
  49. cutOut = _OverflowAlpha;
  50. else
  51. cutOut = tex2D(_MainTex, cutoutUv).a;
  52. shadow *= 1 - cutOut;
  53. return shadow;
  54. }
  55. ENDCG
  56. }
  57. }
  58. }