This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Shaders/Pixeltransition.shader

26 lines
686 B
Text
Raw Permalink Normal View History

2022-06-18 13:05:48 +02:00
// 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,78.233))) * 43758.5453);
}
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,1.0);
// change to COLOR = vec4(0.0,0.0,0.0,0.0); to make transparent
}
}