ik chains explained

PadonePadone Posts: 3,476
edited October 2019 in Daz Studio Discussion

disclaimer. What I'm reporting in this discussion is based on my personal experience with other animation packages. Since there's not any official documentation on ik chains yet, something may be wrong. Please feel free to add corrections.

 

I see there's some confusion around about how ik chains should be used or how do they work. So I'll try to cover the basics. To my understanding the ik system is not bad, though I see some little "glitching" around so I believe it can be improved.

As an example we'll setup the ik chains for the G2F legs, so to get her feet on the ground during a crouching animation. That's usually the basic test for ik chains.

 

1) SETTING UP A IK CHAIN

The first step is to create the ik chain. So select the G2F foot and use the menu create > new ik chain. This will create a ik chain from the foot to the thigh, that's good as a default value. Then you can change the chain root and end in the ik parameters. In this case we don't need it.

IMPORTANT. Do not forget to check pin translation and rotation if you want the foot to follow the ik target. Otherwise the foot will be free to have its own rotation and translation. Also set reach translation and rotation to 100%. Otherwise the ik target will not be active during animation and it will only serve for posing purposes.

IMPORTANT. Finally you also have to remove the limits in the bend side-side and twist channels of the foot. Otherwise again the foot will not be able to follow the ik target.

 

2) USING LIMITS AND LOCKING CHANNELS FOR THE IK SOLVER

The first step above created the ik chain, but it's not enough to get it working. We have to define limits to tell the ik solver what we want it to do for us. Now a classic stable ik setup for the legs is to have the ik solver controlling the bend side-side and twist channels for the thigh bone, and controlling only the bend channel for the shin bone. This is also why I used the G2F so to avoid messing up with twist bones.

So select the shin bone and lock the twist and side-side channels, then remove the limits from the bend channel. This way the ik solver will handle only the bend channel. Also select the thigh bone and remove the limits from the bend side-side and twist channels.

IMPORTANT. It is essential to setup a stable chain for the ik solver to work with, or you will get any sort of glitching. This is the same in any ik package, though some are better than others in handling unstable ik chains.

 

3) ANIMATION

Now that we finally have our ik chains setup and ready to go, let's try animating with them. To get our purpose, that's the crouching animation, we simply have to set some keyframes moving the hip bone around. This way the feet will stand on the ground while the legs will follow the body movements.

IMPORTANT. Please note that this simple animation is not possible without ik chains, because without them the feet will move around among keyframes, that's what happened in 4.11 and below.

Post edited by Padone on
«13

Comments

  • IvyIvy Posts: 7,153
    edited October 2019

    Thanks for the information @Padone thats a good explanation.  There are somethings i can figure out pretty good with the ik-chain . do you have a solution for walk cycles on hard surfaces. ? other than clicking and unclicking the pins off and on for each keyframe for the place a foot touches on the surface?

    I have some issue with the daz squirrel that is why i asked

     

    Post edited by Ivy on
  • wolf359wolf359 Posts: 3,762
    Can this be applied to locomotion ( walking &running) ???
  • JonnyRayJonnyRay Posts: 1,744
    wolf359 said:
    Can this be applied to locomotion ( walking &running) ???

    I can't help myself. I tried and failed. I am weak...

  • PadonePadone Posts: 3,476
    edited October 2019
    Ivy said:

    do you have a solution for walk cycles on hard surfaces. ? other than clicking and unclicking the pins off and on for each keyframe for the place a foot touches on the surface?

    As far as I can see dynamic parenting is not supported. And honestly I wouldn't expect this to be supported yet since they just came out with a first implementation of ik chains. So no, I guess there's not another way other than using dynamic ik for posing then baking every single frame. As you already discovered yourself.

    Of course I may be wrong about dynamic parenting and I'd be glad to stand corrected by some daz guru out there.

    wolf359 said:
    Can this be applied to locomotion ( walking &running) ???

    I don't see why not, unless I misunderstand your question. For walking you just drag the hip around for the main body, then move the feet ik targets where you want the feet to be. They will follow both the position and rotation of the ik targets during the animation.

    JonnyRay said:

    I can't help myself. I tried and failed. I am weak...

    LOL .. But indeed another easy use of ik chains is for dancing. Again you just drag the hip around and move the feet to follow the rhythm.

    Post edited by Padone on
  • marblemarble Posts: 7,449
    Padone said:

     

    1) SETTING UP A IK CHAIN

     

    IMPORTANT. Do not forget to check pin translation and rotation if you want the foot to follow the ik target. Otherwise the foot will be free to have its own rotation and translation. Also set reach translation and rotation to 100%. Otherwise the ik target will not be active during animation and it will only serve for posing purposes.

     

     This bit still confuses me. My idea of animation is setting a pose in one frame and then changing the pose in a later frame and the tweening handles the frames in between. So, as I understand it, animation is posing which changes over the timeline. What do you mean by "active during animation"?

  • barbultbarbult Posts: 23,136

    Thank you very much for your tutorial. I had no idea where to start, so this was very helpful. I had a couple problems that I hope you can comment on:

    1) I lowered the hip bone on the Y axis in frame 15 and raised it most of the way again on frame 25. When I play the animation, the character jumps slightly up on frame 1 and down again late in the animation.

    2) I saved the scene file and reopened the scene. The animation played differently after reopening the scene. Now the right foot says in pretty still, and the left foot appears to slide around quite a bit. The left shin bone is twisting and moving side-side, even though the parameters pane shows that the shin twist and side-side are both locked.

    I'm attaching the scene file, in case somebody else wants to start with it, or look at it and see if I have done something wrong.

    duf
    duf
    G2F IK Feet.duf
    69K
  • PadonePadone Posts: 3,476
    edited October 2019
    marble said:

    This bit still confuses me .. What do you mean by "active during animation"?

    As you said yourself, the tweening handles the frames in between. That's the difference.

    Without 100% reach, the tweening is handled by the graph editor interpolator, that will do its job. That is, interpolate with a smooth curve between keyframes. That's why feet move around, unless you pin them for every frame.

    On the contrary, with 100% reach, the tweening is handled by the ik solver, that will do its job. That is, keeping the ik targets in place between keyframes. That's why feet don't move, unless you move the ik targets.

    Post edited by Padone on
  • PadonePadone Posts: 3,476
    barbult said:

    I had a couple problems that I hope you can comment on:

    Actually I have no access to my workstation but I'll look at it later. I didn't test the ik system extensively since I use blender for animation. My purpose was only to explain the basics and the little test I did seemed to work fine.

  • marblemarble Posts: 7,449
    Padone said:
    marble said:

    This bit still confuses me .. What do you mean by "active during animation"?

    As you said yourself, the tweening handles the frames in between. That's the difference.

    Without 100% reach, the tweening is handled by the graph editor interpolator, that will do its job. That is, interpolate with a smooth curve between keyframes. That's why feet move around, unless you pin them for every frame.

    On the contrary, with 100% reach, the tweening is handled by the ik solver, that will do its job. That is, keeping the ik targets in place between keyframes. That's why feet don't move, unless you move the ik targets.

    Ok, starting to make sense now - thanks. So is there a mix of IK and tweening happening? The pose changes being tweened and the feet being controlled by the IK solver?

  • PadonePadone Posts: 3,476
    edited October 2019
    marble said:

    So is there a mix of IK and tweening happening?

    I'm not completely sure what you mean, but I guess yes. With 100% reach the ik solver takes precedence over the interpolator. What's not controlled by the ik solver is controlled by the interpolator.

    Post edited by Padone on
  • PadonePadone Posts: 3,476
    edited October 2019
    barbult said:

    I had a couple problems that I hope you can comment on:

    When I load your file it reports the errors below. I guess you didn't use a "clean" G2F. Anyway I can ignore the errors and after loading I can see some sliding in the left foot. But I can't see any figure jumping as you reported in point 1. Also when I save and reload the scene the animation doesn't seem to change as you reported in point 2.

    data/daz 3d/genesis 2/female/morphs/d3d gen x/gxf_g2f_transzlowjaw.dsf

    data/daz 3d/genesis 2/female/morphs/d3d gen x/gxf_g2f_transzupjaw.dsf

    As I said in my first post I do have some glitches myself though, so I believe things can be improved. Specifically, the ik solver does seem to lack precision so the feet tend to slide around a little. Usually not a big deal but enough to be noticeable. Also I've found that the ik solver precision gets better if you unparent the ik chains. That is, select the ik chain then rmb > unparent, so to have the ik chain not a child of the figure but an element of the scene.

    I also attached my own example just in case it can be useful.

    duf
    duf
    test.duf
    68K
    Post edited by Padone on
  • barbultbarbult Posts: 23,136
    edited October 2019
    Padone said:
    barbult said:

    I had a couple problems that I hope you can comment on:

    Actually I have no access to my workstation but I'll look at it later. I didn't test the ik system extensively since I use blender for animation. My purpose was only to explain the basics and the little test I did seemed to work fine.

    Thanks. I rendered my little animation as an image series and put it together into a video. I make each frame last 0.5 second to make it easier to see the unexpected movement. It is easiest to see if you step frame by frame, though. (I put a swimming suit on her for the sake of TOS.)

    https://www.dropbox.com/s/lveuz5cn37vzij0/G2F%20IK%20Foot%20Swimming%20Suit.mp4?dl=0

    Post edited by barbult on
  • wolf359wolf359 Posts: 3,762

     That is, interpolate with a smooth curve between keyframes. That's why feet move around, unless you pin them for every frame.......That's why feet don't move, unless you move the ik targets.


    I think these two statements require some clarification.
    Most of the "new" animators here, are going to at least want to use  premade animations for simple walk cycles
    aniblocks etc.

    A modern IK system will still  prevent the feet from floor pentration/sliding even using a canned mocap walk cycle,
    without you having to pin&unpin  each foot for each step.

    I have poser 6OSX  & Poser Pro 2014( windows) so I know for a FACT that even Poser does this with its walk designer .
    Granted the results ,in poser, tend to be quite "jerky" most times.blush
     But Poser clearly has the ability to  PREVENT floor penetration with pre existing animations applied after Ik is activated.


    I do not know how the new Daz system works.
    ( not running  4.12) so no comment from me on its specifics

    However it needs to be made clear that manually moving IK targets  or manually animating the strength of reach effectors  for every foot step is not the method used by most animators who use auto generated motion 

    sources Like  Daz animate2,  autodesk motionbuilder,Maya&Max, Iclone,Lightwave etc. 

  • PadonePadone Posts: 3,476
    barbult said:

    Thanks. I rendered my little animation as an image series and put it together into a video.

    Yes that's the left foot sliding I was referring to. So I guess that's what you mean for figure jumping. As I said in my previous post you may try unparenting the ik chains, as I did in my example. This seems to improve the ik solver precision.

  • barbultbarbult Posts: 23,136
    Padone said:
    barbult said:

    I had a couple problems that I hope you can comment on:

    When I load your file it reports the errors below. I guess you didn't use a "clean" G2F. Anyway I can ignore the errors and after loading I can see some sliding in the left foot. But I can't see any figure jumping as you reported in point 1. Also when I save and reload the scene the animation doesn't seem to change as you reported in point 2.

    data/daz 3d/genesis 2/female/morphs/d3d gen x/gxf_g2f_transzlowjaw.dsf

    data/daz 3d/genesis 2/female/morphs/d3d gen x/gxf_g2f_transzupjaw.dsf

    As I said in my first post I do have some glitches myself though, so I believe things can be improved. Specifically, the ik solver does seem to lack precision so the feet tend to slide around a little. Usually not a big deal but enough to be noticeable. Also I've found that the ik solver precision gets better if you unparent the ik chains. That is, select the ik chain then rmb > unparent, so to have the ik chain not a child of the figure but an element of the scene.

    I also attached my own example just in case it can be useful.

    Sorry, I didn't see this reply before I posted my little video. 

    I loaded G2F from the figure in Genesis 2 Starter Essentials, so I assumed it was a "clean" G2F. The errors you got appear to be from morphs created by GenerationX. Perhaps that means my G2F is corrupted by some GenerationX morphs, but since they are for the jaw, I'm assuming that they don't impact the foot IK.

    You can't see the figure jumping as I reported in my point 1, because after I saved and reloaded the scene, the IK behavior changed. I was only able to attach the saved scene, of course, so you can only see what I saw in point 2, after saving and reloading. (That whole business of it changing after saving and reloading the scene is disturbing. I'll start fresh and see if I can reproduce that issue.)

    I tried unparenting the IK chains, but the left foot seemed to slide around just as much for me. Is there anything I have to do to make the IK recalculate, or should it do it automatically?

    Your example has more hip movement than mine, I think, but less foot sliding.

    Thanks again for helping us figure this stuff out in the absence of ANY Daz documentation on this.

  • PadonePadone Posts: 3,476
    barbult said:

    I tried unparenting the IK chains, but the left foot seemed to slide around just as much for me. Is there anything I have to do to make the IK recalculate, or should it do it automatically? Your example has more hip movement than mine, I think, but less foot sliding.

    In other packages you can define a rest pose when applying the ik chains. Bended legs and arms help the solver to work better. I guess in daz studio this is done with edit > figure > memorize figure pose. I'd avoid editing the chains after animation though, since I guess it may cause instability. In your example I'd restart from scratch with unparented chains.

    In my tests I never got the wide sliding you get in the left foot though, even with parented chains. So I'm not sure how you got it or why it happens.

  • PadonePadone Posts: 3,476
    edited October 2019
    wolf359 said:

    A modern IK system will still  prevent the feet from floor pentration/sliding even using a canned mocap walk cycle, without you having to pin&unpin  each foot for each step.

    Yes they just implemented a first version of ik chains. I see no pole-targets and/or constraints and/or dynamic parenting in this first implementation. So for sure it's not "professional" yet. Moreover the solver precision is not optimal and it glitches a little. But it's a start and compared to 4.11 they did a good step forward in my opinion.

    Of course I still use blender for animation though.

    Post edited by Padone on
  • FYI, for those interested in animation, a couple of us Daz animators thought it might be nice to have a dedicated animation thread. It can be found here. Please share your work and knowledge!

    https://www.daz3d.com/forums/discussion/358051/the-animators-assemble-thread-for-daz-animation-wips-clips-and-tips

  • PadonePadone Posts: 3,476
    edited October 2019

    Here's a basic G2F rig for legs and arms. I also did a little prebending in the rest pose. It seems to work fine. For anyone interested to check and play around.

    ik-rig.jpg
    377 x 444 - 36K
    duf
    duf
    test.duf
    71K
    Post edited by Padone on
  • PadonePadone Posts: 3,476
    edited October 2019

    Here's a basic rig for the G8F legs. In this rig I limited the leg chains from foot to thigh twist, so it is stable. Also this way you can use the side-side channel of the thigh bend bone to move the knees while bending the legs. This is a good example of a mix between the ik solver and fk posing. In more advanced ik packages you use pole targets to move the knees, but the G8F thigh bend bone does the same.

    Please note that for the G2F you can also use the side-side channel of the thigh bone to control the knees, though this way you "steal" a channel from the solver. So the extra bone in G8F is not really needed for posing, but just for shaping purposes.

    duf
    duf
    g8f-rig.duf
    112K
    g8f-rig.jpg
    762 x 583 - 104K
    Post edited by Padone on
  • RobinsonRobinson Posts: 751

    This is new?  I thought Daz already had IK chains... that's how pinning/activepose work isn't it?  Am I missing something here (clearly I am).  I've used mcjcasual's AutoLimb and KeepOrient for foot stabalisation previously.  Does this feature mean I no longer have to do that?  I think it's time to do some experiments...

  • This is a new, or at least greatly refined, implementation of IK - it allows a different approach for setting up chains, and adds parentable targets (soemthing that was lacking before).

  • PadonePadone Posts: 3,476
    Robinson said:

    This is new?

    Before 4.12 the ik system was designed for posing, that is, it wasn't active during animation and the tweening was handled by interpolation, thus generating "sliding" among keyframes. See the posts by @marble in this discussion.

  • RobinsonRobinson Posts: 751
    Padone said:

    Before 4.12 the ik system was designed for posing, that is, it wasn't active during animation and the tweening was handled by interpolation, thus generating "sliding" among keyframes. See the posts by @marble in this discussion.

    Ah, I see.  Thanks.  Yes, for animation you absolutely have to use mcjcasual's scripts to do things like foot stabalisation.   Now... who's going to be first with the in depth tutorial on this?  I need a primer... :p

  • PadonePadone Posts: 3,476
    Robinson said:

    Now... who's going to be first with the in depth tutorial on this?

    It seems pretty straightforward to me as it is explained here. Did you read the whole discussion ? If something stills not clear to you please feel free to ask, it may help others as well.

  • Thanks this is very clear and it worked for me on G1. However, I don't think this is how IK chain should work. An IK chain should automatically override other translations /rotations without having to manually lock them. I think this is something that Daz needs to fix. It just makes the process longer than it should be. I also noticed that IK chain for hands doesn't require any locking. It works without doing any of that, which is how you'd expect it to.
  • PadonePadone Posts: 3,476
    edited October 2019
    I don't think this is how IK chain should work. An IK chain should automatically override other translations /rotations without having to manually lock them.

    The manual locking of rotation channels is not mandatory. You can avoid it if it's fine for you. But, for example, if you don't lock the knees then the ik solver will consider any bending as possible, while we know the knees bend only one way. Other packages may provide a full ik rig that can be applied to a human figure, so you don't have to build it yourself. But this is not the case with daz studio (yet ?).

    Post edited by Padone on
  • RobinsonRobinson Posts: 751
    edited October 2019
    Padone said:

    It seems pretty straightforward to me as it is explained here. Did you read the whole discussion ? If something stills not clear to you please feel free to ask, it may help others as well.

    Well I tried the example given and got foot wobble from a simple hip turn.  I'm not sure I'm using it correctly.   But then you go on to say, "Specifically, the ik solver does seem to lack precision so the feet tend to slide around a little".  This defeats the whole purpose of it and for now at least I'll stick to mcjcasual's scripts for stabalising body parts.  I mean what's the use of the IK solver if it lacks precision?  I don't want to be fighting that on top of everything else.

    Edit: I need to play with it some more.  I can see some uses...  stabilising feet for animation is probably not one of them right now though.

    Post edited by Robinson on
  • PadonePadone Posts: 3,476
    edited October 2019
    Robinson said:

    Well I tried the example given and got foot wobble from a simple hip turn .. I mean what's the use of the IK solver if it lacks precision?

    As for the foot wobble be sure to remove limits and lock channels as explained. Otherwise you'll get an unstable chain and everything could happen. The sliding should be minimal thouh it is noticeable at times. It seems you can improve the solver precision if you unparent the ik chains, so that they are elements of the scene instead of being children of the figure. To tell the truth I often notice some sliding even in mocaps. But yes, I agree the solver precision would need to be improved.

    I attached a simple test for you with the g2f twisting around and I can't see any major sliding overall. But there's indeed a glitch in the second frame. I get it only after saving and reloading the scene though, that seems the issue reported by @barbult.

    g2f-ik.jpg
    416 x 565 - 49K
    duf
    duf
    g2f-ik.duf
    67K
    Post edited by Padone on
  • wolf359wolf359 Posts: 3,762
    edited October 2019
    Robinson said:
    Padone said:

    It seems pretty straightforward to me as it is explained here. Did you read the whole discussion ? If something stills not clear to you please feel free to ask, it may help others as well.

    Well I tried the example given and got foot wobble from a simple hip turn.  I'm not sure I'm using it correctly.   But then you go on to say, "Specifically, the ik solver does seem to lack precision so the feet tend to slide around a little".  This defeats the whole purpose of it and for now at least I'll stick to mcjcasual's scripts for stabalising body parts.  I mean what's the use of the IK solver if it lacks precision?  I don't want to be fighting that on top of everything else.

    Edit: I need to play with it some more.  I can see some uses...  stabilising feet for animation is probably not one of them right now though.

    I am now running DS 4.12 .... Indeed this is NOT an IK solver for character animation IMHO The problem stems from trying to mix IK contact solving with the Daz pose controls..... which one has priority??? This "squiffy/Mason handshake" will never work for complex Character animation or the use of imported mocap sources or aniblocks.
    Post edited by wolf359 on
Sign In or Register to comment.