Back to shaders
Shader test bench
Colorphase
runnable transition
GLSL transition function. Stronghold supplies two demo textures and progress/time uniforms.
Code
// Author: gre
// License: MIT
// Usage: fromStep and toStep must be in [0.0, 1.0] range
// and all(fromStep) must be < all(toStep)
uniform vec4 fromStep; // = vec4(0.0, 0.2, 0.4, 0.0)
uniform vec4 toStep; // = vec4(0.6, 0.8, 1.0, 1.0)
vec4 transition (vec2 uv) {
vec4 a = getFromColor(uv);
vec4 b = getToColor(uv);
return mix(a, b, smoothstep(fromStep, toStep, vec4(progress)));
}