|
|
« on: March 14, 2015, 12:52:50 AM » |
|
Creating Custom Rigs in Maya To those of you who Animate in Maya as opposed to BrawlBox, you pro'lly appreciate the magic that such a software provides. The Graph Editor, IK Handles, Control Rigs, and so much more! Tho, if you're somebody like me, I just dislike working with the HumanIK Control Rig that Maya provides. My problem with it is that there are 2 controls for each foot, and that parts of a limb you move and keyframe will keyframe all the controls relating to it. As somebody that likes to work with the graph editor, this annoys me, and would rather work with a custom Control Rig that doesn't have these issues. And I'm willing to share this knowledge to you! Bear with me cause this is actually quite a long Tutorial. Knowledge on how to work with Maya is recommended!IK vs FKBefore we get to the process of making these rigs, it's good to get an understanding of the differences between IK, and FK.
IK (or Inverse Kinematics) allow you to set a start and end bone, which will allow you to move them however you please, and all the bones leading up to the other end will change their orientation accordingly. An example of this would be for the leg. You can move the foot bone however you please, and the bones for the leg will rotate accordingly. And you can move the hips around too, and the foot will be pinned to it's current position. While it's good to use for parts pinned to the environment like walls and floors, it's not ideal when they're suspended in mid-air. This is especially the case if you want some Follow-through/Overlapping Action to your limbs, and for characters that like to do acrobatics for whatever reason.
FK (or Forward Kinematics) is more likened to how BrawlBox Animations work. You rotate one bone, and it's all it does. Parented bones will follow their parent bone, but they aren't really pinned to anything. The pros and cons are essentially switched around here, so I won't go into detail since us A/A Hackers are probably familiar with how BrawlBox animates things...
Now, for the part you probably actually care about! Before we start...Before anything you'll want to set Maya to Animation Mode which will give you all your options for rigging and animating. And you might also wanna keep that Outliner handy. You'll find both of these in the image below... Another thing to note when working with your model is that the bones you'll be making IK handles for should have a slight bend to them in the correct direction. This is a way to tell Maya the default direction to bend. You may end up having to translate some of these bones if that's not the case (1 of the 3 Translate Values should be set to 0 unless you want the limb to bend diagonally), and the bones might as well be re-skinned to make a better looking bone rig. Creating IK LegsSo here, we have our model with Skinned bones ready to go! Since we're all brawl hackers, I'll use the common bone names for the Brawl Models. The 1st thing we should do, since this will be used for a later part is create a 3rd foot bone that's parented to the Toe Bone. Be sure that all the values for both toe bones are the same. Now, we can start making our IK Handles. Click on Skeleton>IK Handle Tool [Option Box]. And make sure that the Current Solver is set to Rotate-Plane Solver. Open the Outliner, and with the IK Handle Tool, click on the Leg bone, then Ctrl+Click on the Foot bone. This will create an IK handle between the leg, through the knee, and ends at the foot. Open the [Options Box] for the IK Handle Tool again, and set it to Single-Chain Solver. Create some more IK Handles. One between the Foot and the Toe Bones, and another one between the Toe, and the new bone you created. Next, you can either create a NURBS Circle by going to Create>NURBS Primitives>Circle, or use Create>CV Curve Tool to create your own shape. If you do use the CV Curve Tool, make your shape assuming that the pivot point is at the center of the grid. You can make points snap at the grid by holding X as you create it. Like the IK Handles, rename your curves accordingly. After creating, and shaping your curve, place it under the foot, and make sure it's big enough for you to click on. You'll be using this curve to move the foot around as opposed to clicking on the bone itself. After that, select both curves, and do a Modify>Freeze Transformation and an Edit>Delete by Type>History. This will zero out the values of the curves, and will make it clean from any history the curve may have had, making your computer store less info. We wanna do this since we wanna be able to easily restore them to a default position. Next, you wanna select all your IK handles in the Outliner, and Middle Click Drag them to the Control Curve in the Outliner. By doing that, you are parenting the IK handles to the Control Curve. If you've been making IK handles for the other leg at this point, put the correct IK handles into the right Control Curve based on which foot it's for. This is why we rename everything! If you move around the Control Curve, you'll see that the foot will move as you move it. And the legs will change their orientation based on the position of the foot, and the hips. You can also keyframe it as it was bone, which is also neat. But despite all this, we are only about halfway done! As of right now, we have no way to animate the toes, and we don't have a say as to how the knee is oriented. Let's knock out the easy one first. Creating a knee Control. Use either the NURBS Circle, or use the CV Curve Tool to create your controller. This time however, we're going to place it infront of the knee. Like last time, when you're done shaping and positioning the curve, Ctrl+D for the other knee, Freeze Transformations, and Delete History. In the Outliner, select the curve you just created, then Ctrl+Click on the Foot IK; the first one we made. Then pick on Constrain>Pole Vector. How this controller works is that if the legs are bent, the knee will be pointing at the direction this controller is. Moved it to the left? The knee will follow. Now for more robust Foot controls, and here's the reason why I love these custom rigs so much. What we're gonna do now is create custom attributes in the Channel Box that will allow us to rotate the the feet and toes in very specific ways. For this tutorial, we're gonna create 6 of these custom attributes. Feel free to add in more when you feel the need to. Select the LegIK (Leg to Foot) and FootIK (Foot to Toe) with Ctrl Click in the Outliner, and press Ctrl+G to group them. Rename them accordingly. Press the Insert Key with the group selected to change the pivot point of the group, so it can rotate the way we want to as opposed to having it rotate on the origin. We are going to vertex snap this pivot point to the Toe bone by holding V and Middle Clicking it. Press Insert again to exit Pivot Edit mode. This will be our Foot Roll attribute which allows us to Peel the Heel off the ground without having the toes leave off as well. Already, you might appreciate why I like these rigs so much! It's so much easier to manage than to use 2 Controllers which is more of a hassle to me than anything. As of right now however, it's still not yet an Attribute in the Channel Box, but we'll get to that eventually. Right now, we need to create more groups like these based on how the foot will rotate. Select the ToeIK (Toe to New Bone) in the Outliner, and Press Ctrl+G. Like last time, we're gonna edit the group's Pivot Point to the Toe Bone. This will be our Toe Tap, which will allow us to rotate the toes without having to move the rest of the foot. The rest of the controls will have us create groups to rotate the entire foot. So for the next group, select both groups we created, and press Ctrl+G. The following ones will have us create a group comprising of this group we created. A Group within a group. Group-ception! For the sake of this tutorial, I'll give out the names of these attributes, and match them with their corresponding Pivot Point Locations. ---Heel: The edge of the character's heel at Ground Level. ---Tip Toe: The very tip of the character's toes at Ground Level. ---Heel Pivot: The Heel Bone at Ground Level. ---Toe Pivot: The midway point between the Toe Bone and the New Bone at Ground Level.Now to actually turn the groups into Attributes in the Channel Box! Select the foot curve you wanna add the attributes to, and then on the Channel Box, go to Edit>Add Attribute. Where it says Long name, we're gonna give out the names of the Attibutes we've made. You can either type them out normally, or make spaces by typing in capitals like "FootRoll" for example. Click add for every Attribute we're making, and close it when we're done. Now, you see that our curve now has custom attributes. But as of right now, they do nothing. We haven't told the Attributes what they'll be doing. This is the final part to finishing the Leg IK Controls! Go to Window>General Editors>Connection Editor. When you open it up, you'll see 2 charts side by side. It's kinda hard to explain, but basically what we're doing here is telling Maya to make the Attributes of this curve work with the groups we just made. Connecting 2 things together so to speak. Go to the Left Display>Show Non-Keyable. By unchecking this, we hide all the useless stuff, and makes the charts less overwhelming to look at. Do the same for the Right Display while you're at it. Select the Foot Curve, and Reload Left. Then click on the Attribute you want to connect first in the Connection Editor. Then click on the corresponding Group in the Outliner, and Reload Right. On the right side, navigate yourself until you find RotationX. Clicking on it will successfully connect the Attribute with the X Rotation of the group. Repeat this process for all the Attributes and Groups. Selecting the Attribute on the left, and reloading the group on the right. Do note that for the Heel Pivot Group and Toe Pivot Group, you'll want to select RotationY instead. Now you have finished making a complete IK Leg Control Rig! Play around with it to your liking! All that's left is to do the same for the other leg. Creating FK ControlsCreating FK Controls is a rather simpler process since it applies to one bone as opposed to a group of other bones. It simply makes selecting applied bones easier to select since if you think about it, it would be cumbersome to select the bones itself, especially if you're dealing with a cluster of them together. It also makes for a nicer looking rig, so, there's also that... Moving on. Create a NURBS Circle, or create your own shape with the CV Curve Tool in the center of the grid. And rename it accordingly. Press Ctrl+G to Group itself, and Rename it Accordingly. With the Group still selected, find the bone you want the curve to apply to in the Outliner, Ctrl Click on it, and press the P Key to parent it. Go to the channel Box, an press 0 to all the of the Groups Translation and Rotation Values. Select the group in the Outliner, and press Shift+P to unparent the group from the Bone Tree. You'll find it at the bottom of the list. The group now has these random Values to it. Leave them alone and never mess with it, for this is used to get the Control to it's correct position while still keeping the curve itself at a 0 Value. At this point, you can rotate the curve itself to the way you want it. Then Freeze Transformation and Delete History. Open the Connection Editor, select the curve, and Reload Left. Then Select the bone you want the curve to apply to, and Reload Right. Click on Translation for Both sides, then click Rotation for both sides, and there you have it! A working FK Control! Do the same with every other bone you want to add FK Controls to. Because of how parenting works, if we were to make FK Controls from the Hip, to the Head, it would be best if we parented these Curves and Groups respectively. Something that you may notice happening is that if you translate the Hip bone, the controls relating to said bone won't follow. So what you wanna do is parent the child group to the parent curve. In the end, it should look something like this... Creating IK ArmsThe last set of limbs we'll be covering is the Arms! We'll be combining some methods we used in the last two parts, while introducing some new things at the same time. Let's 1st deal with the ShoulderN Bones first. Create a NURBS Circle or use the CV Curve Tool at the center of the grid. Move it so it's behind the ShoulderJ Bone. You can Vertex Snap to it by holding V and Middle Clicking, and then pulling it back. To make the rig easier to work with, you may want to press Insert so you can Vertex Snap the Pivot Point to the ShoulderJ Bone. Once you're done with that, make a duplicate for the other side, Freeze the Transformations, and Delete the History. Select the Curve, then Ctrl Click the ShoulderN bone in the Outliner. Then go to Constrain>Aim [Options Box]. And make sure you match these settings in the following image... You're now able to orient the ShoulderN Bone however you please! But we still have a straight arm, so let's get to that. Take out the IK Handle Tool, and set the Current Solver to Rotate-Plane Solver, and in the Outliner, select the ShoulderJ Bone, and Ctrl Click the HandN Bone. Rename the IK Handle and the Effector in the Bone Tree. Create another NURBS Curve, or use the CV Curve Tool again to make our shape. To get this control to it's proper position, we'll be using the method mentioned in the FK Section. Only difference is that we won't be using the Connection Editor to connect the controller with the bone. Instead, what we wanna do is select the Curve, Ctrl Click on the IK Handle in the Outliner, then go to Constrain>Point. Now, as we move the controller around, the arms will bend accordingly. However, this will also rotate the hand as well. We want full control of our hand Orientation too, so to fix this problem, select the Curve again, then Ctrl Click on the HandN Bone. Then go to Constrain>Orient. Now we have Full control of the Hand! Much like how the Knee is on the IK Legs, we'll need a Pole Vector to get an Elbow orientation. Repeat those steps with another NURBS Circle/CV Curve with the Hand IK. Be sure to have your curve behind the elbow when you place it, and duplicate one for the other side. Last step! This step actually involves those who appreciate the human anatomy, and have a properly rigged ArmNa Bone. If you're not one of those people, then by all means, skip this step. If you are, please follow along. Go to Window>Animation Editors>Expression Editor. In the Expression Box, type in the following, then click create... ArmNa.rotateX = HandN.rotateX / 2;Of course, do take this code into account of the Left and Right Hands since this code calls for specific names. It is also Case Sensitive, so keep that in mind. What this does is make the ArmNa Bone's Rotation X value equal to half the HandN Bone's Rotation X Value. As a result, it will make arm rotations more closer to real arms on an actual person, and reduces your chances of overtwisted wrists. And there you have it! IK Arms ready for action! If you're wondering about the fingers, I'd say they're probably better off as FK Controls. So get that done, do the same for the other arm, and you should be good! As an optional step, you may want to parent all your Arm Controllers and IKs to the Bust FK Control if you have one. Although, if you plan on adding FK Controls to your arms, you may want to disregard this step. Adding FK Controls to IK LimbsNow, what about if you wanna have FK Controls to the arms? I did say that things suspended in the air are better off being IK Controls. What if I told you you could set it up so you can switch between the two seamlessly? Here's how we do it! If you've read this tutorial before this update, go back to the FK Control IK Arm Sections for I have changed a few things.Okay, we have our IK Arm setup we made last time right here! We'll use the FK Method for the ShoulderJ, ArmN and HandN bones. Instead of using the Connection Editor however, we'll select the curve, then Ctrl Select the bone on the Outliner. Then go to Constrain>Orient. Then parent each controller accordingly in the Graph Editor. Now we have what should be working FK Controls, but there is one problem... The IK Controls are still active! We need to be able to seamlessly switch between IK and FK so one of each will be active at a time! To control that, we are gonna create a new Controller, and add 2 custom Attributes to it. IK, and FK. We're gonna use the Connection Editor to apply these Attributes to a couple of things that will not only act as the "switch" between the 2 Controls, but also make the controls easier to manage! Load up the Switch Controller on the left, and the ArmIK on the Right. On the right, click on IK, and on the left, click IKBlend. Find the Orient Constraint in the Bone Tree (Should be parented to the hand bone), and reload Right. You'll see 2 Attributes of a similar name. Click on the 1st one. And lastly, Select the Group that has all the IK Controls and Reload Right. Click on it's visibility. Now for the FK Controls. First, we`ll deal with the Visibility of the Group that houses the Arms FK Controls. Then you'll wanna go to the constrains of every FK Handle found in the Bone Tree, and find the Attribute that end with W0. Now we can simply set these IK and FK Custom Attributes On and Off whenever we like! But don't you think it's inconvenient to turn them on and off one at a time? This last step will make it so that when we turn off one, we'll turn on the other. Open the Expression Editor, and type in this code. ArmIKFKSwitch.FK = 1 - ArmIKFKSwitch.IK;Of course, this is assuming you've named your switches exactly the way I did. Like last time, take note of which side you're doing as well for this calls for specific names. That's essentially it! You now have Arms that can work both IK, and FK at will! And like the Custom Attributes on the foot, you can keyframe these as well. Because this is a Boolean attribute however, the default Tangents will come as stepped tangents which is essentially Mr.G&W Animations. You can however select your keys, and make it an Auto Tangent instead, making transitions between IK and FK alot smoother. If you wanna do the same for legs, it's essentially the same steps. Granted, there are a few differences because of the way we did it. I'll have to experiment with it myself. I hope this is of use to you guys! Do feel free to address anything if you have problems cause I can guarantee, you will. I even had problems Re-Rigging this model for this tutorial. Bones start rotating when parenting IK Handles to Curves, some IKs don't bend properly... idk what more there is but to be honest, these problems probably wouldn't occur if the bone structure for these models weren't so weird. Her Right Leg's Default Rotation has it's X Rotation set to 180 Degrees for crying out loud! Same with the Right ShoulderN Bone! Geez... My solution to this would be to delete your controllers of that joint, fix the bone rotations, and start again. It should work the second time around. As far as Baking goes, it's not much different from the tutorial I linked back at the start of this tutorial. Select the entire Bone Tree, Deselect any Effectors in it, as well as the extra toe bones, bake, then Export the Selection as an .anim file. That's pretty much all there is to it.
|