Pixelate into view (Custom Resolution)
I improved this shader such that the depixelization occurs at custom resolution
(If you want the pixel resolution to be same as texture I’ve uploaded another shader)
My first shader(s)!
Enjoy 🙂
Shader code
shader_type canvas_item;
uniform float time:hint_range(0.0, 1.57, 0.001) = 1.0;
uniform vec2 custom_resolution = vec2(100,100);
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,96.233))) * 43758.5453);
}
void fragment()
{
vec2 within_texture_pixel=vec2(floor(UV * custom_resolution));
vec4 color= texture(TEXTURE,UV);
if(sin(time) > rand(within_texture_pixel))
COLOR = color;
else
COLOR = vec4(0.0,0.0,0.0,0.0);
}