PDA

View Full Version : IK always perfectly matched to FK, is it possible?


r4inm4ker
05-24-2010, 07:22 AM
Hi,
I'm pretty new to rigging / character setup things, and currently being asked to write a script that matched IK/FK joint positions. Matching FK to IK is a pretty trivial thing(it's about transferring the rotation of IK joints to FK), but IK to FK is quite problematic for me, because I could not directly rotate the IK joints or controllers to match FK ones.

I know that there are scripts out there to do this kind of stuff, and from all I've seen, it involved matching the position and rotation of IK wrist handle to FK wrist joint, and matching the position of pole vector controller to FK elbow joint. Now the problem is that the resulting shapes often didn't exactly matched the FK result, particularly the elbow rotation part.

the video below should clearly show the problem i described:

http://www.youtube.com/watch?v=rzWJHp_QJ3U (http://www.youtube.com/watch?v=rzWJHp_QJ3U)

The rig above is using 3-skeleton setup, and i tried to matching the IK joints to FK joints by using the procedure above. Is there any additional stuff I need to calculate in order to achieve perfect matching, or I need to use more controller / different setup to achieve it?

thanks,
Jefri.

JasonJune2009
05-24-2010, 08:54 AM
出現這個問題的原因是IK出了問題,完成IKFK綁定後骨骼的旋轉屬性必須為0,當被ikhandle極向量約束的時候如果發現ik joints有跳動,就將極向量約束刪除(不是undo),然後將極向量控制器P給ik shoulder骨骼,

接著將ik shoulder的骨骼的rotate屬性手動設置為0。然後選擇極向量控制器,按shift+p。接著手動將極向量控制器的rotate全部設置為0,然後freeze transformations,讓後再去約束就不會跳轉了,這樣可以實現完美的無縫。記住只要shoulder有初始rotate不是0,ikfk的轉換將不會完美。

sdserbos
05-25-2010, 01:29 AM
และอย่าลืม sholder

r4inm4ker
05-25-2010, 02:18 AM
Jason:
Yes, my initial rotation values of all 3 skeletons are 0. For your other explanation, i'm not sure it is in some way related to IK -> FK matching. If so, please enlighten me (preferably in English, so others could also contribute).

Serbos:
Well, I didn't understand Arabic, or Russian, or whatever the characters are from :).

julSan
05-25-2010, 04:23 PM
This happens to me when either the rotation orders of the controllers/joints don't match or the fk forearm joint is rotated in an axis other than the preferred angle. I also seem to recall a similar bug in my ik/fk switch which had something to do with matching either world space or object space rotations. For my rig, the forearm fk joints had to be matched to the object space rotations of the ik forearm while the upper arm and wrist were matched to the world space rotations of their counterparts. Ik/fk switching was the very first thing I did using mel, so I could be off.

JasonJune2009
05-25-2010, 04:30 PM
the initial pose of the arm must not be horizontal,right?

it depend on the place that the poleCtrl in...

you can try to lock the ikElbowJoint.rz(maybe .rx)....

Garciaone
05-26-2010, 03:19 PM
From what i can see that setup for IK/FK Matching should work, try creating a quick three joint arm setup and just making sure everything is clean and precise.

pritishd
05-26-2010, 04:15 PM
From what I can tell from your video, it seems your joint orientation for your FK skelton and IK skeleton seems different.

You check this by opening the attribute editor and scroll down to the Joint Orientation part.

I think that's the reason why your FK is matching up perfectly because it is compensating for the offset in the joint orientation, but the IK is unable to do when you are trying to go back.

Also if you want a perfect joint orientation, it is usually recommended to put a rotate limit on all the axis on the elbow joint, except for the axis that is facing towards the wrists. Elbows in reality can only twist in axis anyways.

r4inm4ker
05-27-2010, 02:19 AM
From what I can tell from your video, it seems your joint orientation for your FK skelton and IK skeleton seems different.

You check this by opening the attribute editor and scroll down to the Joint Orientation part.

I think that's the reason why your FK is matching up perfectly because it is compensating for the offset in the joint orientation, but the IK is unable to do when you are trying to go back.



The orientations are identical, because the joints are copied fromt the main joints.


Also if you want a perfect joint orientation, it is usually recommended to put a rotate limit on all the axis on the elbow joint, except for the axis that is facing towards the wrists. Elbows in reality can only twist in axis anyways.


if i indeed limit the FK elbow rotation only by the preferred axis and no more than 180 degree, than the IK managed to match FK. but if it's more than 180 degree, or in other direction than the preferred angle, than it failed to match. I think it's clearly illustrated by the video below:

http://www.youtube.com/watch?v=IVTTDU4IH0M


Is it normal to have this behaviour ? or is there any other way to get the IK alwyas matched to FK(even if the FK elbow rotates in the direction other than preferred angle), by editing twist, pole vector controller, rotate plane (if possible), or adding more constraint ?

Thanks.

blackseraphim
05-27-2010, 09:25 AM
there are some issues with regarding to "seamless" ik-fk matching, one is the orientation and the other is the correct placement of the pole vector controller. for example your joint orientation is Z-up for the arm chain, it is important that the elbow joint's joint orientation has only 1 value which is Z, and for the rest the orientation of X and Y should be zero.
Correct placement of the pole vector controller means that your IK joint chain (particularly the shoulder joint) has zero values(meaning the rotation values has zero even if the precision on your settings at the channel is 15).
I make it to the point that i keep my IK joint clean so that setting up an IK-FK would make it easier and avoid future problems.
Go to Sean Nolan's site and watch his video on IK-FK snapping. He did explained the importance of the joint orientation and the correct placement of pole vector controller.

Hope this helps.

r4inm4ker
05-28-2010, 09:42 AM
Peter, thanks for the tips. I've checked my joint orientations and in fact they're zero-ed out and aligned except the preferred axis which is y. And my IK -> FK snap does worked, but only on limited angle ( 0- 180 degree) which is normal for an elbow, but i'm afraid if I encountered an unusual character which rotates his elbow more than 180 degrees or rotates in other angle, then my current setup will not know. So i would like to know if this indeed is the limitation of current RP-solver in maya IK system, and if there's any workaround to make those rotations work.

Garciaone
05-29-2010, 12:26 AM
This is a limitation or more so the design of the solver. Im sure you could over come it if needed. Possibly using a layered joint chain. But more likely is that it would be rare for you to come across it and if you did a standard 3 joint arm chain probably would'nt be the best approach.

r4inm4ker
06-02-2010, 02:41 AM
Thanks for the insight. So I may conclude that this indeed is the limitation of Maya RP IK solver, not any incorrect calculation in my script. Is there anyone who has done some workaround to solve this problem, either by using other rigging approach or hacking/implement own IK solver ? or this is non-issue in most production stuff?

JasonJune2009
06-02-2010, 04:06 AM
if a transform node has two shape nodes , shapeNode1 shapeNode2, then how to change place.
in maya 2009,when select a transform node,the first shapeNode is expanding by default.
in maya 2011,the last shapeNode is expanding by default.

axiomatic
06-23-2010, 09:22 AM
I seem to recall there's a detailed work around for this in Fahrenheit Digital's Rigging for Feature Animation tutorials.

Slight shifting can also happen when you don't have your joints all along a single plane. This would make sense since you'll be using the Rotate-Plane solver, and makes rigging characters who don't have their arms perfectly straight quite frustrating.

Darksuit
06-23-2010, 06:43 PM
Take a look at this post from last year. There are a number of older posts in the forum that talk about FK IK matching.

http://forums.cgsociety.org/showthread.php?f=88&t=812779


The biggest trick of course is getting the Angle of the Plane to slove correctly.
As noted in the above post you should be able to add a locator to the elbow, then it should just be a matter of snapping the Ik control to the FK Wrist Control and the IK Pole Vector Control to the FK Elbow Locator. That should solve most of the problems.

My only question is what are you attempting to get from all of this. If you are just looking to match move from FK to IK . Ok sure that great, But my suggestion here is don't get too hung up on this being the only solution.

If you have a 3 arm setup like this ( http://www.darksuit.com/tutorials -- FK/IK Stretchy Arm ) then you can simple match them close and just use the FK IK switch over a few frames rather than an fast 1 frame change. This Method allows for the smooth switch between the two (FK and IK). And again this is only one method of many. It really comes down to the end result that you are looking for and what your limitations are.

CGTalk Moderation
06-23-2010, 06:43 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.