Pixel transition

A pixel transition effect where the screen fills with pixels. Use it on an overlay ColorRect or Sprite.  

This shader is made and contributed by, Tsar333.

Shader code
// Pixel transition shader
// Adapted from a shadertoy shader by iJ01 (https://www.shadertoy.com/view/Xl2SRd)

shader_type canvas_item;

float rand(vec2 co){
    return fract(sin(dot(co.xy ,vec2(12.9898,96.233))) * 43758.5453);
}
uniform float time = 1.0;
void fragment()
{
	vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE;
	vec2 uv = FRAGCOORD.xy / iResolution.xy;
    float resolution = 5.0;
    vec2 lowresxy = vec2(
    	floor(FRAGCOORD.x / resolution),
    	floor(FRAGCOORD.y / resolution)
    );
    
    if(sin(time) > rand(lowresxy)){
		COLOR = vec4(uv,0.5+0.5*sin(5.0 * FRAGCOORD.x),1.0);
    }else{
		COLOR = vec4(0.0,0.0,0.0,0.0);
		// change to COLOR = vec4(0.0,0.0,0.0,1.0); to make black pixels
    } 
}
Tags
blend, pixelate, transition
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 godotshaders

Cloudy skies

Noise vertex displacement

Realistic Water

Related shaders

Sub-Pixel Accurate Pixel-Sprite Filtering

Pixel art trail

Smooth 3D pixel filtering

guest
0 Comments
Inline Feedbacks
View all comments