We have clouds in a game that are being animated by shifting the x uv during runtime. They are using sprite renderers! I wrote a very simple shader that accomplishes this except there’s one issue, where the original transparent pixels are is being cut out. Is there a property or something or is this a limitation of sticking with the sprite renderer? (I understand I can create a quad mesh with the texture but there are some nice freebies with using sprites such as packing).

Note the bottom pixels being cut out where the original clouds are transparent!
Here’s the shader I wrote, maybe I am doing something dumb ![]()
Shader "Custom/ShiftXUV"
{
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_maxSpeed ("Max Speed", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct appdata
{
float4 vertex : POSITION;
half2 uv : TEXCOORD0;
fixed3 speedAmount : COLOR;
};
struct v2f
{
float4 vertex : SV_POSITION;
half2 texCoord : TEXCOORD0;
fixed3 speedAmount : COLOR;
};
sampler2D _MainTex;
uniform float _maxSpeed;
uniform float _time;
v2f vert (appdata v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texCoord = v.uv;
o.speedAmount = v.speedAmount;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv = i.texCoord;
uv.x = frac(uv.x + i.speedAmount.x * _maxSpeed * _time);
fixed4 col = tex2D(_MainTex, uv);
col.rgb *= col.a;
return col;
}
ENDCG
}
}
}
Thanks!
