MIX (aka LERP)
In the previous thread, we mentioned how to take into account the pixels' coordinates to not just paint the screen with a solid color.
#shaderbasics #shaders
f(a, b, t) = t*a + (1.0 - t)*b
which in simpler terms means that, having a value "t", the method linearly interpolates from the value of "a" to the value of "b" as "t" goes from 0 to 1.
If "t" is 1, you get b
If "t" is 0.5, you get (a+b)/2 (the middle value)
Keep in mind that the transition from a to b happens *linearly*, which in most graphics cases, is a synonym for *boringly*. But we'll get to that when we talk about "smoothstep".
f(a, b, t) = (1.0 - t) * a + t * b
The explanation below is still accurate, even if I messed up the expression. That's how you get "a" if "t" is 0.
Sorry about that ^^"