Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Shader "Metropolia/OldFilm"
  2. {
  3. Properties
  4. {
  5. _MainTex("Main Tex", 2D) = "white" {}
  6. _FilmTex("Film Tex", 2D) = "white" {}
  7. _FrameCount("Frame Count", int) = 4
  8. _FrameSpeed("Frame Speed", float) = 10
  9. _Amount("Amount", range(0,1)) = 1
  10. }
  11.  
  12. SubShader
  13. {
  14. Pass
  15. {
  16. CGPROGRAM
  17.  
  18. #pragma vertex vert_img
  19. #pragma fragment frag
  20. #include "UnityCG.cginc"
  21.  
  22. sampler2D _MainTex;
  23. sampler2D _FilmTex;
  24. int _FrameCount;
  25. float _FrameSpeed;
  26. float _Amount;
  27.  
  28. fixed4 frag(v2f_img i) : SV_Target
  29. {
  30. fixed4 c = tex2D(_MainTex, i.uv);
  31. fixed4 bw = Luminance(c);
  32. c = lerp(c, bw, _Amount);
  33. float s = 1.0 / _FrameCount;
  34. float m = tex2D(_FilmTex,
  35. float2(
  36. i.uv.x * s + s * floor(_Time[1] * _FrameSpeed),
  37. i.uv.y)).r;
  38. c = lerp(c, fixed4(0, 0, 0, 1), (1-m) * _Amount);
  39. return c;
  40. }
  41.  
  42. ENDCG
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement