#version 150 //OVE shader_name: Vertical-Open //OVE shader_description: by martiniti (Licence MIT) //OVE name: Smoothness //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE max: 0.5 //OVE default: 0.2 //OVE description: uniform float smooth_in; //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; uniform vec2 resolution_in; #define ratio (resolution_in.x / resolution_in.y) /* animated from 0 to 1 */ uniform float ove_tprog_all; in vec2 ove_texcoord; out vec4 frag_color; float progress; 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 regress = 1.0 - progress; float s = 2.0 - abs((uv.x - 0.5) / (regress - 1.0)) - 2.0 * regress; return mix( getFromColor(uv), getToColor(uv), smoothstep(0.0 + smooth_in, 1.0 - smooth_in, s) ); } void main(void) { progress = TransformCurve(1.0 - ove_tprog_all); frag_color = transition( ove_texcoord.xy); }