a = lerp(a, B, 1.0 - exp(-delta * RATE2))
a = lerp(a, B, -expm1(-delta * RATE2))
And (as pointed in the above) if you're worried about the slowness of it, just Taylor expand it to x+x²/2.
Finally, unless division is too costly, do:
a = lerp(a, B, -expm1(delta / -T))
It's not the half-life (sorry) but it's still a lot more intuitive as a parameter.
And (as pointed in the above) if you're worried about the slowness of it, just Taylor expand it to x+x²/2.
Finally, unless division is too costly, do:
Where T is the “time constant” (which you can intuitively express in time units, like seconds): https://en.wikipedia.org/wiki/Exponential_smoothing#Time_con...It's not the half-life (sorry) but it's still a lot more intuitive as a parameter.