AVProVideo-Internal-BlendFrames.shader 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //-----------------------------------------------------------------------------
  2. // Copyright 2014-2017 RenderHeads Ltd. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. Shader "AVProVideo/Internal/BlendFrames"
  5. {
  6. Properties
  7. {
  8. _MainTex("Before Texture", 2D) = "white" {}
  9. _AfterTex("After Texture", 2D) = "white" {}
  10. _t("t", Float) = 0.5
  11. }
  12. SubShader
  13. {
  14. Pass
  15. {
  16. ZTest Always Cull Off ZWrite Off
  17. Fog{ Mode off }
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #pragma exclude_renderers flash xbox360 ps3 gles
  22. #include "UnityCG.cginc"
  23. #include "../AVProVideo.cginc"
  24. uniform sampler2D _MainTex;
  25. uniform sampler2D _AfterTex;
  26. uniform float _t;
  27. struct v2f
  28. {
  29. float4 pos : POSITION;
  30. float4 uv : TEXCOORD0;
  31. };
  32. v2f vert(appdata_img v)
  33. {
  34. v2f o;
  35. o.uv = float4(0.0, 0.0, 0.0, 0.0);
  36. o.pos = XFormObjectToClip(v.vertex);
  37. o.uv.xy = v.texcoord.xy;
  38. return o;
  39. }
  40. float4 frag(v2f i) : COLOR
  41. {
  42. float4 before = tex2D(_MainTex, i.uv.xy);
  43. float4 after = tex2D(_AfterTex, i.uv.xy);
  44. float4 result = ((1.0 -_t) * before) + (_t * after);
  45. return result;
  46. }
  47. ENDCG
  48. }
  49. }
  50. FallBack Off
  51. }