Snake creature rig, all kinds of poses!

Hello there, fellow riggers/TAs.

I have been researching and looking for good ways to approach this situation for a while now, but can’t seem to figure it out, so i would love to request the use of the rigging/tech hive mind!

I have a snake-like creature, that will have about 50 bones along it, and needs to twist and twirl in all kinds of shakes and poses.
The ideal requirements are:

  • 11 main controls along the body (everything except head and tail has rotation locked)
  • drive the overall twist of the body with n(probably 2 for now) controls along the body, along with the tail and head controls
  • twisting the head control even past 180 degrees should correctly distribute the rotation along the body (or between the head control and the next twist control) without flipping anywhere
  • rig should be stable (this also includes not using constraints in the ‘No Flip’ mode)
  • non-stretchy
    … i think that should about cover the main goals…

I have considered a plethora of various approaches.
First off, examples online… Everything i found was something that has seemingly no range as far as ‘spline’ goes…
Snake/Worm/Rope rig? all such rigs/vids of rigs i found, are seemingly assumed to never make more than 20 degree turns and never twirl/loop/make a ‘poo’ pose, haha.
Tentacle? You’d think so, but no… haven’t found any good examples of a tentacle that would go loopty loop and twist and still be ok… if so, then the twist was divorced from the ‘tip’ control, making it extremely difficult to transpose to something like that snake, where you want ‘ik-like’ behavior on both the head and the tail.

While ribbon might be something that’s recommended, it is the last resort for me. I do not want the animator to worry about rotating every individual control immaculately. On top of that, ribbon can also result in flipping/weirdness, when you try to make various curved shapes, so avoiding for that reason too.

So i went to explore the possibilities that spline-ik would offer, thinking to go with some layered setup on top of it, but it became clear within seconds, that that’s not gonna fly (at least not with the default advanced twist - object rotation up start/end). Due to the nature of how rotation object up start/end works, the vectors flip the joints the second you hit a simple s-shape (as well as because in that particular mode, even in a straight line, the 180-twist-flip would occur).

There’s way more that i have tried, with various approaches to locators sampled along curve aiming at one another, to spline ik in relative mode, but then how to drive the twist with the head/tail controls accurately… I’ve played around with dissecting euler rotations to use them to my benefit (i genuinely think there’s something there, if only i was more versed at math and saw the pattern…) to no avail… etc etc…

I wonder if there is something obvious that I’m missing, or something that someone has found to be helpful/found out themselves, and would be kind enough to share?

To me, this is a curious problem to be solving, but i’m running out of time, as well as knowledge, haha…

Thanks for any input!

Maybe try out my TwistSpline plugin?
It interpolates position and orientation separately along the spline with the ability to “pin” either value at any control along its length, and it will smoothly interpolate this pinning. So an animator could easily pin the twist and position near the head and tail whenever they need the IK-ish behavior there. And then they could blend the pin off in the same shot without any popping.

For control structure, it’s simply a Bezier spline with tangents that you can blend between automatic, and manual as you see fit. And there’s a python script included that builds this basic structure.

This plugin has been the basis of all our tentacles, ropes, and chains for the past 4-ish years.

The latest github release is probably out of date, so I’d suggest compiling it yourself. I’m currently in the process of upgrading all of our plugins to auto-build on github, but I haven’t got to this one yet. If you can wait a couple days, I can probably get that working.

2 Likes

Thanks for the reply, tfox!
It’s nice for big name studios to share their built tools for sure! Thanks for that! I wish ours was more open to that…

Based on the gifs, i have just one question, prior to giving this a shot.
In the gifs, it seems like twist is controlled by the twist-sub controls alone, rather than the main controls (cubes). Is this where the pinning comes in?

Reason I ask, is i have pretty much the same setup I’m seeing on the gifs, as a base for a lot of our spline-needing rigs, but this time, driving the twist by the main controls (cubes in your gifs) of the root/tip, is the preferred method, that i was hoping to solve for…

That’s definitely possible. It’s as easy as adding an extra (0, 1) range float attribute to the main controller, and connecting it to each CV’s “useOrient” attribute. You’d do that around line 205 in splineBuilder.py

However, it can cause popping because I have to use quaternions which limits me to ±360 degrees.

It also adds extra cognitive load on the animators. In that case, not only do they have to worry about adding twist to the character, they have to constantly re-orient the main control to avoid gimbal lock. Even if it’s not completely locked, you get more pronounced non-linear interaction the closer you get to the lock. You have to choose between consistent interaction, or using a single control. I can’t think of a way to have both. It’s what we get for having to work in a space with an odd number of dimensions :wink:

My animators requested that I just remove the “useOrient” option from the rig completely because of that.

Also, this spline can be much more stable than any non-plugin based rig. I use rotation minimizing frames to make sure that there’s no gimbal lock in the twist calculated along the spline (like what can happen in ribbon based rigs). So you may be surprised at how much less your animators have to use the intermediate twist controls when using this plugin.

2 Likes

That sounds very intriguing… i will have to try for myself, to grasp fully what you mean, i feel.

i think i was onto something when i started to play with eulers during my research, and overcoming their intrinsic instability or rather try to use it to my benefit, but then i was blindsided by a couple things. i still think something’s there… i might have a think over the holidays, hah.

in the meantime, i shall try your proposed solution. let’s see how far i can get with it.

thanks for now!

Well this came back to haunt me then, the latest build is indeed for 2018. Out of office until the 9th, and only got 2019.5 on me here.
I wouldn’t know the first thing about compiling a C++ plugin, so i’ll see if i can figure that out tomorrow. How hard could it be, eh? Need to learn at some point anyway.

I’ve hopefully made it really easy. Just download/install the latest Cmake (make sure you check “add it to PATH” during install), and the latest community version of Visual studio. Edit mayaVersion.bat to set the maya version and compiler, and double-click.

Type cmake --help into cmd, and it will list all the “Generators” near the bottom, and that’ll have the correct string for the mayaVersion.bat COMPILER variable somewhere.

2 Likes

That was very helpful, thank you, good sir!

After that batch file generating the vc project, i was able to build the plugin from vc itself.

I had a chance to play around with it a bit today, and I also understand now, what you meant in your previous message. Dots have been connected. The problematic behavior I’m seeing with the useOrient flags on the CVs on 1.0, is actually the very one i was hoping to find a solution for…

The stability and speed of a C++ plugin cannot be denied though. While i have virtually the same level of a solution for our spline-based rigs, i have not yet turned it into a python plugin version of it (that’s usually the case at our studio - i or one of my guys do the proto in python, and if it merits a C++ version, ask for it to be converted to an mll by the more C++ savvy humans, hah).
It is through research into this problem, that I finally wanted to put something in the form of a plugin, if i was able to find a solution for this particular issue…

I shall keep the research going… There must be something that will make the animators’ lives even easier…

Appreciate all the help though! I will have a look at your plugin in more detail throughout the holidays, to feed the unhealthy obsession with problem solving while on a break, lol.
I’ll try to keep this thread in mind, should i find something of interest…

Thanks again tfox, and happy holidays!

Unfortunately, I have a very strong hunch that you mathematically can’t have a solution based on a single input matrix per CV because we’re working in an odd number of dimensions. In a REALLY broad sense, whatever you come up with will necessitate pairing 2 of the 3 axes of the CV’s matrix, leaving one left over that just gets in the way.

So instead of looking for a clever way to interact with one matrix, I would suggest coming up with some other completely different method of interaction. For instance, a hotkey you could hold that would direct your input to the twist value. Or maybe a custom MPxManipulatorNode.

And glad to help!

2 Likes