#version 150 //OVE shader_name: Crazy Parametric Fun //OVE shader_description: by mandubian (License: MIT) //OVE name: A //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE default: 4 //OVE description: uniform float a; //OVE name: B //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE default: 1 //OVE description: uniform float b; //OVE name: Amplitude //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE default: 120 //OVE description: uniform float amplitude; //OVE name: Smoothness //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE max: 10.0 //OVE default: 1 //OVE description: uniform float smoothness; //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 uv, float progress) { vec2 p = uv.xy / vec2(1.0).xy; vec2 dir = p - vec2(.5); float dist = length(dir); float x = (a - b) * cos(progress) + b * cos(progress * ((a / b) - 1.) ); float y = (a - b) * sin(progress) - b * sin(progress * ((a / b) - 1.)); vec2 offset = dir * vec2(sin(progress * dist * amplitude * x), sin(progress * dist * amplitude * y)) / smoothness; return mix(getFromColor(p + offset), getToColor(p), smoothstep(0.2, 1.0, progress)); } void main(void) { frag_color = transition( ove_texcoord.xy, TransformCurve(1.0 - ove_tprog_all)); }