Screen Tiling

Shader that repeatedly tiles the screen based on the given numbers of rows and clomuns

Apply on a ColorRect with Full Rect anchor preset across the screen

Shader code
shader_type canvas_item;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_nearest;
uniform int rows = 2;
uniform int columns = 2;

void fragment() {
	vec2 grid_uv = vec2((UV.x - floor(UV.x/(1.0/float(rows))) * 1.0/float(rows))*float(rows), (UV.y - floor(UV.y/(1.0/float(columns))) * 1.0/float(columns)) * float(columns));
	vec4 text = texture(SCREEN_TEXTURE, grid_uv);
	COLOR = text;
}
Tags
screen, screen tiling, shader, tiles, 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.

Related shaders

Woven Pipes Tiling

Procedural Wang Tiling Shader

Tiling Dot Background

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Bytez
Bytez
3 months ago

the texture keeps in black color