I've figured it out by myself, it was pretty easy indeed. I just need a shader:
shader_type canvas_item;
uniform float size_x = 32.0; // blocks by x direction
uniform float size_y = 32.0; // blocks by y direction
void fragment() {
COLOR = texture(TEXTURE, vec2(floor(UV.x * size_x) / (size_x - 1.0), floor(UV.y * size_y) / (size_y - 1.0)));
}
The inside of fragment function is scaling the UV up, rounds it down using floor and scales the result back down. The image above (in the question) is pixelated down to 32x32 size, and after using this shader the Sprite looks just like in the image example.
P.S. It doesn't work for GUI nodes, maybe I'll solve this problem.
I've figured it out by myself, it was pretty easy indeed. I just need a shader:
The inside of
fragment
function is scaling theUV
up, rounds it down usingfloor
and scales the result back down. The image above (in the question) is pixelated down to 32x32 size, and after using this shader theSprite
looks just like in the image example.P.S. It doesn't work for GUI nodes, maybe I'll solve this problem.