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
This shader is a port from an existing Shadertoy project. Shadertoy shaders are by default protected under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license unless anything else has been stated by the author. For more info, see our License terms.

More from godotshaders

Realistic Water

Pixelate

Invert color

Related shaders

Sub-Pixel Accurate Pixel-Sprite Filtering

Simple 2d transition

Screentone scene transition

guest

0 Comments
Inline Feedbacks
View all comments