Back to shaders
Shader test bench
ColourDistance
runnable transition
GLSL transition function. Stronghold supplies two demo textures and progress/time uniforms.
Code
// License: MIT
// Author: P-Seebauer
// ported by gre from https://gist.github.com/P-Seebauer/2a5fa2f77c883dd661f9
uniform float power; // = 5.0
vec4 transition(vec2 p) {
vec4 fTex = getFromColor(p);
vec4 tTex = getToColor(p);
float m = step(distance(fTex, tTex), progress);
return mix(
mix(fTex, tTex, m),
tTex,
pow(progress, power)
);
}