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

masking shader

Reupload of outline shader

Shader Toy Conversion by scarm

Related shaders

Tile Map

Tile Based Triangles & Rects

Screen Noise Effect Shader

guest

0 Comments
Inline Feedbacks
View all comments