AVProMovieCapture_MotionBlur_Div.shader 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/AVProMovieCapture/MotionBlur-Div"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Base (RGB)", 2D) = "white" {}
  7. }
  8. SubShader
  9. {
  10. Pass
  11. {
  12. ZTest Always Cull Off ZWrite Off
  13. Lighting Off
  14. Fog { Mode off }
  15. CGPROGRAM
  16. #pragma exclude_renderers flash xbox360 ps3 gles
  17. #pragma vertex vert
  18. #pragma fragment frag
  19. //#pragma target 3.0
  20. //#pragma fragmentoption ARB_precision_hint_fastest
  21. #include "UnityCG.cginc"
  22. uniform float _NumSamples;
  23. uniform sampler2D _MainTex;
  24. uniform float4 _MainTex_TexelSize;
  25. struct appdata
  26. {
  27. float4 vertex : POSITION;
  28. half2 texcoord : TEXCOORD0;
  29. };
  30. struct v2f
  31. {
  32. float4 pos : SV_POSITION;
  33. half2 uv : TEXCOORD0;
  34. };
  35. v2f vert(appdata v)
  36. {
  37. v2f o;
  38. o.pos = UnityObjectToClipPos(v.vertex);
  39. o.uv = v.texcoord;
  40. // Note: this flip is not needed because motion blur never target anti-aliased rendertextures
  41. /*#if UNITY_UV_STARTS_AT_TOP
  42. if (_MainTex_TexelSize.y < 0)
  43. {
  44. o.uv.y = 1.0 - o.uv.y;
  45. }
  46. #endif*/
  47. return o;
  48. }
  49. fixed4 frag (v2f i) : COLOR
  50. {
  51. float4 col = tex2D(_MainTex, i.uv);
  52. return col / _NumSamples;
  53. }
  54. ENDCG
  55. }
  56. }
  57. Fallback off
  58. }