zed
1
whats the standard graphics way of describing a lerp?
texenvcombine uses aX + b(1-X) but both glsl and cg use a*(1-X) + b*X
ARB_texture_env_combine INTERPOLATE_ARB
Arg0 * (Arg2) + Arg1 * (1-Arg2)
glsl genType mix (genType x,genType y,genType a)
Returns x * (1 β a) + y * a
cg lerp(a,b,f)
(1-f)a + bf
ps/ why has the glsl spec got 1 β a there that should be 1.0 - a, tsk tsk, naughty boys
between = from + (to - from) * factor; // with one '*' less ;)
I think the CG/GLSL formulas are the reference because they yield βfromβ when the factor is 0.0f and βtoβ when the factor is 1.0f;
As the hw for ARB_texture_env_combine is quite restricted, the used formula could be a consequence of the hw design?
Just my 0.02β¬
system
3
And ARB_fp defines it as
LRP dst, src0, src1, src2;
and src0 is the weight
src0 * src1 + (1-src0) * src2
so itβs really a matter of operand order. There is no standard.
There is also the 3 operation version
src2 + src0 * (src1 - src2)