PDA

View Full Version : FK/IK seamless switching in 3ds max 8


maxflame
03-01-2006, 04:28 AM
How can i setup a leg and arm rig to be able to switch from FK-->IK. I was told i could wire their weight to a slider but don't know how to go about the process. I'm new to rigging and would like some detailed help please.

eek
03-01-2006, 05:41 AM
many methods for ik/fk:

blended method:

1*ik chain
1*fk chain
1*deformer chain

This is where you blend the deformer chain between the ik-fk with a slider. Also you have buttons for matching the fk to ik and ik to fk.

Seamless Snap method:

Same as above but you handle the blend and aligning all in one go - you end up with two keys. It snaps the fk<->ik seamlessly.

im guessing you mean the classic three bone method, basically you make 3 chains one fk, one ik and a defomer chain. Then you put an orientation constraint on the deformer chain bones between there corresponding fk and ik bones. Then you control the constraint value with a slider.

On top of this you have two extra buttons for matching ik to fk and fk to ik. Fk to ik is pretty easy as its just three bones. With ik you also have a swivel angle so you need to make a fake swivel angle on the fk chain for the ik to snap to.

maxflame
03-01-2006, 03:00 PM
Thanks Eek for taking time out to help, i'm honoured.:bounce: BTW great face rig research you are having. Still waiting for you to be done.:thumbsup: But the problem i'm having is i don't know how to go about it. I afraid i need something more practical. If you have any link to an online tut i would be greatful. Bu if you can show me yourself that would be even great.

eek
03-01-2006, 03:41 PM
I'll make a tutorial for you tonight. A few questions - do you know how to make bones? constraints? and wire parameters? if not read up on theses today.

maxflame
03-01-2006, 06:52 PM
Yeah i can do all of what you listed.

AndreKling
03-01-2006, 10:27 PM
The auto aling thing always bugged me, i had no clue how to do that, would be great if you could adress it on your tutorial aswell. thnx
Andre

eek
03-01-2006, 10:36 PM
The auto aling thing always bugged me, i had no clue how to do that, would be great if you could adress it on your tutorial aswell. thnx
Andre

Aligning the ik to fk, yes its a handy trick - most people dont talk about this when building the rig its not hard to setup.

eek
03-02-2006, 12:22 AM
Fk/IK Blended method:

I will just use bones for this, you could add shape controllers and advise you do to hold the sliders and buttons etc.
Step 0:

In the top viewport create a helpers>point object name it "root".

Step 1:

In the top Viewport build a fk arm chain including the upper arm, lower arm and hand. With the names:

"fk_upper"
"fk_lower"
"fk_hand"

Make a helpers>point object, calling it "fk_lookat" select it and assign it a animation>constraints>position constraint and select the "fk_upper" bone.
Select the "fk_lookat" point object again and go into the motion>position>position>position constraint rollout press 'Add Position Target' and press the "fk_hand" bone.
Select the "fk_lookat" point object gain and assign it a animation>constraints>lookAt constraint. Select the "fk_lower" bone.


Create a new helpers>point object, show parameters rollout>display>box checked. Name it "fk_swivel" and align it both positionally and orientationally to the "fk_lookat" .
Select the "fk_swivel" point,change the 'reference coardynates' to 'local mode' and in 'move mode' move along the x axis the point away from the elbow. Link the "fk_swivel"
point object to the "fk_lookat" point object.


Step 2:

Copy this chain with the names:

"def_upper"
"def_lower"
"def_hand"

move it slightly down.


Step 3:

Copy this chain with the names:

"ik_upper"
"ik_lower"
"ik_hand"

Move it slightly down.

Run an 'HI' (history independant) iksolver from the "ik_upper" to the 'ik_hand" bones, call it "ik_control" .

Create a helpers>point object and place it away from the elbow. Call it "ik_swivel"

Select the ik handle (the blue cross at "ik_hand" ) and go into the motion panel>IK Solver Properties rollout>Ik solver Plane.
Click the 'None' button below 'pick target:' and select the "ik swivel" point object.

create a helpers>point object with the name "ik_hand_control" show>display box checked. Select the "ik_hand_control", in the heirachy>pivot>adjust pivot rollout press 'align to world'. Align the "ik_hand_control" point object to the "ik_hand" bone both positional and orientationally.

Select the "ik_control" handle and assign it a animation>constraints>position constraint, select the "ik_hand_control" point object.
Select the "ik_hand" bone and assign it a animation>constraints>orientation constraint, select the "ik_hand_control" point object.


Step 4:

Select the "def_upper" bone and assign it an animation>constraints>orientation constraint. Select the "fk_upper" bone. Select the "def_upper"
bone again and in the motion>rotation>orientation constraint rollout press 'Add orientation target' and select the "ik_upper" bone.

Select the "def_lower" bone and assign it an animation>constraints>orientation constraint. Select the "fk_lower" bone. Select the "def_lower"
bone again and in the motion>rotation>orientation constraint rollout press 'Add orientation target' and select the "ik_lower" bone.


Select the "def_hand" bone and assign it an animation>constraints>orientation constraint. Select the "fk_hand" bone. Select the "def_hand"
bone again and in the motion>rotation>orientation constraint rollout press 'Add orientation target' and select the "ik_hand" bone.


Step 5:

Select the "def_hand" bone, in the modifiers panel>modifiers list assign a 'Attribute Holder'. Select the "def_hand" bone again and open a new
maxscript>new script. Evaluate this code:



ikfk_ca = attributes ikfk_attribs
(
parameters ikfk_params rollout: ikfk_roll
(
'ikfk_blend' type:#float ui:ikfk_slider animatable:true
)
rollout ikfk_roll "IK-FK Options"
(
slider ikfk_slider "IK-FK Blend:" range:[0,100,0] ticks:0

group "Snap:"
(
button snap_fk "FK to IK" across:2 width: 65
button snap_ik "IK to FK" width: 65
)
on snap_fk pressed do
(
$fk_upper.transform = $ik_upper.transform
$fk_lower.transform = $ik_lower.transform
$fk_hand.transform = $ik_hand.transform
)

on snap_ik pressed do
(
$ik_hand_control.pos = $fk_hand.pos
$ik_swivel.pos = $fk_swivel.pos
)
)
)

custAttributes.add $def_hand.modifiers[1] ikfk_ca

Step 6:
Select the "def_upper" bone and go to animation>wire parameters...>transform>rotation>orientation constraint>orientation weight 0 then
select the "def_hand" bone and go to modifed objects>Attibute Holder>ikfk_attribs>ikfk_blend.

In the bottom left window type:

"100-ikfk_blend" then press the '<---' button and 'connect'.

In the top left window select the 'orientation weight 1' and in the bottom left window type:

"ikfk_blend" then press the '<---' button and 'connect' and close the window.


Select the "def_lower" bone and go to animation>wire parameters...>transform>rotation>orientation constraint>orientation weight 0 then
select the "def_hand" bone and go to modifed objects>Attibute Holder>ikfk_attribs>ikfk_blend.

In the bottom left window type:

"100-ikfk_blend" then press the '<---' button and 'connect'.

In the top left window select the 'orientation weight 1' and in the bottom left window type:

"ikfk_blend" then press the '<---' button and 'connect' and close the window.


Select the "def_hand" bone and go to animation>wire parameters...>transform>rotation>orientation constraint>orientation weight 0 then
select the "def_hand" bone and go to modifed objects>Attibute Holder>ikfk_attribs>ikfk_blend.

In the bottom left window type:

"100-ikfk_blend" then press the '<---' button and 'connect'.

In the top left window select the 'orientation weight 1' and in the bottom left window type:

"ikfk_blend" then press the '<---' button and 'connect' and close the window.


Step 7:

Parent the "fk_upper","def_upper" and "ik_upper" bones to the "root" point object.
Align these three to the "root" point positionally. Align the "ik_swivel" point to the "fk_swivel" point positionally.


Also this is in no way a an advanced setup, its just here to help you get off the start post.

AndreKling
03-02-2006, 01:32 AM
Hey man, thank you very much, i will start studing this very hard now. Do u know where i can find good information about professional rigs: Im from Brazil and its kinda hard to buy one of those dvd riggin sets, also most of the tutorials i found on the net doesnt say much about the roight way to create bones ( the alinging thing with the world orientation ).
anyway thank you vety much for your help.
Andre

3DQUAKERS
03-02-2006, 05:24 AM
Hi Andre,
Our upcoming RiggingPro will be available in download form sometime next week. You can already view a demo here: http://3dquakers1.com/webroot5/download.php?det=27
If you need more info, just let me know.

maxflame
03-02-2006, 09:35 AM
Thanks Eek! I really appreciate it. Now to go try it out.

metamesh
03-03-2006, 08:57 AM
EEk that was very nice from you, it's difficult to find good material about rigging for 3dsmax and it seems that a lot of people don't like to share this kind of information or something...i'm not really into rigging ( i'd like tho ) but i'm glad to see that there is people like u here! :)

IkerCLoN
03-03-2006, 04:05 PM
Thanks for explaining it so accurately, Eek ;)

Promineo
03-03-2006, 11:06 PM
Eek, thanks a lot man, you are great :)

BradT
03-13-2006, 01:50 PM
Hi Eek and all,

1st, thanks for posting this. I was about to sit down and try to figure this out myself just a few hours before stumbling on this awesome post. Has anyone actually tried Eek's instructions step-by-step? It's entirely possible that I'm misunderstanding or missing a step, but I've hit a snag with snapping Fk->IK. I think that the problem is in the maxscript line "$fk_upper.rotation = $ik_upper.rotation". Am I wrong in thinking that the IK bone's rotation isn't exposed because it's rotation is hidden by the IK solution? Maybe we need an exposeTM helper there?

Thanks,

BradT.

joconnell
03-13-2006, 02:34 PM
Try using the .transform property instead of .rotation - worked fine for me here.

joconnell
03-13-2006, 02:42 PM
Yup - all works fine here - bear in mind that transform will take scale position and rotation so is the quickest way to get all three. As regards the rotation of bones being hidden by an ik solver, it doesnt let you set the rotation of a bone with an ik solver but it does let you get it which is all you need for the snap.

eek
03-13-2006, 03:18 PM
yes, ill tweak the tut. Did transform work?

Transform.rotation is in world space so that should work

rotation.controller is local space infact all controllers are in local space except constraints which are additive.

BradT
03-13-2006, 03:26 PM
Woo hoo! Using .transform made it work here. Thanks Joconnel and Eek!

eek
03-13-2006, 03:26 PM
Great stuff - ill tweak the tut.

joconnell
03-13-2006, 04:31 PM
Go team!

:D

Assaultor
03-19-2006, 04:37 AM
Thanks eek for contributing the info.

I have one question in mind. The seamless snapping method compare to 3 bone method, what's the pros and cons? Lets take into consideration of the following situation.

1. Bendy arm is required.
2. Stretchy arm is required.
3. Both of the above.

The IK/FK snap in MAX doesn't provide that much of stability and accuracy when switching from IK -> FK or vice versa.

Thanks in advance. ^^

eek
03-19-2006, 05:49 AM
Thanks eek for contributing the info.

I have one question in mind. The seamless snapping method compare to 3 bone method, what's the pros and cons? Lets take into consideration of the following situation.

1. Bendy arm is required.
2. Stretchy arm is required.
3. Both of the above.

The IK/FK snap in MAX doesn't provide that much of stability and accuracy when switching from IK -> FK or vice versa.

Thanks in advance. ^^

I dont use max f/ik.

With my stretchy system, i have a fk/ik solution which handles bend bond as a derivate of the final result. This bend bone can be controlled manually and automatically.

As to bendy like my elastigirl system - that could handle ik/fk too as it was a derivate of the final solution i.e it piggy backed a custom point based ik solution, where i could drive the weights, ie blend back a forth between normal, and bendy with stretch as an overall affect.

So my system has bendy and stretch built into one, do you mean bendy as in bend bone or curviture based so you can change the shape - Well mine was a bspline solution but twist didnt exist, a problem of spline knot having no rotation. Im currently looking into my own custom spline, solution so each knot will be defineable, and possibly add knots on the fly. The math is done.

Twist on a 100% curve could be acheived using two splines and driving a poly ribbon which inturn drives the bones.

As to fk/ik seamless snapping i did do this, which would auto generate 2 keys do the seamless switch, even switch the controls. The problem is tweaking the keys afterwards, controlling the blend etc etc. It still use three bones, ive even dont frame tracking solutions and using callbacks to do a viewport seamless tracking snap, but still tweaking the keys is problematic. Its why ive gone to the three bone method, if you do the f-ik solution, the issue with this is drift, but a ramping slider could fix this. But then the issue with pinning? pinning the hand? i use key tracking for this, so you pin it over time.

The rule is order of systems, the bendyness is derivated of the ik/fk solution it rests ontop of everything else. You keep reverse foot,stretch,length all with ik. You keep additional length with the fk system. As i said in another thread, my stretch only stretches when the leg has reached its limits, length control is need also as you need to resolve the reverse foot issue.

With elasigirl, the complexity is a problem, you need a solution which bends, twist and importantly creases - makes right angles, nurbs is good for this as you can wieght the handles, but each segment isnt really definable like besier. The problem here is that a bspline consists of cubic segments stitched together, with defined tangents. As to nurbs which the tangents are a generalization derived from the base knots. But i have some ideas for this problem.

treat the result of ik/fk as one solution - then thing can bolt onto this result. Also importantly in snapping fk to ik, i have a ramped snap so i use a slider to ramp the fk to ik and vise versa so you could do like a half blend.

max also seems to have issues with spline setups in rigging, the most powerful solution NURB cv curves, cant be rigged with multiple layers/controls its too slow. This is partially cause its parametric i think.

With 3 bones blended method you have control over the blend, this is key. As inconjunction with the snap buttons can have very accurate control. With the pixar method if i remeber as the bones where piggybacked, to the ik/fk/curve rig, it meant you just key them back to 0,0,0, to snap back.

my stretch/length ik system is all melded into one, it doesnt piggy back the ik, its a kinda result/driver of it. Also the same with the fk length - why do i need two length controls well this is partially due to snapping and the stretch issue, if my ik leg is in stretch mode and its length has changed, the fk length is mixture of these. so blending back and forth produced wierd results. Now fk length is only for that chain and same for ik. The stretch, length is part of the ik system uniquely. This way i can custom ramp match the fk length to the ik systems length and vice versa, also this mean reverse foot works, as i can stretch the leg out, in ik match the length in ik, then turn/blend off the stretch and the length has changed - i can blend fk to this.

So with bend bone, the arm doesnt become just a tube, it bends the upper arm and lower ie the v shape of the arm is still there, it just improves dynamisim of movement. Now you could blend to a tube system, but id prefer more control going into a curved based arm. The rule is generally bending/stretching is for extreme movements, unless its all bendy all the time.

So id go with 3 bone blended, especially with complex bendy rigs. You need the control, at present i dont think maxs own splines are controllable enough, you basically need to change there type on the fly whilst keying, as you need the control to really shape the spline. Also you need in a curviture system, to blend into the more knots, eg you have 3 for basic curving, but then you blend in 8 for really defining shape corners. Ie esseintially turn off the knots/tangents you dont need.

Thinking about this, i dont think specific knots can be plucked, but a slider which populates and array based off a base array. Hmmm but tangents might screw up. Sorry im digressing off the topic at hand.

Anway snapping is great for quick posing etc, but tweaking the blend. Also it would be problematic with a complex bendy system i think. So id go with 3 bone blended.

Fingerman
11-08-2006, 10:31 PM
First of all, thank you Eek for the explanation of the IK FK Snap which is definatly a very useful feature to have.

My question is about stretch...

If I was willing to go for a classic stretch that you often find for an IK Rig, by that I mean, the more you pull the IK Target the more the leg stetches with an optional limit.
Then I would suppose that I would have to wire or script the XYZ scale value of the Def Chain Bone so they match the IK chain.

But then what would you do with the FK Chain ? Would you make a FK Stretch System that basicaly would change the length of the bones ? Would you leave it same sized ? Or, at last, would you also make it able to obtain the value of the IK leg...

I hope my question make sense since I am not so experienced at rigging...

Thx...

eek
11-09-2006, 03:11 AM
First of all, thank you Eek for the explanation of the IK FK Snap which is definatly a very useful feature to have.

My question is about stretch...

If I was willing to go for a classic stretch that you often find for an IK Rig, by that I mean, the more you pull the IK Target the more the leg stetches with an optional limit.
Then I would suppose that I would have to wire or script the XYZ scale value of the Def Chain Bone so they match the IK chain.

But then what would you do with the FK Chain ? Would you make a FK Stretch System that basicaly would change the length of the bones ? Would you leave it same sized ? Or, at last, would you also make it able to obtain the value of the IK leg...

I hope my question make sense since I am not so experienced at rigging...

Thx...

I seperate the stretch of the fk system and the ik system to two systems. Ive seen rigs that do auto-stretching of the fk to match the ik, but personally i found problems with it. So all i do is have my deformer-chain blend between the lengths of the ik chains and the fk chains, as well as the orientations.

I also have options to snap the fk > IK and vise versa, with an option to turn on 'length snapping' too.

With stretch essentially your dealing with two systems, especially in ik chains. One: being natural stretch i.e pulling the ik handle to far, causing the bones to stretch and two: the length of the bones in the chain. This latter system being the same for fk and ik - by that i mean each system fk & IK has its own length controls. Only Ik has the additional 'pull too far and i stretch' system. Now your deformer chain, should blend between the 'final' result of both systems! thats crucial - thats why getting the distance/length is probably the best way.

cheers,

Fingerman
11-09-2006, 09:03 AM
Thanks for your answer... It sounds clear to me...
I was asking all that because If you've check the Brad Noble's rig, you must have seen
that the stetch system is a Second Type One, not natural but length of the bones... for both IK and FK Chain which are linked together.
I suppose after all, it also depends on what kind of stretch you will like to use, doesn't it ?

And by the way. This Seamless IK/FK method you mention, is it the one we can see on your showreel when you are switching FK to IK with one Button ?

Thx again...

eek
11-10-2006, 12:15 AM
Thanks for your answer... It sounds clear to me...
I was asking all that because If you've check the Brad Noble's rig, you must have seen
that the stetch system is a Second Type One, not natural but length of the bones... for both IK and FK Chain which are linked together.
I suppose after all, it also depends on what kind of stretch you will like to use, doesn't it ?

And by the way. This Seamless IK/FK method you mention, is it the one we can see on your showreel when you are switching FK to IK with one Button ?

Thx again...

Yep, pretty much, its a fake switch basically matching and hiding, then making the blend keys. I tried every type of fk/ik, seamless, in one chain, fk driven ik, in the end a simple 3 chain blend is perfect.

Fingerman
11-11-2006, 12:37 PM
Another matter crossed my mind...
If I was willing to have an arm that could break itself... By this, I mean make an angle slightly more than 180. Would you have a better solution than an offsetable elbow ?
By offsetable elbow I mean... you go for 180 arm angle, then offset the elbow to the inside, and counter animate the upper arm by rotating him a bit to the back...

Thx...

CGTalk Moderation
11-11-2006, 12:37 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.