How to make background repeat in a specific way

Hi,

According to this thread, making a sprite repeating differently on both axis is not trivial. A thing you could do is using a Polygon2D node that will make the repeating easier, and use a custom shader to adjust the x and y axis yourself.
Something like this:
repeat

Here’s the shader in case you want to give it a try:

shader_type canvas_item;

void fragment()
{
	vec2 uv = UV;
	uv.x = fract(uv.x);
	COLOR.rgb = texture(TEXTURE, uv).rgb;
}

Would something like this work for you, or do you absolutely need to use a Sprite2D node?

2 Likes