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.

48 lines
1.3 KiB

5 years ago
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/Fog Volume/BlurEffectConeTap"
  3. {
  4. Properties { _MainTex ("", any) = "" {} }
  5. CGINCLUDE
  6. #include "UnityCG.cginc"
  7. struct v2f {
  8. float4 pos : SV_POSITION;
  9. half2 uv : TEXCOORD0;
  10. half2 taps[4] : TEXCOORD1;
  11. };
  12. sampler2D _MainTex;
  13. half4 _MainTex_TexelSize;
  14. half4 _BlurOffsets;
  15. half ShadowColor;
  16. v2f vert( appdata_img v ) {
  17. v2f o;
  18. o.pos = UnityObjectToClipPos(v.vertex);
  19. o.uv = v.texcoord - _BlurOffsets.xy * _MainTex_TexelSize.xy; // hack, see BlurEffect.cs for the reason for this. let's make a new blur effect soon
  20. o.taps[0] = o.uv + _MainTex_TexelSize * _BlurOffsets.xy;
  21. o.taps[1] = o.uv - _MainTex_TexelSize * _BlurOffsets.xy;
  22. o.taps[2] = o.uv + _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
  23. o.taps[3] = o.uv - _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
  24. return o;
  25. }
  26. half4 frag(v2f i) : SV_Target {
  27. half4 color = tex2D(_MainTex, i.taps[0]);
  28. color += tex2D(_MainTex, i.taps[1]);
  29. color += tex2D(_MainTex, i.taps[2]);
  30. color += tex2D(_MainTex, i.taps[3]);
  31. //color.gb *= 0;
  32. //color *= ShadowColor;
  33. return color*.25;
  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. }