PDA

View Full Version : Non flipping Shoulder/Bicep twist -> Help needed, please!


Whistler2k
12-08-2008, 05:49 PM
Hello everyone.

I'm currently rigging several characters in Maya.
Everything is working great, the only thing I just can't get worked out is a non flipping shoulder / bicep twist (same for the Thigh). I've tried several methods, like for example point constraining a joint to the upper arm joint and then connecting the Y and Z rotations to the arm, or parenting it under the arm and then in Hypershade apply a multiply divide node andmultiply the x rotation by -1.
I tried using an aim constraint, and even had a setup where I would use a locators rotation as upvector and set driven keys on it, but although this helped a little, the problem remains ... as soon as I get close to gimbal lock (which obviously ca't be prevented for every possible pose) the setup goes haywire.

I've searched the net for a solution, and I've found a few threads with people who have one, but the threads are closed and the solution wasn't made public, or the old files are gone.

I hope some of you know of a way to couter the flipping problem and are willing to share, or even give me a hint in the right direction.

Any help is greatly apreciated.


I'm attaching two really simple versions, just to demonstrate the problem ...

MolemanSD7
12-08-2008, 06:03 PM
If you're familiar with the ribbon spine setup, you can follow along with this:

http://animandmel.blogspot.com/2007/11/so-heres-ribbon-spine-i-rigged-up.html

Its something I wrote, that augments the abilities of the ribbon spine to allow for twisting beyond 360°. That may help...never tested it in production though.

mberglund
12-08-2008, 08:38 PM
What MolemanSD7 wrote should do the trick. But it really depends how you setup your arm joints. make sure you are getting clean rotation values. sometimes orient constraints give values between 180 and -180 causing stuff to flip unexpectedly. Even if you use an augmented ribbon spine but are giving bogus values it will flip.

Whistler2k
12-09-2008, 07:06 AM
Thanks for your quick reply, Moleman. I guess I'll first figure out how your setup works, as i don't have the Fahrenheit DVDs, and it seems their shop is down at the moment. I'm still a little unsure on how I would attach this setup to the shoulder but I'll play around with the idea for sure and if I come up with a solution, I will of course post it here.

@mberglund:
What do you mean by giving false values? Would you use something different than Orient constraints?

Thanks for you help,

Alex

mberglund
12-09-2008, 01:22 PM
I use the blender node. It will take the rotations of joint A and the Rotations of Joint B, blend them together and put the result into joint C. You do this through the connection editor or hypershade. here is a link to sean Nolan's website, he has a good video to show how to set this up. http://www.snolan.net/2008/01/07/29/

MolemanSD7
12-09-2008, 07:23 PM
Right-on! I love Nolan's site. Its really inspired me and given me some good ideas for things in the past. I just wish he'd post more....

Whistler2k
12-09-2008, 08:25 PM
Yeah, I understand the concept, and I think I could rig up the spine setup you're talking about (wich is something I'll do next, as ist relly looks powerful).

I just seem to not be getting the connection to my problem. What I want to to is to have the first twistbone on the Bicep to not twist at all (in x, assuming x is pointing down the joint), no matter how I rotate the upper arm, the shoulder should always be pointing up, or if the arm is on the side of the body, be pointing to the side.

What I have is that it either flips over when I rotate past 90 degrees down, or front. There must be a way to fix that, right?

Thanks again for all the great info so far!


-Alex

mberglund
12-09-2008, 09:00 PM
Yeah, i understand. The answer is a much sought after. The link I posted is for a spine but it can be changed for an upper arm twist and forearm twist without flipping.

Here is a post that has a lot of good discussion http://forums.cgsociety.org/showthread.php?f=54&t=451463&highlight=shoulder+roll.

Aaron Holly's DVD's has a ribbon spine solution for the arms, that works really well. If i remember correctly he connects the rotations of the upper arm to ribbon joints and uses a Multiple Divide node to multiple the rotation by incremental values. the first joint, the one nearest the shoulder, he muliplies by zero so it never rotates, the rest are .25, .50, .75 to get the distributed twisting.

MolemanSD7
12-09-2008, 09:11 PM
I remember following that thread, but it still seems scarce on details. I couldn't even clearly decipher the high level concept he was mentioning...how to avoid gimbal altogether. From the video, it just looks like he's rotating in local space. Berglund, can you clarify his concept?

Whistler2k
12-10-2008, 06:51 AM
Thanks for the link!

Yeah, I figured some people were looking for a solution. I think I might be on to something that would work for me. I'm at work right now, but I'll put up a file when I'm back home.


Cheers,

Alex

mberglund
12-10-2008, 01:25 PM
I've been trying to figure out what Victor uses for non-shoulder roll, so far I can't say. I think he is rotating in local space but has something else that is driving the twist. All i've come up with is something similar to Holly's ribbon spine, without the ribbon part, and it works well for me. The distributed twist from the shoulder to the elbow.

Whistler2k
12-10-2008, 07:57 PM
Hello and thanks again for your replies!

I think I might have come up with something close to a solution for my problem. Again, I first want to get more control over how the first bone in my bicep twist setup twists, then take care of the remaining twistbones. (lots of twists for one sentence ;))

With a normal setup where I try to eliminate the twist of the first twistbone (by for example connecting the Y and Z rotations to the driving UpArm bone and leaving the x blank etc.) I get a flip when the system either rotates 90° from the TPose to the front/back OR up/down, which is of course sogical as we hit gimbal lock. BUT, you might want to have your characters Arms swing down a bit more than just straight down or front, and if your bone flips 180° at that moment it might look really weird.

I've tried and tried to get around that by using set driven Keys, or expressions that, based on the UpperArm joints rotation would do something to the first twistbone but nothing worked ... of course, because i was relying on the rotations, which get sort of unpredictable when I hit gimbal lock.

Now what if I didn't rely on rotations at all for the joints twist?

So I've come up with this partial solution(which is probably nothing new and far from perfect, but I didn't think of it before and i though maybe it would be a nice starting point for people with the same problem) :

I create 2 locators at the position of my bone and freeze their rotations. One of them ( loc_Aim ) I move down the arm (like to the elbow) and parent constrain it to the UpperArm, the other one I move slightly up. Then I Aim Constraint the first twistbone to the loc_Aim ans use the other one ( loc_UpNode ) as upnode.

This gives me a system that works alright, but flips around the y axis if aiming straight up or down.

Now, to prevent that I looked at how I want my joint to be oriented at different Arm poses. Here comes the tricky part I haven't cleaned up yet, as i might try to work some conditions in here to get nice and clean poses all the way. But for now I continued by writing an expression for the loc_upnode, that alters its x position relative to the loc_Aim's position in Y (and again, that's just a start).

This gives me relatively clean predictable results and the system flisp only when the arm would already stick deep in the body ;)

i hope this makes senese somehow, I basically try to control the different stated of the joint, by looking at the quadrants the loc_Aim is in.

the expression I used is this:



loc_UpNode.translateX = loc_Aim.translateY* (-0.1)



I'm attaching the test file for you to check.

I'll try and play around with that a bit more. Also, next on the list is getting something like your awesome spine (@ mberglund) in there, to prevent the rest of the twistbones from flipping.

Looking forward to your feedback,



Alex

mberglund
12-10-2008, 09:08 PM
I quickly messed with your file. A better way to fix the upNode flipping would be to do this.

1. duplicate the upArm joint, and delete children.
2. connect the upArm ry,rz,tx,ty,tz to upArm_dup
3. break the expression on the upNode, and parent to the upArm_dup.

It seems to work well for this example, i'm curious to see where you take this. Good start so far!

c000be
12-18-2008, 08:57 PM
if you're using a regular IKrp setup, put a locator just outside the elbow skin section so you can grab after skinning, shift-click the IK node, Constrain - pole vector

hope this helps. learn about constraints. interesting stuff.

now can someone tell me why there's only ONE spine node seemingly available for use in FBIK. more than a little annoying, or am i missing some really big secret in assigning names to the skeleton? can't find that info a-n-y-w-h-e-r-e.

mberglund
12-19-2008, 03:24 PM
Here is a playblast of my non-shoulder roll and bicep twist solution. The first segment of the cube would (the one closest to the shoulder) doesn't roll at all but the joints further down the arm do. The arm setup is a simple three bone, fk/ik switching. Whenever i test a new twist distribution setup i always apply it to a switch setup to make sure it works correctly.

Whistler2k: Is this the type of solution you were looking for? or did i miss the point entirely. (...it happens sometimes...)

http://faithofthefallen.wordpress.com/non-roll-shoulder-setup/

ShadowM8
12-22-2008, 10:12 AM
Alex that’s a nice solution to get a zero spin rotation. It would be a bit difficult to propagate the blend further down the arm with the same degree of precision with this setup though and of course there’s the issue of crossing the up vector plane but in general could be a handy setup in a lot of cases.

mberglund it would be interesting to see another capture with a more complicated range of motion test. If the shoulder roll is based on your spine setup than I could see of a few cases where it would have unstable behaviour seeing as you ultimately get your spin from the local X Euler value.

There's really no easy solution for this problem. It's been a pet peeve of mine and I've been researching possible solutions for a while now. I've ended up writing my own custom constraint that decomposes the quaternion rotation into direction and spin allowing me to apply either of those elements individually or combine them as I see fit. Because I am using a dot product in my calculations to figure out the angle of the spin I only get 360 degrees of freedom (-180 / + 180) but I am working on a solution to make it 720 and more. Most likely I would have to perform some sort of a cash though similar to Maya's No Flip constrain option to achieve this degree of freedom.



I'll post a play blast of the result sometime tomorrow.

Cactus Dan
12-28-2008, 05:27 PM
Howdy,

Well, I don't know how you'd set this up in other applications, because I use my own rigging plugins that I've developed for Cinema 4D. But, the solution I use to keep that first joint at the shoulder stable works pretty good. The way I set it up is using 2 aim constraints, one on the first joint of the twist chain, and the other to control the up vector of the first aim constraint.

For example to set it up for the left arm:
First, I set up the second aim constraint on a dummy object just above the right shoulder, which targets the right shoulder and has the left elbow as its up vector. The reasoning for this is that in a biped character the left elbow would never cross over the position of the right shoulder. Go ahead, try to touch your right shoulder with your left elbow. It can't be done! :D

So now the aim constraint above the right shoulder is stable. It will never flip because its up vector will never cross over its position. Its up vector (the left elbow) will always be on the left side of the dummy object.

Next I add an aim constraint to the first joint of the twist chain on the left arm and have it target the left elbow and use another dummy object for its up vector. This second dummy object is parented to the first dummy object above the right shoulder.

Now the up vector for the first joint in the twist chain of the left arm always moves with the left arm, and since it's located above the right shoulder, it will never cross over the target (left elbow) for the aim constraint on the left arm's first twist joint. :)
http://www.cactus3d.com/NoFlipShoulder1.mov

As I mentioned, I don't know how you'd set that up in the application you use, though. :blush:

If you give it a try, I'd be curious to know how it worked out for you. ;)

Adios,
Cactus Dan

NolanSW
01-03-2009, 02:34 AM
Right-on! I love Nolan's site. Its really inspired me and given me some good ideas for things in the past. I just wish he'd post more....

Yea, yea, I know. Hard to post anything new when I don't use Maya on a regular basis. But glad I've been some help to stir up new ideas :thumbsup:.

Great topic here. One thing I do that is pretty simple with the shoulder is to dup the shoulder joint, delete the children and call this new joint something like shoulder_notwist. Connect the shoulder rotate channels to the shoulder_notwist channels EXCEPT for the channel that twists. Transfer the weight from the shoulder to this new joint and then start smoothing it out to distribute the weight down the bicep. Now you have two joints there to distribute the weight across the shoulder.

-Sean

ShadowM8
01-04-2009, 09:22 AM
I promised a capture so here it is. I just have the shoulder doing some of the arcs that would more often then not screw up your roll joints. The roll is propagated properly starting from zero spin at the top of the shoulder joint.

The setup is as simple as applying a constraint to the roll bone and choosing a few options.

Capture Link (http://www.sergueik.com/downloads/Shoulder.swf)

mberglund
01-04-2009, 02:40 PM
ShadowM8: When the arm is to the side parallel with the body and rotates forward, why does the bicep twist?

ShadowM8
01-04-2009, 08:16 PM
Keep the eye on the palm, if the motion of the arm is down to the side then up in front of the body there is a 90 degrees of rotation around the spin axis introduced as evident by the palm no longer being flat to the floor. Thus the roll joints compensate for it.

Mydrako
01-05-2009, 06:30 AM
I am also researching on how to solve this rather tricky problem. I came up with a simple solution and it seems to work somewhat like what ShadowM8. My idea is have a floating joint that is point constraint to the upper arm joint. It is aim constrainted to a locator point constrainted to the elbow. I have a another locator (lets call it upVectorParent) point constraint to the upper arm joint and this locator have a child locator a few unit up in the y direction. the child locator serve as a up vector for the aim constraint. I use a couple of locators to create a vector that point down and then i find the dot product btw this vector and the vector running along the upper arm. I use the dot product to adjust the upVectorParent such that it rotate down by 90 degrees with the arm vector is the same as the down vector. ( meaning when the arm is pointing down, the aim up vector is pointing to the side. There are some angle when the up vector will flip is the 90 degree btw the 2nd and 3rd quadrant, when u consider a counter-clockwise rotation, but ur arm can twist to such angle so i think this setup should be relatively safe.

Lets hope this make sense and please comment on its feasiblity and usability.

AdamMechtley
01-12-2009, 03:52 AM
Hi there,

I just saw this thread after I made another post. I recently made a constraint that I believe does exactly what you are trying to accomplish. Please see my other thread for download info

http://forums.cgsociety.org/showthread.php?f=54&t=717380

Hope it does what you need!

Whistler2k
02-17-2009, 02:29 PM
Sorry guys, I was off the net for some time and will have to catch up with all of your posts ..
Seems like some new info has come up, which is awesome ... Thanks a lot!

I'll drop back in ;)

mberglund
04-02-2009, 06:13 PM
Howdy,

Well, I don't know how you'd set this up in other applications, because I use my own rigging plugins that I've developed for Cinema 4D. But, the solution I use to keep that first joint at the shoulder stable works pretty good. The way I set it up is using 2 aim constraints, one on the first joint of the twist chain, and the other to control the up vector of the first aim constraint.

For example to set it up for the left arm:
First, I set up the second aim constraint on a dummy object just above the right shoulder, which targets the right shoulder and has the left elbow as its up vector. The reasoning for this is that in a biped character the left elbow would never cross over the position of the right shoulder. Go ahead, try to touch your right shoulder with your left elbow. It can't be done! :D

So now the aim constraint above the right shoulder is stable. It will never flip because its up vector will never cross over its position. Its up vector (the left elbow) will always be on the left side of the dummy object.

Next I add an aim constraint to the first joint of the twist chain on the left arm and have it target the left elbow and use another dummy object for its up vector. This second dummy object is parented to the first dummy object above the right shoulder.

Now the up vector for the first joint in the twist chain of the left arm always moves with the left arm, and since it's located above the right shoulder, it will never cross over the target (left elbow) for the aim constraint on the left arm's first twist joint. :)
http://www.cactus3d.com/NoFlipShoulder1.mov

As I mentioned, I don't know how you'd set that up in the application you use, though. :blush:

If you give it a try, I'd be curious to know how it worked out for you. ;)

Adios,
Cactus Dan


So i tried what you were decribing and I think it works well. I did it in Maya and Max. Im going to keep playing with it some more but so far its cool.

Whistler2k
04-02-2009, 08:37 PM
Hmm!

Maybe I'm just too tired today, or I just don't understand it .. ;) I just can't get Cactus Dan's version to work predictably! Could anyone post up a max or maya Version of it? Just if it's not too much trouble. I probably just overlooked something, just want to try it out!

Cheers,

Alex

eek
04-03-2009, 04:22 AM
To AdamMechtley, Shadow & myDrako,

Great minds think alike! - i think were basically saying and describing the same thing. Your using a dot product to describe a rotation in hemispherical space i.e a quaternion - this is primarily how our shoulders work. Our wrist work in a similar manner but, and the crucial but imo is that there's a rotation caused by the bones and a deform caused by the muscles, a rotation on top of a rotation with both residing in the same quat space.

The key is twist is the resolution of direction, and the spin about this direction is the restitution of this twist. So directing the upper arm down and forward brings about a twist - its has to else the arm would be torn off. The spin of the upper arm i.e rotating about its pointing direction returns or unravels this 'directed' twist.

As for going beyond 180 im looking into it also, ive got -360 to +360 working in a standalone system using a dirac method, but applying it to this is tricky. Some sort of cached thing im guessing.

Cactus Dan
04-04-2009, 02:58 AM
Howdy,
So i tried what you were decribing and I think it works well. I did it in Maya and Max. Im going to keep playing with it some more but so far its cool.
If you get it working in Maya, can you post an example? I only have Maya PLE but I should be able to still load the file, and I'd be curious to see how it's working there.

The method works well using my rigging plugins in Cinema 4D, and it's really stable because there are no rotational calculations needed:
http://www.cactus3d.com/NoFlipShoulder2.mov

Adios,
Cactus Dan

Cactus Dan
04-15-2009, 03:23 PM
Howdy,
Maybe I'm just too tired today, or I just don't understand it .. ;) I just can't get Cactus Dan's version to work predictably! Could anyone post up a max or maya Version of it? Just if it's not too much trouble. I probably just overlooked something, just want to try it out!
After some testing, I think I may have figured out how to set it up the same way in Maya PLE:
http://www.cactus3d.com/NoFlipMayaPLE.mov

The box was just parented to the no flip joint for a visual reference.
I'm not sure if Maya can open Maya PLE files, but I've attached the file anyway.

Adios,
Cactus Dan

Whistler2k
04-20-2009, 12:37 PM
Hey!

Awesome! I just rebuilt your setup and it seems to work just great. I kind of does the same as my Expression setup on the first page, but is way more simple!

Thanks a million!

Cheers,

Alex

Cactus Dan
04-20-2009, 03:19 PM
Howdy,
...Awesome! I just rebuilt your setup and it seems to work just great. I kind of does the same as my Expression setup on the first page, but is way more simple!

Thanks a million!...

You're welcome.

I've found that trying to create expressions involving rotational calculations can be very frustrating, simply because of the nature of 3D rotational math, with which mathematicians have been struggling for centuries. Many of the same tasks can be performed with an aim constraint, and the setup can sometimes be simpler and more stable. ;)

Adios,
Cactus Dan

WhiteMage
06-30-2009, 08:44 PM
I'm interested in seeing a 3dsmax version of it. I can't seem to make it work right.

thanks!

Cactus Dan
07-13-2009, 03:26 PM
Howdy,

OK, I went to visit a buddy of mine who has 3DS Max and explained the setup to him. Together we were able to get a working example, so I had him email the file to me. ;)

Adios,
Cactus

WhiteMage
07-13-2009, 10:13 PM
Hi Cactus Dan!

Thanks a lot for the file. Actually, I was able to do it, a week or two ago. I posted an example on that other thread: http://forums.cgsociety.org/showthread.php?f=54&t=778773.

I thought that since I had it working right you just didn't bother to reply :p

thanks again! :beer:

Cactus Dan
07-13-2009, 10:47 PM
Howdy,

DOH! I missed your reply in that other thread. :blush:

Adios,
Cactus Dan

phoelix
07-14-2009, 01:22 AM
Hi guys,

another way that i found to deal with that flipping issue was removing the rotation value of the x axis, but using the value of the third axis to avoid the flipping.

generally the twist bones are done by removing the value of the x axis, taking the rotation (that is a quaternion) and converting it to euler angles, but setting the x axis to zero will cause flippings in some angles, specifically, when the y axis value goes avobe 90 degrees or below -90 degrees of rotation. that happens because an euler rotation got from a quat never has a Y value greater than 90 or lesser than -90. to get an orientation that takes the y axis beyond 90 degrees the y value will go backwards, the z axis will flip (will rotate 180 degees) and the x axis will flip as well (to compensate the flip). If the x value is removed there wont be anything that compensates the flip made by the z axis when the y rotation goes beyond 90 degrees.

i initially tryed using the z axis value to compensate the flip made by itself storing it in the x axis, but that is not the way to go cause i didn't want the z axis to affect the x orientation of the node.

what i finally did was using another axis order while converting the rotation from quat to euler, the theory is the same for any order: the second axis can't go avobe 90 degrees neither below -90 degrees, the other two axis will flip when that is required.

the order that i used was XYX (X compensates itself to avoid the flip :twisted: ).

anyway a flipping is impossible to avoid totally in these cases , unless you use some sort of cumulative rotation (doesn't sound good actually), or if you can get the euler rotation directly (using an euler controller in the arm, but that never happens because the arm will always have some quat/matrix setup like an IK solver).

but with this method the flip will occur when the arm get overlapped with the shoulder, something that doesn't happen frequently :D .

i have achieved this using other methods, like using a lookat built up with a quaternion but the result is the same.

there's an example attached (but was made in 3ds max)

Dimich
07-14-2009, 08:44 AM
Interesting stuff guys. But I have a question. I have done the same non-flipping shoulder using just the wire-params to the rotations of the upper arm (see attached file) It doesn't flip, and it doesn't require anything in terms of scripting or other methods. Am I missing something about what you guys were trying to do?

I should also add that I noticed in both set-ups that the shoulder would flip when the arm is about 45 deg. downwards from the shoulder, and if you try to rotate it 180 in world coords, the shoulders would start flipping upwards.

phoelix
07-14-2009, 12:41 PM
thanks Dimich for your reply :D

That setup can only be done if the arm has an euler controller and doesn't have any setup, so if you have an arm with an ikSolver you wont be able to wire that anymore.

in both rigs the twist bone rotates in the x axis when the arm is closer to the shoulder and the arm is rotated over the world x axis, actually that is the way that it should behave. In the case of cactus rig (nice method by the way) the twist bone that is a box should always look to an oposite direction of the armpit. If the arm is above the shoulder, the box should stay between the arm and the shoulder. If the arm is below the shoulder, the box should be looking downwards staying below the arm. If the arm is in front of the shoulder the box should be looking upwards.

i should give a closer look at my file , haven't seen any flip around 45 degrees of the shoulder

Dimich
07-14-2009, 12:49 PM
Well, in the set-up I made, all you need is an exsposeTM to get the rotations of the upper arm if you are using IK. Check the included file to see the result. And in terms of the way it works, is that not what the wire params in my file did?

phoelix
07-14-2009, 01:02 PM
in that case the flip will occur when the y axis rotation goes above 90 degrees or below -90 degrees, and that ' s because the expose tm helper uses a quat to euler operation to find out the local rotation values.

i think that this method should be useful in the forearm twisbones, because the hand usually doesn't have any iksolver on it.

Dimich
07-14-2009, 02:05 PM
Ahaaaaaa, ok, nice, now I get what you guys were going for. Cool, I will see if maybe I might have two cents to input into this:) Cheers, thanks for clarifying!

CGTalk Moderation
07-14-2009, 02:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.