Author Topic: Holding hands (IK & constraints)  (Read 346 times)

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Holding hands (IK & constraints)
« on: February 18, 2012, 08:47:17 pm »


                <singing an old insect tune...>

Hello again! =)

I thought of just beating my brains in pounding against the various video tutorials out there <thought that's what you were doing the last five hours, boss?> Hush.

Then I remembered all my learned and helpful friends here =)

This all pertains to Cestus' Oni

'Image

What I want to do, and I am sure it *can* be done, no matter how clueless I am, is rig IK chains on the oni_ arms and constrain the oni_*hand so that they are superimposed over the base hands. That is, I want Max to do all the work and not fiddle with 1500 frames of animation for 6 parts.

Here's the heirarchy:
'Image

I have never worked with IK or constraints before, doing all my animation one joint at a time by hand. Takes a *lot* of time and gives me rather rough anims.

So I'm asking if anyone has a particularly clear IK tutorial they could point me to, or would be willing (OTR? Six? Bannor?) to write up a NwN-slanted tutorial on rigging IK and how to get the keys so you can export a MDL.

<...badly off-key)
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #1 on: February 24, 2012, 10:15:34 pm »


               I guess the question posed is "How to get the same animations to play through two differently scaled models which are part of the same model?"  I don't know the answer to that one.  You could make the Oni a cloak and, I believe, scale the animations there.  There is also the possibility of doing some sort of NWN Trickeryâ„¢ like simply renaming your Oni bits to have the same name as your main model and hope that the animation events fire through both.  In a case like that, though, you're throwing yourself on the mercy of potentially having position keys in the animations which would throw your Oni's animations off.  Worth a shot though.

Maybe someone else has a simpler approach?

I understand what you're trying to do and it's quite clever but I don't actually have any experince with doing things like that.  About the best I can do is offer encouragement that what you're trying to do should work and that it's probably the preferred method to transfer animations in such a situation.  If you do continue to pursue that method you still might be confronted with probably having to bake out the animations on your Oni down to FK when you're done which is going to mean a lot of keysframes.

As an aside, although NWN is animated in FK, there has been a lot of legitimate speculation that more complex solvers were used originally and that it was somehow baked down to FK.  I've tried to find such software and couldn't but that doesn't mean that it or some Maxscript doesn't exist.  If you find such a thing, let me know.  It would be a huge help to something like you're trying to do...if you have to take the "long way around" the problem.

Sadly, constraints are something I don't know very much about.  I've used them once and went "Oh crap, I wish I'd known about these earlier".  At the time the biggest benefit I could see based on the kind of things I do was to help prevent gimbal lock on limb rotations when using imported mocap data.  Recently I did hit the Max help on constraints and IIRC there's at least one "getting started" tutorial with constraints.

When you speak of IK, are you talking about an IK solver?  If that's the case, I'm not sure that's necessary for what you're trying to do.  A solver is going to help you pose or animate your character from scratch but when you're hoping to pick up animations (either by having them fired through your model or picking them up from other geometry) from something else, they might just add to the hassle.  I don't have a link but I have read about using solvers as part of a process like this.  I'm just not sure how necessary it is for what you're trying to do...if you're talking about a solver, anyway.  (Animation menu item in Max -> IK Solvers)
               
               

               


                     Modifié par OldTimeRadio, 24 février 2012 - 10:17 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #2 on: February 25, 2012, 01:09:31 pm »


                <reading...>

Let me say a bit more about what I've *done*. 

Seeing the NPC base I was using was supermodeled on a_fa, I linked the Oni torso to the root dummy with all it's heirarchy. Then I mapped the anims from a_fa to the Oni torso (since the part names wouldn't match, I knew the supermodel wouldn't reach it). So that gave me matching anims for the base and the Oni.

The problem here is that the Oni is (has to be) larger, so the hands hang down farther and in the combat anims, they hold an invisible weapon (in the correct stance) above and beyond the base hands.

What I want to do is adjust the bicep, forearm and hands of the Oni - bending just a bit at the shoulder, elbow and wrist - so that the hands of the oni grip the weapon the base is holding and so that at rest, the oni hands occupy the same place as the base hands. I want it readily apparent that the part that seems solid (base) is an illusion, and the part that seems illusion is what is actually holding the weapon.

Currently, I am adjusting each arm for each key by "eye". I know the IK solvers (yes, that was what I wanted) can be rigged so that I can just grab the hand, move it into place and the bicep/forearm/wrist will rotate to suit.  I just don't know how.

As I understand constraints (not particularly well), I should be able to constrain the Oni hand to the base hand and the combination of the constraint keeping the oni hand in place and the IK solver adjusting the arm geometry to suit should allow me to adjust the entire range of anims by simply resetting the keys. At least that is how I *think* they would work together. But again, I don't know how.  

IK Solvers and constraints are the next lessons in my self/community-taught curriculum ;-)

Once I get the anims of the oni spirit to match correctly, then I can split it off, re-order the heirarchy and try it as a tail.  But I need the anims first.

<...and thinking>
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #3 on: February 25, 2012, 04:38:22 pm »


               Ok, Rolo, I want you to try something and then tell me how far off the effect is from what you want.  This does things a little differently but this experiment should rig up really quickly:

1. Select the right bicep, forearm and hand of your Oni
2. Select all the animation keys in the timeline and delete them.
3. Rotate your Oni bicep a little bit if you need to need more visibility on the Oni's hand- but it should be really close to the player's hand position.
4. Select the Oni hand
5. Animation -> IK Solvers -> HI Solver
6. The solver will want you to pick the end of the chain.  Select the Oni's bicep
7. As soon as you click on the Oni's bicep the IK Chain is going to be created and IK Chain001 will be selected.  In this state, click on the Select and Link button then the Select by Name button and select rhand_g, which should be your creature model's right hand.

I'm not even going to bother describing what that does but do it and move your player's arm around, either manually or with animations.
               
               

               


                     Modifié par OldTimeRadio, 25 février 2012 - 04:40 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #4 on: February 25, 2012, 06:42:35 pm »


               <looking positively...>

Oh, now that sounds like *exactly* what I want =) You rock OTR.
Be a few before I can check it out. This old machine is *very* one-track and the Max track is particularly fat :-P

<...enthused>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #5 on: February 25, 2012, 08:02:02 pm »


               <pushing...>

Fascinating. I think that is definitely on the track of what I want. And now something I read in the CC Guide makes more sense, also - about creating a dummy as a handle on the end of the chain.

With just the bicep, forearm and hand in the chain I am finding it very difficult to get the hand where I want it. The entire arm keeps flipping around on me when I  get close. Perhaps a handle-dummy on the end will give me more control.

Do I then step through the frames setting rotation keys or is there a way to auto-generate the keys when I have the IK Solver working?

<...and pulling>
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Holding hands (IK & constraints)
« Reply #6 on: February 25, 2012, 10:03:47 pm »


               

Rolo Kipp wrote...
With just the bicep, forearm and hand in the chain I am finding it very difficult to get the hand where I want it. The entire arm keeps flipping around on me when I  get close. Perhaps a handle-dummy on the end will give me more control.

If you're trying to set some initial orientation, how about using old-fashioned FK to set up the pose exactly how you want it and then applying the solver?  The solvers are cool but they can get in your way if you ask them to go outside the range of motion they expect.

Do I then step through the frames setting rotation keys or is there a way to auto-generate the keys when I have the IK Solver working?

Once the solver is working the only way to get those keyframes out is to bake them into linear keys and the easiest way to do that is using the Anim Baker in NWMax (Anim Tools -> Bake Anims).  I should also take a moment to blurt out that NWMain does process Bezier controllers (partial proof of concept) and possibly LookAt but neither of those would actually help in this case.  Anyway, the Anim Baker should work for you.  If it doesn't I can hook you up with something that should.

Back to something you mentioned earlier...

Once I get the anims of the oni spirit to match correctly, then I can split it off, re-order the heirarchy and try it as a tail.  But I need the anims first.

If you're still planning on going that route you might want to look over some of these findings.  After about two months working on that project I'm still licking my wounds so be forewarned.

And since I think you might appreciate it, and also to any other CC geeks still reading at this point, if you ever get deep into emitters and start playing around with the AuraREF node, the steps I published in my previous message would, theoretically, allow you to have an AuraREF track another mesh (in the same model) just like the Oni's hand tracks the base creature's.  An AuraREF is always a child object of an emitter whose particles seek it out/target it, FWIW.
               
               

               


                     Modifié par OldTimeRadio, 25 février 2012 - 10:04 .