How to Rig an IK/FK Spine in Maya

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi my name is Michael Schwartz I'm going to show you how to break up a spine in Maya 2015 alright the first thing let's just put this geometry on a display layer and this will just give us better control while we're building our rig we can turn it on and off so let's call this geometry save that and let's also template it so that we can see through it but we won't accidentally select it while we're building our rig alright the next thing let's go to the animation menu and go to skeleton joint tool and reset that tool so it's default and my character is about five grid units tall but I want to have six equidistant segments in my spine and it should be going perfectly vertically straight up and each segment should be the same size so to do that in this sort of situation I would still use the grid to snap okay so I will snap with the X key held down onto the grid here and I'm making one two three four five six and seven joints for six segments okay now what I need to do now is to scale my my joint chain down now if I just select if I just start scaling now I'm only going to be affecting the first joint in the chain so I need to open up that whole chain select them all and then scale down until that joint chain fits my rig alright so now we have our joints created they're in the right place and they are straight up in a straight line and but it has some scale values on it and we don't need that we don't want that so what I do in this case is I put that on another layer let's temporarily reference it so you click that button until it turn switches to R and now we can use the joint tool again and vertex snap holding down V okay let's delete that first chain because now we have a new chain that has zero translations and scales on it and I'll delete that layer we don't need that layer anymore all right the next thing I'd like to point out is why I put spines in a straight line and if you draw of you know if you look at any human back they're always in this sort of shape right sort of an s-curve like a backward s so that is you know realistic it's I mean maybe not that exaggerated but you get the idea but if we take a closer look at this and look at the rotation orientations of all these joints let's go to select them all and then go to transform display let's add that to the shelf that local rotation axis so now we can see that these joints are all oriented differently and consistency is really important if I were to you know rotate that joint and that joint which are different right but if I were to rotate them in X they they rotate very differently and that's a problem what if I was going to rotate Z so one is going forward and one is going backwards so that's very unpredictable and yes you could reorient all of these but it would still not behave the way that it should so even though in the real world a spine looks like that it's not actually the best way to rig a spine aspire to be in a straight line in the computer graphics world and it makes the bending and deformation results much more predictable and natural okay so the other thing I'd like to point out is some some of you may see your joint icons either very small or very large you can adjust that over here and the radius so if I type in let's say 0.3 all the joints will change size you can also get at that control under display animation joint size and this is another place where you can change all those at once okay so I'm just going to leave the set point three Doh okay next thing is we need to name our joints so these are all going to be bound to that torso so I'm going to call them JTB for joint bind JTB spine oh one it's copying that first part of the name that's three one two three four that's five this is six and seven now this last one is a terminal joint and it's not going to be bound so I'm going to call it J te for joint end alright next step is we need to set up the rotation orders for all of these and we're going to do this for all of the controls on the spine they're all going to be Z X Y and to do that you just go into the attribute editor and look in the transform of the joint and you can see that there is a rotate order set to XYZ that's the default in Maya but in our case for the spine we would prefer to have the rotations be in Z X Y and that will help us not run into gimbal lock where you know basically - you can see an example of it right here if I rotate the character forward notice that X and Z are beginning to meet and become parallel with one another that's called gimbal lock and and I cannot rotate either one of these they both do the same thing so I've lost one of my three axis of movement so that's definitely not what we want and we need to change their rotation order to be Z X Y now I could do this one at a time or I could do a quick little script so let's I'd like to show that to you because scripts and Maya are incredibly useful and if you plan on doing any rigging and and so on in the future it would benefit you to make tools and add them to your shelf as you go so for this script I'm just going to make a very simple script that's going to look at everything in the selection and set a value and attribute on all of them all at once so to do that you make a for loop so I'm going to type here in my script editor for and then parenthesis open close and we're going to inside that parenthesis put a string variable here it's going to be dollar sign selection in and then the tilde key LS - SL - L and then close the tilde key and after the parentheses we're going to open up a bracket so a left bracket there hit return and down here we're going to type set adder and then in parenthesis we'll type in our variable again selection and we'll have a plus because we're going to concatenate this attribute to all of the things in our selected list so selection plus quotes dot rotate order end quote alright and then outside of that parentheses we're going to type two and two is the flag for zxy you can look that up in the documentation alright so we've got the script now and I'm just going to I could select all the joints or I could drag it up to my shelf first let's do that alright and let's select all the joints in the chain and click our button up here and now if we look at all of the rotate orders they're all Z Z X Y good alright so if I want to make this a little more clear I've already made this button previously I just called it Z X Y to do that you just go to edit shell and you can give it a little descriptor here you could say set rotation orders to Z X Y on selected objects okay and then we'll call this Z XY - all right so now we've got a button up here I'm going to delete it because I've already got it up on my shelf from a previous project ok next step is we need to make a spline ika handle that runs through this joint chain so to do that let's go up to skeleton I case spline handle tool reset the tool here and we're going to go from the base to the to the end joint and let's rename this while we're here I can handle spine this is going to be curved spine and here's the effector in the last joint at the end of the chain let's name that as well effector spine now this control curve here is what controls the back so I could rotate the back and all the axes that way I can move it around and all I'm doing is I'm moving that curve and that also means that I can drag move the components on that curve and affect the spine as well so if I go to component mode and let's turn everything off and then just act only turn on the NURBS CVS I can grab a CV and the whole spine will Bend so there's lots of ways that you could set up a spine one way would be to perhaps add some sort of deform or like a cluster to each one of these CVS and then you could move and rotate transform the clusters and to affect the back or what I like to do is what I learned from Jason Schleifer who's a master rigger he has another approach where he creates a joint at the bottom of the chain and a joint at the end of the chain and those are bound with a smooth bind to that spline curve for the spine so I'm going to go back into object mode and I'm going to do that I'm going to duplicate my chain here because I know all my rotation orders are set correctly so I'm going to duplicate that control D delete all the children inside of it and this is going to be called JTB hips and I'm going to duplicate it again and this is going to be JTB shoulder shoulders all right so if I just look at these three things on their own hit shift I to isolate selection the shoulders so on top of the the hips right now let's actually move that up shoulders snap it up with a V middle-mouse snap it alright let's select these three things shift I to isolate selection a shortcut button for that is right here alright so for this right now I want to just bind the the curve to these two joints and then I can control these two joints and the whole rig will move so I'm going to select all three of them and go up to skin smooth bind and let's just reset the settings and select a joints for the bind to bind skin and now if I move those joints here's the hip down here the whole curve moves and I can rotate it all kinds of things right and the whole rig will move so you can see it here alright great so that's that's what we want now let's build some controls for those two joints and what I've learned from other riggers you know making a great interface for the animator definitely pays dividends it makes the animator more efficient they're happier less complaining it's great so what I found is a very good icon for the hips and the shoulders is something that will indicate to the animator that can be rotated and translated so some sort of combination between a circle and an arrow is good for both and but you don't want to get in the way of the rest of the character so keep it simple and keep it tight and close to the character so for this I'm going to draw a circle and I'll just show you this one and then I've already made buttons to do these things so I'll just show you once how how you do this and then I'll fast forward the video so you don't have to watch me set it up but again it's good to make a shelf you can make a custom shelf go here make a new shelf just call it rigging whatever you want and put all your tools up here that you build as you go so you don't have to redo complicated things like this over and over again so I'm going to type three for the actually let's do two two for the scale on that and go to the top view and we'll draw an arrow so I'm going to create let's do ap curve tool and we'll set that to be linear and I'm just going to snap to the grid one two can you hit return so and I'm just going to move I'll scale all these down and maybe like that and then pull these CVS over to the curve all right and let's go back into object mode alright now I'm going to rotate duplicate and rotate this three times ctrl D and rotate with my rotate tool and J to snap to 15 degree increments and then shift D to duplicate two more times okay so the way I do this is I select all those curves including the circle put it on a layer display layer and reference the layer and then from the top view using my CV curve tool so we'll go to create CV curve tool make sure it's a third degree curve all right then from there I can hold down my C key to snap to the curve right there so C and I'm going to drag click and drag three times down to create a point and every time there's a corner you have to click three times notice I just went off and it snapped up here I can middle Mouse drag that back ok where it needs to go so one okay now left mouse two three and we'll just do that on each of these corners and now we're jumping over to the circle part and here's the arrow again so let's left mouse on that two three okay so I'm going to fast forward the video here and show you how to set it up as a button on your shelf okay so I finished up the icon here and now I'm just going to go into my script editor and copy the code that made that curve and it's right here and let's just middle Mouse drag that up to my shelf it's a mel script and we can delete all these curves and now if i click that button boom I get my control curve there so that's a great way to create icons once make really nice icons all as a single curve without having to combine any shapes and just click the button and boom you've got that shelf you can take it out wherever you want alright so from here let's make the shoulder controls as well I feel like maybe this this these arrows are a little bit too wide so I made another script that is a little bit tighter and I can scale that down like so I think that works a little bit better for me and I'm going to clean that up with all the rotations and transformations and so on so let's breeze transform and delete the history on that cool all right let's do the shoulder now and the shoulder is going to be a similar type of icon but the arms are kind of in the way so we'll build it and from a side view instead of a top-down view so I'm going to create a circle let's rotate it and Z and let's scale it up a little bit all right same idea from the side view we'll draw some arrows and let's just click with the X key to snap to the grid and I'm going to scale that and bring it closer okay and maybe hold that in a little bit okay so I want to have that on the other side as well so let's duplicate it rotate it in 180 X you know perhaps scale this up a little okay so that will be our icon we just have to trace it and make a button for it so again I'm going to grab these and put them on that layer that I made previously and now they're referenced and I'll I'll start tracing over this so with the CV curve tool so create CV curve tool let's start right here hold down see one two three and we'll do that at each corner three clicks for each corner and I'm going to fast forward the video so you can see the result okay so I finished up this icon and let's grab the code for that as well and here it is just triple click and to select the whole line and bring it up to the shelf it's a Mel script alright great so we've got some nice controls here and we've made buttons for them so if we ever have to make a character again we can use those very quickly I'm going to grab all these and just click on my button there that I just made so we have a nice icon for the shoulder so this is going to be ctrl shoulders annum and this one right here is going to be for the hips so ctrl hips annum I'm sort of redundant my namings I want to let the animator know that this is a curve to be animated and so I tagged it with an 'm it's also a control curve and i make a distinction between two different kinds of control curves in maya there are control curves that I want the animator to touch and control curves that I don't want the animator touch or maybe they only touch them once when they load up the scene so that's why I call them control and then have an it's a little bit redundant but sometimes I have controls that are not animatable so I do not include that suffix alright it's also easier to read in a list and I can select them up here just by going to select by name and I could type in wildcard annum and it will select all the animation curves that I want the animator can could control it I could theoretically from there create a character set which would have all the cable attributes for all of the animated controls so it's good to name your things carefully like that alright now we need to set the rotation orders of these two zxy to match the spine so I'll select them and I'll use our button that we made previously zxy and it just set the rotation orders of the transform to Z X Y for both of those the shoulders need to be moved up here and and then from from there we will create well let's freeze transforms on that actually so these two controls it's freeze the transformations all right now we just need to put these two joints in the right place so the hips goes into the hips and the shoulder joint goes into the shoulders and imperf now I can grab these controls and move them around alright I've got my rotation set to gimbal still but if I go to object mode I can just tumble by grabbing right in the middle all right so these are working but notice that there's no twist and there is a twist attribute on the I K right here folks so if you select ika handle and go over to the attributes over here there's a roll which is like they all roll the same there's twist I want to connect that twist to these controls to do that you go into the attribute editor for the ika handle tool and I'm going to copy this tab so that as I select different things the win dough stays up and I don't lose it so click copy tab we can close that now so this with this copy open up the eye case solver attributes and go to advanced twist controls and we're going to enable the twist controls and select object rotation up start end this is going to be negative Z okay because the up part of the back is toward negative Z this is going to be 0 this is minus 1 0 minus 1 the world up and object 4 1 & 2 is going to be the hips and shoulders so if I go over here and just copy the hips that's going to be the first one and then the second one is the shoulders okay now if I check this out they twist nice ok so the next step is to do to create some FK controls to do that I'm going to duplicate this joint here and delete its children and rename it and the reason I do that and I do that often is because I want to just duplicate everything about that joint the rotation order where it is so it's easier to do that for me I'm going to call this JT FK spine o 1 and I'm going to duplicate that and snap it to that third joint and we'll do that again duplicate and move up to this joint and ctrl D again and that on the end okay so we have these 3 FK joints and they're separate right now they're not part of the same hierarchy so shift I just to show you this in isolation mode I want this to be a parent of that so hit P to parent select this then this e to parent this this D to parent you could also do middle Mouse dragging in the outliner to do the same thing alright so for these controls we want to just be able to rotate the character you know around like so and you know these controls should match the worldspace controls of the animator that they would be dealing with so right now they're not correct let's go to our local rotation axis and you can see that X is pointing down the chain but actually we want in this case we want Y to go down the chain so let's switch that let's select everything in this hierarchy go to skeleton orient joint and we'll do Y Z Z you can reset the settings and just click Y Z Z click apply alright so now you can see if if you look at the little compass here in the bottom left corner Z is facing forward of course X is this way and Y is up so we have these matching art what our animator would be animating the one thing though is this last joint which doesn't provide any real animate animation or manipulation for the character I still like to be clean about it and I zero it so that the joint orientations are zero and they're basically inheriting the orientation of the parent alright let's turn off the local rotation axis on those and let's also set the rotation order because right now the rotation order oh they are correct of course because I do i duplicated from the previous joint but if they aren't you know you can just grab all those joints in the chain and run our script Z X Y and that will fix that shift I to go back alright now the next step is to set this up so this control right here this curve I'm going to group this and this group is going to be called GRP shoulders offset alright and let's set the rotation order of that as well to Z X Y and I want that pivot point to be up here so I'm going to hold D and V and middle-mouse snap it D and V and middle-mouse snap the pivot point up there you can also hit the HOME key or insert key on your keypad and that will go into edit pivot mode as well alright so that basically is going to be driven by the the last joint in that case that the third joint in the FK spine so I'm going to select that third joint and then command click on the offset group there and parent alright so now if I rotate anything in the chain the ika rig follows so basically the I K is a is a child of the FK that's what I just done here so there's a parent constraint inside there alright and then let's let's create some controls for those FK rotations so for that let's just create some circles so we're going to NURBS primitive circle and let's scale it up so that it goes around the model you know perhaps like that and let's snap it there let's duplicate that snap that to the other FK joint alright so if you look at these in isolation let's get the FK chain and then these two curves that we've just made this is what we have so far and we want to connect these to the rig but before we do that notice that there's all these transforms on it and so on we need to get rid of those and clean it up so here's another opportunity to create either a script or button on our shelf to do this sort of thing because we're gonna have to do this over and over and over again let's save ourselves some hassle and time and make a script that will do this once and for all so open up the script editor and here's another little trick if you go to new tab let's make it male script here I'm going to clear the history so we'll go to edit clear history and I'm going to turn on history echo all commands and so you can see everything that we do so I'm going to select these two curves and go to let's Center the pivot freeze the transforms and then delete the history so delete all by type delete by type history now we can turn off echo all commands and we do have to do a little bit of wading through all these scripts that were generated automatically but you can kind of see what you need pretty quickly here's our selection see here's the center pivot and X form we just need the center pivot and the freeze transformations that's going to be an end of the line and delete by type history is the one we're looking for now here it is delete history okay so here's our script and I don't want to have to do that over and over again so I'm going to middle Mouse drag that up to my shelf and edit it and let's let's just call it clean okay and we'll change yet we'll just leave the tooltip what it is center pivot freeze transformations delete history and you know what you could change the color of that to be red so it's a little easier to see and maybe darken up the background behind it save that great alright so now we have these control curves all cleaned up we just click our button I'm going to delete these two don't need those right now those are the curves that I made previously but I already have some control curves for that okay so and now I want to change the color of these to be a little easier to see so I'm going to go into the country attribute editor for it and go to display drawing overrides enable override and choose a color like blue let's do the same for this one okay shift I to go back into the main view here and I want a parent or I want to parent constrain those joints to these curves so I'll select this one right here let's call this ctrl F K spine oh one oh and this is going to be an ax and this is going to be ctrl F K spine o to annum alright now this curve right here is going to be a parent constraining spine 3 ok so we go up we select the curve first then the joint and then go to constrain parent this one is going to be controlling is going to be controlling that joint right there actually what we can do is just put this inside it the first one so now if I rotate this bottom one the whole rig moves but I also have control over that one okay let's just do a little bit of cleanup here select that control go into the attribute editor enable overrides and let's change it to be a yellow color all right great so let's do some cleanup we don't need this layer anymore let's delete that and let's clean up the controls in this I don't want the animator to be worrying about the scale and visibility so I'll delete that so we'll lock and hide the selected on that let's also get rid of the scaling visibility on the hips as well these I only want the animator dealing with rotations so I'm going to get rid of the translate hold down command or control on a PC and right click lock and hide selected so the animator is only working with rotation on the FK and let's make one more control that will control the overall torso okay so we'll go up to create EP curve tool make sure it's set to linear look at this from the top view and I'm going to hold down the X key and snap a square I'm going to make a square icon you know and believe it or not there is no square icon in Maya that's all one continuous shape the one that is under NURBS primitive square actually creates four different curves so if I want to use that curve over and over again down the road let's just grab that code as well bring it up here let's rename it make a square control curve and then we'll just call it s qcb all right so if we ever need that again well just click that button all set now let's call this ctrl or so and and I'm going to put all of these controls inside of that so the the FK spine controls are going to go inside their the hips control that's going to go in there the shoulder is a little different for this if we if we rotate this now you see it moves just fine so we actually want to keep the shoulder offset outside of that particular hierarchy but to clean it up let's put them both inside of a group called control curves so can control G GRP and this will be animation control curves or something like that okay and we can also change the color unable overrides make that yellow as well so now we can rotate this but we also have offset control for the hips we can move it around same with the shoulders and we have FK control on top of all that so really cool a really nice dynamic rig here and you could add a stretchy spine to this as well as a second layer but I'm not going to cover that in this particular tutorial let's bind it to the geometry and just make sure it makes sense and it works so I'm going to unten select the select the the bind joints so to do that quickly what I can do is well you know in this case let's just drag down and select these first six joints I don't need that terminal joint to be a part of this though and we'll just click on that geometry there and go to skin smooth bind and we can use just selected joints closest distances fine we could do a weight blended if we wanted to that gives you a little more control because it includes classic linear and dual quaternion there are some newer methods by the way that are really amazing in 2015 but I'm just going to use the older method because not many people not might not have it but geodesic voxel is the newest version of the skinning method and it's just it's really incredible I'll leave this on interactive either one should do fine post or interactive but we'll leave that max influences let's decrease that to 4 and we will increase the drop-off rate to about 6 and let's click bind skin now we can reference the geometry so we don't accidentally select it and let's do a little more cleanup and put all of the skeleton stuff into a joint folder so we'll call it group skeleton and let's make another one for the eye K stuff so that I can handle in the curve the spine curve GRP spine uh let's call this I K so group I K and then let's group all of these things together into a group GRP character node all right you can name it whatever your name is for your character let's put the geometry into a group as well GOP GRP geometry and for that geometry I'm going to actually remove or empty the layer and then just have that group be on that geometry layer alright so now we've got visibility control on that I'm going to hide the eye case stuff so ctrl H and the skeleton I'll hide that as well but the animation control curves I'll leave those on and I'm going to hide these two joints that are inside the control curves so if I go into the those control curves you can see that there's that joint and then there's this joint I'm just going to ctrl H to hide them all right now it's pretty clean except this last piece I need to get rid of the scale and visibility on that lock and hide okay so that's translate rotate translate rotate these are rotate alright let's test it out okay we have twist we have FK control we have over all torso control and move it around and we have rotate on the hips all in all this is a really solid rig I've worked with this rig for a long time now and I haven't had any problems with it I hope you enjoyed this
Info
Channel: Michael Swartz
Views: 17,273
Rating: undefined out of 5
Keywords: Maya, Spine, Torso, Rigging, IK and FK Spine
Id: vhGCGe1dLxA
Channel Id: undefined
Length: 40min 53sec (2453 seconds)
Published: Mon Apr 13 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.