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.

53 lines
1.2 KiB

5 years ago
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/Fog Volume/Shadow Postprocess"
  3. {
  4. Properties { _MainTex ("", any) = "" {} }
  5. CGINCLUDE
  6. #include "UnityCG.cginc"
  7. struct v2f {
  8. float4 pos : SV_POSITION;
  9. half2 uv : TEXCOORD0;
  10. };
  11. sampler2D _MainTex;
  12. half4 _MainTex_TexelSize;
  13. half3 ContrastF(half3 pixelColor, fixed contrast)
  14. {
  15. return saturate(((pixelColor.rgb - 0.5f) * max(contrast, 0)) + 0.5f);
  16. }
  17. half ShadowColor;
  18. v2f vert( appdata_img v ) {
  19. v2f o;
  20. o.pos = UnityObjectToClipPos(v.vertex);
  21. o.uv = v.texcoord ;
  22. return o;
  23. }
  24. half4 frag(v2f i) : SV_Target {
  25. half4 color = tex2D(_MainTex, i.uv);
  26. //color.a *= 0;
  27. //color.a = ContrastF(color.a, ShadowColor+1);
  28. //color.a = ContrastF(color.a ,ShadowColor*5);
  29. half edges = saturate(dot(1 - i.uv.r, 1 - i.uv.g) * dot(i.uv.r, i.uv.g) * 600);
  30. edges *= edges*edges;
  31. color.r = color.r + color.r*ShadowColor*50* edges;
  32. color.r = lerp(0, color.r,edges);
  33. return min(color.r,1);
  34. }
  35. ENDCG
  36. SubShader {
  37. Pass {
  38. ZTest Always Cull Off ZWrite Off
  39. CGPROGRAM
  40. #pragma vertex vert
  41. #pragma fragment frag
  42. ENDCG
  43. }
  44. }
  45. Fallback off
  46. }