보통 C#코드로 짠걸 붙여 쓰지만 shader상에서 구현하는거 만든김에....
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_scrollX("U scroll input", float) = 1
_scrollY("V scroll input", float) = 1
}
SubShader {
Tags { "RenderType"="Opaque" }
Lighting off
LOD 200
CGPROGRAM
#pragma surface surf Unlit nolightmap nodirlightmap noforwardadd approxview halfasview noambient
sampler2D _MainTex;
float _scrollX;
float _scrollY;
fixed4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
return fixed4(s.Albedo,1);
}
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, float2(IN.uv_MainTex.x + (_Time.x * _scrollX), IN.uv_MainTex.y + (_Time.y * _scrollY)));
o.Albedo = c.rgb ;
}
ENDCG
}
fallback "mobile/Diffuse"
}