The design and implementation of an Open Source animation tool.

July 13, 2007

Shape Deformation

I'd like to support two methods for shape deformation in Moing:
  1. Non-Rigid
    This is essentially the same method frequently used in 2d image morphing; the displacement of the shape manipulation pegs would be interpolated over the shape using thin plate splines.
  2. As-Rigid-as-Possible
    This is essentially the Puppet Tool from Adobe AfterEffects. Moving the distortion pegs on the shape would pull it around more or less as if it were a foam rubber cutout (with the transparent areas being empty). The method was introduced in this paper.
In both cases, the user could place "shape manipulation pegs" at arbitrary places on the shape, animating their movement like any other object in a scene. Initially, they would be parented to the shape they manipulate, so they'd move with it absent any other influence.

This feature is basically our answer to shape tweening. However, shape tweening usually forces you to explicitly establish a 1:1 correspondence with individual path elements in "before" and "after" shapes. In Synfig, you're mostly only distorting an initial shape, which makes life a little better, but you still have to muck around with individual path elements. What I'm describing as "shape deformation" applies to an asset as a whole (if you need finer control of individual parts, you can do shape manipulation inside a nested scene asset), and it should work for any visual asset up to and including bitmapped images and video.

Problems
  1. I think I'd like to be able to support both methods at once, but it's not entirely clear to me how that would work in practice; at the very least, one effect would have to be applied after the other, moving the other's pegs accordingly.
  2. I'm not sure how rigid-as-possible manipulation would work for animated assets, where the silhouette is constantly changing. It may simply have to recompute the mesh for every frame with a new silhouette, which is computationally expensive (but if you want to do it, you get what you ask for). There's also the issue of how to move the "neutral" position of a shape manipulation peg if the feature it's on moves in the animation.
  3. For rigid-as-possible, I've no idea what the UI for starching or z-order assignment should look like.
  4. For finding the silhouettes of bitmap and video assets, we pretty much have to potrace the alpha channel. For video at least, we'll need to cache that information somewhere.
Due to these issues, we'll probably only implement non-rigid deformation at first.

No comments: