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);
}
Tags
fade, pixel, pixelate, transition
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from cak3_lover

Pixelate into view (Texture Resolution)

Related shaders

Pixelate into view (Texture Resolution)

Pixelate 3D Effect

Pixelate

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments