_TheStrongestSnail/TheStrongestSnail/Assets/res/Battle_Royale_UI/End/ScrollShader.shader
wulongxiao 5ae084489a add
2024-11-20 15:01:45 +08:00

67 lines
1.6 KiB
Plaintext

Shader "Custom/ScrollShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_ScrollSpeedY ("Scroll Speed Y", Float) = 1.0
_Color ("Tint Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _ScrollSpeedY;
float4 _Color;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
// Adjust UV coordinates to scroll in the Y direction
float scrollY = _Time.y * _ScrollSpeedY;
o.uv = v.uv;
o.uv.y += scrollY;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
// Sample the texture using the updated UV coordinates
fixed4 col = tex2D(_MainTex, i.uv) * _Color;
return col;
}
ENDCG
}
}
FallBack "Transparent/Diffuse"
}