Blur.shader 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Shader "Hidden/VolumetricFog2/Blur"
  2. {
  3. Properties
  4. {
  5. _BlueNoise("BlueNoise Tex", 2D) = "black" {}
  6. }
  7. SubShader
  8. {
  9. ZWrite Off ZTest Always Blend Off Cull Off
  10. HLSLINCLUDE
  11. #pragma target 3.0
  12. #pragma prefer_hlslcc gles
  13. #pragma exclude_renderers d3d11_9x
  14. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  15. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  16. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  17. #include "Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl"
  18. ENDHLSL
  19. Pass { // 0
  20. Name "Blur horizontally"
  21. HLSLPROGRAM
  22. #pragma vertex VertBlur
  23. #pragma fragment FragBlur
  24. #pragma multi_compile_local _ EDGE_PRESERVE EDGE_PRESERVE_UPSCALING
  25. #define BLUR_HORIZ
  26. #include "Blur.hlsl"
  27. ENDHLSL
  28. }
  29. Pass { // 1
  30. Name "Blur vertically"
  31. HLSLPROGRAM
  32. #pragma vertex VertBlur
  33. #pragma fragment FragBlur
  34. #pragma multi_compile_local _ EDGE_PRESERVE EDGE_PRESERVE_UPSCALING
  35. #define BLUR_VERT
  36. #include "Blur.hlsl"
  37. ENDHLSL
  38. }
  39. Pass { // 2
  40. Name "Final vertical blur and blend"
  41. Blend One OneMinusSrcAlpha
  42. HLSLPROGRAM
  43. #pragma vertex VertBlur
  44. #pragma fragment FragBlur
  45. #pragma multi_compile_local _ EDGE_PRESERVE EDGE_PRESERVE_UPSCALING
  46. #pragma multi_compile_local _ DITHER
  47. #define BLUR_VERT
  48. #define FINAL_BLEND
  49. #include "Blur.hlsl"
  50. ENDHLSL
  51. }
  52. Pass { // 3
  53. Name "Separated Blend (used with upscaling)"
  54. Blend One OneMinusSrcAlpha
  55. HLSLPROGRAM
  56. #pragma vertex VertSimple
  57. #pragma fragment FragUpscalingBlend
  58. #pragma multi_compile_local _ DITHER
  59. #include "Blur.hlsl"
  60. ENDHLSL
  61. }
  62. Pass { // 4
  63. Name "Downscale depth"
  64. HLSLPROGRAM
  65. #pragma vertex VertSimple
  66. #pragma fragment FragOnlyDepth
  67. #include "Blur.hlsl"
  68. ENDHLSL
  69. }
  70. Pass { // 5
  71. Name "Blur vertically final (used with downscaling)"
  72. HLSLPROGRAM
  73. #pragma vertex VertBlur
  74. #pragma fragment FragBlur
  75. #define BLUR_VERT
  76. #define FINAL_BLEND
  77. #pragma multi_compile_local _ EDGE_PRESERVE EDGE_PRESERVE_UPSCALING
  78. #include "Blur.hlsl"
  79. ENDHLSL
  80. }
  81. Pass { // 6
  82. Name "Resample"
  83. HLSLPROGRAM
  84. #pragma vertex VertCross
  85. #pragma fragment FragResample
  86. #include "Blur.hlsl"
  87. ENDHLSL
  88. }
  89. Pass { // 7
  90. Name "Combine resample"
  91. HLSLPROGRAM
  92. #pragma vertex VertCross
  93. #pragma fragment FragResample
  94. #define COMBINE_SCATTERING
  95. #include "Blur.hlsl"
  96. ENDHLSL
  97. }
  98. Pass { // 8
  99. Name "Scattering Prefilter"
  100. HLSLPROGRAM
  101. #pragma vertex VertSimple
  102. #pragma fragment FragScatteringPrefilter
  103. #include "Blur.hlsl"
  104. ENDHLSL
  105. }
  106. Pass { // 9
  107. Name "Scattering Blend"
  108. Blend SrcAlpha OneMinusSrcAlpha
  109. HLSLPROGRAM
  110. #pragma vertex VertSimple
  111. #pragma fragment FragScatteringBlend
  112. #pragma multi_compile_local _ SCATTERING_HQ
  113. #include "Blur.hlsl"
  114. ENDHLSL
  115. }
  116. }
  117. }