AVProMovieCapture_MotionBlur_Div.shader 1.2 KB

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