Alternative exponential easing for blender's fcurves (3D animation)
I recently had an animation project using blender where I wanted the
scale of an object to progress exponentially. I rigged up some
keyframes and the interpolation did not proceed as I expected. I
turned my confusion
into a
stackexchange question.
The answer provided by sambler is that blender's exponential
easing has a range from 1:1024 that is linearly transformed to match
the keyframe points. Since I wanted my interpolation to go from 1:32
it would require NLA tricks to use blender's easing.
I instead opted for the most brutal and simple way to solve the
problem: I just keyframed every frame.
but I would rather be elegant
Fine. Let's think of a way we could use blender's fcurves to
specify more variations on exponential easing. Since blender's
keyframe points have handles, we could use those as constraints to let
us control parameters of the exponential equation.
In the general case
and
but for simplicity let's consider the special case of
and
because we can use an affine transform to map that to the general case.
There are four degrees of freedom in the equation I chose because I wanted to be able to exploit both the endpoints
(
and
) and the slopes (
and
) defined by the handles.
Since we are going to be working with the slope/derivative of the equation let's just write it down:
Let's outline the system of equations necessary to express this
And this is where we end up in the mud. I can not come up with a
closed-form solution to this system of equations.
My suspicion is that the solution will revolve around
using Newton's
method but I am not currently motivated enough to code an
implementation.
Another drawback to any iterative solution is that it represents a
performance bottleneck for blender or any other animation software
implementing this concept. The software would be forced to choose between
- iterating to a solution once and storing the resulting parameters in a special-purpose data structure
- or iterating a solution each time it needs to compute a
value on the curve.
Another alternative would be to let the user specify the a,b,c, &
d parameters which would work fine for my personal use case, but would
probably not be ideal for the general purpose animation use case.