I'm trying to create a pixelation shader which I can view through the camera2D
node
something like this but instead of black and white I need pixelation
using this answer I got a pixelation shader but how do I view it through the camera?
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 structure of my nodes is same as in the above video link:
ah I found my mistake, I accidentally had use parent material
selected
the shader code was the same:
shader_type canvas_item;
uniform float size_x = 0.008;
uniform float size_y = 0.008;
void fragment() {
vec2 uv = SCREEN_UV;
uv -= mod(uv, vec2(size_x, size_y));
COLOR.rgb = textureLod(SCREEN_TEXTURE, uv, 0.0).rgb;
}