Tiling / Repeat SPR

There is a much simpler way to do this effect, just activate the repetition of the image in the texture field and use this code

shader_type canvas_item;

void fragment() {

COLOR = texture(TEXTURE, vec2(UV.x * 3., UV.y * 8.));

}

LOL

Shader code
shader_type canvas_item;

uniform vec2 tiling = vec2(2.0, 1.0);
uniform vec2 offset = vec2(0.0, 0.0);
uniform bool moving = false;
void vertex() {
    UV *= tiling;
    UV += offset;

    if (moving) {
        UV += offset * TIME;
    }
}

void fragment() {
	vec2 newUV = fract(UV);
	COLOR = texture(TEXTURE, newUV);
}
Tags
repeat, tiling
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Purga

Water 2D + Distortion 4.x

Water 2D + reflection 4.x

Related shaders

Procedural Wang Tiling Shader

Woven Pipes Tiling

Hexagonal tiling + cog wheels

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments