Skip to content

Instantly share code, notes, and snippets.

@baobao
Created April 2, 2017 13:42
Show Gist options
  • Save baobao/d11aff7e34db22ff5919c1966df7a0be to your computer and use it in GitHub Desktop.
Save baobao/d11aff7e34db22ff5919c1966df7a0be to your computer and use it in GitHub Desktop.
Shader "Hidden/VerticalScrollBlend"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
sampler2D _MainTex;
float _ScrollValue;
fixed4 frag (v2f_img i) : SV_Target
{
float u = i.uv.x;
float v = i.uv.y;
v = frac(v + _ScrollValue);
float3 rgb = tex2D(_MainTex, float2(u, v)).rgb;
return float4(rgb, 0.1);
}
ENDCG
SubShader
{
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment