I've successfully set up a mesh that's deformed by an animated Bezier curve, with the help of the Animation: AnimAll utility, with one caveat: the mesh rotates inelegantly about the curve as it animates, in all available "Twisting" options. Ideally, I'd like to implement and distribute my own option with the following formula:

t = dot(v, axis)
v' = b(t) + rotationMatrixBetween(axis, b'(t)) * (v - b(t))

Where v and v' are input and output vertices, respectively, and b is the cubic Bezier curve function. This has the effect of rotating every vertex by the same quantity that the associated Bezier tangent is rotated from the chosen axis, giving a relatively stable animation.

So the question is, is it possible to implement an additional Twisting Mode as an addon to Blender? (Using the formula I described, ideally.) Or, is there a better alternative to achieve what I want? I'd like to export models consisting of simple shapes deformed by animated Bezier curves for the project I'm working on, and the formula I described is the one that I'm using.

Things I've checked or investigated:

  • Both the model's and curve's origin are at (0, 0, 0).
  • I've attempted all three twisting modes with every combination of "Bounds Clamp" and "Stretch", all with the same issue (understandably.)
  • Browsing the source included with the release distribution hasn't been terribly enlightening for my use case. A full search reveals a twist_mode being set from the UI and in an import script, but not where it's used.
  • I could swap to a standard skinning approach as a last resort, but it's far more meticulous to create content with than what I'm wanting (which is, "ridiculously simple", Blender integration issues hopefully notwithstanding.)

UPDATE: Here's the packed blend file, as requested.

UPDATE AGAIN: browsing the actual source (now that I've found it) reveals an entirely C implementation of twisting that can't be extended without recompiling Blender (assuming bevel-handling code in curve.c handles all twisting, bevel or no. I believe it is.) I believe "Minimum Twist" without correction for the first point would work well enough for me, if I could change it! Otherwise, maybe there's some way into tricking Blender to not correct for the first tangent in the curve?

  • $\begingroup$ can you attach an example blend file ( i think people will back off helping to avoid recreating the scenario to start experimenting ) $\endgroup$ – Chebhou Jun 10 '15 at 14:33
  • $\begingroup$ Thanks for the suggestion, link is now included. Yeah, I figured this is asking a lot. $\endgroup$ – Philip Guin Jun 10 '15 at 22:35
  • $\begingroup$ Maybe try different initial obj rotations in the curve like 0,90,0 and so on. $\endgroup$ – ZanQdo Jun 11 '15 at 2:05

It is doable as scripting, probably using to_track_quat way.

but an easier way is to use Animation Nodes ad on. That is a visual / nodal scripting tool really.

There you have a set of spline tools to deal with bezier from creating to extracting data in any way. More than usual Blender tools.

Specifically for this orient/twist situations, there is a Direction to rotation Node that turns 2 vectors into rotation. Unlike the Blender "Z up" to track quat , it provides a second "guide" direction that can be related to anything. (I redesigned that node precisely for these problems)

In the example file, one orientation (Z) is the tangents, the other (Y) is controlled by the empty in the back.


Here's a file with a possible setup do do what you need. spline deform AN

You need Animation Nodes to make it work.

enter image description here

A very basic setup, cause you can further combine or animate those too. Or, for example may deform only the points closer to spline, not the far away (as xy here) or vary the second rotation along the spline etc.

| improve this answer | |
  • 1
    $\begingroup$ I can't get the node tree to work with A.N 2.0. Can you update your answer ? $\endgroup$ – ChameleonScales Aug 28 '17 at 13:00
  • $\begingroup$ Sorry for the very late accept, this looks extremely nice. Will try it out once I've changed gears, thank you! $\endgroup$ – Philip Guin Aug 29 '17 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.