#version 150 //OVE shader_name: Glitch Memories //OVE shader_description: by Gunnar Roth and natewave (license: MIT) //OVE end #define LINEAR_CURVE 0 #define EXPONENTIAL_CURVE 1 #define LOGARITHMIC_CURVE 2 uniform sampler2D out_block_in; uniform sampler2D in_block_in; uniform bool out_block_in_enabled; uniform bool in_block_in_enabled; uniform int curve_in; /* animated from 0 to 1 */ uniform float ove_tprog_all; in vec2 ove_texcoord; out vec4 frag_color; vec4 getFromColor( vec2 p) { return texture( in_block_in, p); } vec4 getToColor( vec2 p) { return texture( out_block_in, p); } float TransformCurve(float linear) { if (curve_in == EXPONENTIAL_CURVE) { return linear * linear; } else if (curve_in == LOGARITHMIC_CURVE) { return sqrt(linear); } else { return linear; } } vec4 transition(vec2 p, float progress) { vec2 block = floor(p.xy / vec2(16)); vec2 uv_noise = block / vec2(64); uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64); vec2 dist = progress > 0.0 ? (fract(uv_noise) - 0.5) * 0.3 *(1.0 -progress) : vec2(0.0); vec2 red = p + dist * 0.2; vec2 green = p + dist * .3; vec2 blue = p + dist * .5; return vec4(mix(getFromColor(red), getToColor(red), progress).r, mix(getFromColor(green), getToColor(green), progress).g, mix(getFromColor(blue), getToColor(blue), progress).b,1.0); } void main(void) { frag_color = transition( ove_texcoord.xy, TransformCurve(1.0 - ove_tprog_all)); }