#version 150 //OVE shader_name: Fade Color //OVE shader_description: by gre (License: MIT) //OVE name: Color //OVE type: COLOR //OVE default: RGBA(0.6, 0.2, 0.2, 1) //OVE description: uniform vec4 color; //OVE name: Color Phase //OVE type: FLOAT //OVE flag: NOT_CONNECTABLE //OVE min: 0.0 //OVE max: 1.0 //OVE default: 0.4 //OVE description: if 0.0, there is no black phase, if 0.9, the black phase is very important uniform float colorPhase; //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; 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) { return mix( mix(color, getFromColor(uv), smoothstep(1.0-colorPhase, 0.0, progress)), mix(color, getToColor(uv), smoothstep( colorPhase, 1.0, progress)), progress); } void main(void) { progress = TransformCurve(1.0 - ove_tprog_all); frag_color = transition( ove_texcoord.xy); }