screen tile shader

for all the ut nerds out there, this one’s for you


Shader code
shader_type canvas_item;

uniform vec2 scale = vec2(1, 1);
uniform vec2 offset = vec2(0, 0);
uniform vec2 zoomto = vec2(0.5, 0.5);

void fragment() {
    vec2 new_uv = SCREEN_UV;
    new_uv -= zoomto;
    new_uv = new_uv * scale;
    new_uv += zoomto;
    new_uv = mod(new_uv, 1);
    new_uv += offset;
    COLOR = textureLod(SCREEN_TEXTURE, new_uv, 0.0);
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from snesmocha

Reupload of outline shader

Undertale Animation Skew

rgb offset shader v2

Related shaders

Tile UVs

Tile Map

2D tilemap tile blending (texture splatting)

Notify of

Inline Feedbacks
View all comments