Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Metropolia/OldFilm"
- {
- Properties
- {
- _MainTex("Main Tex", 2D) = "white" {}
- _FilmTex("Film Tex", 2D) = "white" {}
- _FrameCount("Frame Count", int) = 4
- _FrameSpeed("Frame Speed", float) = 10
- _Amount("Amount", range(0,1)) = 1
- }
- SubShader
- {
- Pass
- {
- CGPROGRAM
- #pragma vertex vert_img
- #pragma fragment frag
- #include "UnityCG.cginc"
- sampler2D _MainTex;
- sampler2D _FilmTex;
- int _FrameCount;
- float _FrameSpeed;
- float _Amount;
- fixed4 frag(v2f_img i) : SV_Target
- {
- fixed4 c = tex2D(_MainTex, i.uv);
- fixed4 bw = Luminance(c);
- c = lerp(c, bw, _Amount);
- float s = 1.0 / _FrameCount;
- float m = tex2D(_FilmTex,
- float2(
- i.uv.x * s + s * floor(_Time[1] * _FrameSpeed),
- i.uv.y)).r;
- c = lerp(c, fixed4(0, 0, 0, 1), (1-m) * _Amount);
- return c;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement