Blender: unwanted stretching, bending and twisting in Rigged characters

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to cg dive if you have a rigged mesh and part of it bends and stretches even though you want it to stay rigid and solid then the reason is often the weight binding the mesh is affected by multiple bones so it bends however if the vertices are affected by only one bone yet the mesh keeps bending then your rig is probably using bendy bones even though you don't realize it and this is a common problem with rigifi that people ask me about but it can happen with any rig that uses bendy bones so here is a very simple example to show you how this works i have this strange looking object and it is weighted and parented to an armature so if i go to pause mode and rotate these bones you'll see that the object bends and squashes a little bit and if i first go to object mode and then select the armature then shift select the object and go to weight paint mode we can see that the weights are fairly smooth which creates this bending effect if we want this part of the mesh to be fully controlled by this bone then of course we can do weight painting but i think there is an easier way to do it probably the easiest one in my opinion so let's go to object mode i'll select this object go to edit mode and select one of these vertices and you'll see how it is affected by multiple bones and as we go further down you'll see that the effect gets stronger so i'll select just one vertex and then turn on x-ray and select all of the other vertices of this part of the mesh that i want to affect and now again i have to shift select one of the vertices to make it active and here in the side panel under item i can see the vertex weights so what i need to do is i have to set the weight for the bone that i want to affect this part of the mesh to one and all other to zero and then i'll press the copy button and that will copy these values that i just set for the active vertex to all of the other selected vertices okay now i'll do the same for the remaining two segments of the mesh here bond zero zero one needs to have a value of one and the other one's zero and copy and one more time and now if i go to object mode select the armature shift select the mesh go to weight paint mode you'll see that this part of the mesh is fully controlled by this bone and it doesn't bend okay it stays solid however if i go to object mode select my armature and go to pause mode and let's bend this a little bit to see what happens now if i go to the bone tab and bendy bones and increase the segments you'll see that the mesh immediately started bending and if i do this again for the next bone it will become even more pronounced and then if we go to the armature tab viewport display and switch display to b-bone it will become apparent why this happens with bendy bones planar creates these virtual bones that automatically create a curvature if i remove the bendy bones then the curvature will be gone so bendy bones can be very powerful but at times they can create unwanted effects so next we'll see some practical examples and how to deal with them and by the way just a quick tip if we go to edit mode here for the mesh and check the vertices you'll see these zero weights you can manually delete them by pressing the x button but if you want to do it automatically just go to weight paint mode and from the weights menu choose clean all groups and a limit of zero and you can check keep simple just in case and now if i go to edit mode you'll see that all of my bones that used to have zero weights do not have them anymore okay so now you should understand the problem and you should understand how to set weights using the vertex weights menu so now let's move on to some practical examples okay so here is the first practical example i have this soldier character here i have my rigidify meta rig which i'm going to generate right away boom and then i'll hide the metal rig and so on this character i have these pouches which you often see with military type characters and also buttons and these pouches and buttons are common examples of this problem that i see often so let's parent these meshes to the generated trick with automatic weights and it is not going to work quite well and so this part of the mesh kind of works but if i move the hips you'll see that part of the mesh weren't quite weighted while i was testing things i also got bone heat waiting area which is another very common area which i'll do a separate video about but here really quickly if you want to avoid such problems and you're okay with paying some money for a paid add-on then you can try the voxel heat diffuse skinning add-on so i'm going to undo the parenting with automatic weights and i have the add-on already installed i'm going to go to the mesh online tab and click voxel heat if you're skinny and it takes a couple of seconds but now you'll see that the character is weighted correctly there is no waiting area and no floating parts okay i'll do a separate video about waiting areas there are different ways to solve the problem voxel heat diffuse skinning is probably the simplest solution it is very very good it has some weaknesses that i've noticed for example fine areas like the mouth but anyway that is a topic for another video so now we have the character weighted and let's see how everything bends if i bend the hips you'll see that this pouch stretches and this one compresses and if i rotate the chest you'll see this button kind of stretch so part of this problem is the weighting so i'm going to quickly fix the weighting just like i did in the simple example a minute ago so these pouches need to be weighted fully to the spine one bone actually to the def spine bone so this one will be one and all other groups will be set to zero and then i'll just copy these values and then same for the other pouch copy and then the buttons let's actually unhide the deformation bones so that we can see what we are working with so this is spine zero zero one zero zero two and zero zero three so this button needs to be weighted to zero zero one [Applause] this one to zero zero two [Applause] and this one to the last spineball okay now if i select the armature and then let's say i shift select the this button and go to weight paint mode and control click on the last spine bone you'll see that it is fully weighted it is completely red so it's fully weighted to this one cool now i'm going to unhide my controls and even though the buttons are fully weighted to their respective bone they still kind of stretch okay stretching in here as well the pouches kind of stretch and squash um it's not as bad as before but still they do and you probably understand the problem by now it is bendy bones so let's display bendy bones and now if i select these deformation bones go to the bone tab bendy bones and set the active one to one and then ctrl and choose copy to select it then the bendy bone effect will be gone and i will if i rotate this control the pouches will stay solid they won't bend and same with the buttons okay now the buttons don't bend but there is another problem with them that they don't really behave as if they're attached to the clothing and not only that but you may also be asking yourself what if i want my bendy bones but i also want the pouches to not stretch and i'm going to be answering these questions in the next minutes let's start talking about solutions now in the simplest solution we already kind of covered if you don't care about bendy bones just disable them just select the bone that you don't want to have bendy bones and if it has any just set segments to one and that will disable the bendy bones since we are talking about rigify i have to mention that if you go to your meta rig and generate again then the bendy bones will be back rigify always creates bendy bones for the spine and there is no way to turn them off from the meta rig for example for the arms which i'll talk about in a second there is a metric setting that you can tweak but not for the spine so we can turn them off manually it's not a big deal but if you want to automate it there are a couple of options if you have our game rig tools add-on under cleanup tools we have the remove b-bone tool you just have to have your rig selected click it and that will remove all bendy bones from your rig so if you don't want any bendy bones that is a quick solution and if you only want to affect the spine i'm going to undo and i'm going to create a text editor here create a new text and here i'll paste a little script that i wrote so if i run this script now you'll see that it removes the bendy bones from um from the spine here it is again and this exact script will work for the default human meta rig if you have something else you may have to change this ring name or the bone names and by the way if you're working with blender 3 let's name the script remove spine bendy bones so if you're working with blender 3 or higher you can go to your meta rig advanced options and you can include this script in here and now if i generate the rig it will generate the rig and then immediately run the script so so now if i check my deformation bones you'll see that the bendy bones for the spine are disabled okay moving on let's talk about the solution where we can keep the bendy bones for the spine but still get a solid behavior from the pouches okay i'm going to go back to my meta rig remove this script and generate again and now i'll have bendy bones again so one possible solution is to add an additional bone that doesn't have any bendy bones and parent it to the bendy bone in this rig it just so happens that we already have such bones for example these pelvis bones so let's try to attach this pouch to the pelvis bone i'm going to go to object mode select the pouch and it is currently parented to death spine so let's select their spine select all vertices and click remove and then i'm going to search for the pelvis spawn select pelvis l and assign okay now i'll display the controls and if i rotate this control you'll see that this pouch here which is parented to the bendy bone still stretches but this one which is parented to the normal bone does not stretch it is stable okay so if we wanted to fix this pouch as well we would parent it to the pelvis bone again let's do it first remove the influence of the spine bone and then assign all vertices to the pelvis are bone okay no more squashing and stretching for the pouches okay and if you want to do the same for the buttons you would have to add three more bones that is a little bit of a disadvantage of this solution you may need to add a lot of additional bones but that is not such a problem so for rigify i'll add the additional bones to the meta rig go to the meta rig and go to edit mode add one more bone and i'm going to press f2 and call it button one position it at the button and in pause mode i'm going to give it a rig type super copy and i'm going to keep the control option you'll see why in a second edit mode and let's create two more copies for each button and now i'm going to parent each button bone to the closest spine ball and generate and now if you look at the deformation bones you'll see that i have additional button bones so now i need to make sure that each button mesh is only assigned to the button bone so they still have the armature modifier so i could delete all of these groups for all of them button meshes and then i can select the rig then shift select the button go to weight paint mode and control click on this button bone and go assign automatic from ball and that will fully assign this mesh to the button ball and let's do the same for the other buttons okay now if i move the controls the buttons will not stretch there's still a problem with extreme rotations where the buttons will clip into the cloth and we'll be solving this in a second but here because i created controls i can also manipulate these buttons individually anyway let's move on to the next solution and the next solution is one where we will actually attach these buttons and pouches to the cloth mesh itself rather than assigning them to bones and so first i need to detach these props from the cloth so to fully detach one of these props i need to first unparent it and that will delete the armature modifier if it's still there you have to delete it and then also get rid of the vertex groups and by the way again if you have game rig tools you can do this quicker i'll just select all of the props and then go to utility tools unbind mesh okay and just press ok and that will remove the vertex groups remove the armature modifier so these measures are now independent from the rig so to attach them or to pin them to a part of the mesh here's what we can do for example for this pouch actually let's first hide it and then i'll select the main mesh and go to edit mode and i want to attach it right here so i need to select three vertices exactly three and by the way they don't have to be adjacent vertices just to show you i'm going to select this vertex for example and that will create a little triangle on which our prop will be attached um so let's go to object mode unhide the pouch and i'll go to edit mode and deselect all vertices then i'll shift select the main mesh go to edit mode and now i still have these vertices selected so i'll press ctrl p and choose make vertex parent now if i go to my rig pose mode and move this part of the body you'll see that the pouch is attached to this part of the mesh okay let's do the same for one of the buttons deselect all vertices for the button then go to the mesh edit mode and here i kind of don't have enough vertices so i'll add some and select three vertices go to object mode select the button shift select the main mesh edit mode ctrl p make vertex parent and now this button will be sticking to the mesh okay i'll quickly do the same for the remaining props and when i'm done all props will be sticking to the main mesh and this will probably give you the most stable behavior the props will be sticking exactly to the mesh and if you want the props to be assigned to bones then you can make the bone stick to the mesh but not directly bones cannot be parented to vertices like meshes can but empties can be parented so i'm not going to show the whole process but you can add an empty here and parent it to three vertices now the empty will be sticking to this vertex and now i can add a bone constraint and you could use child f but probably copy transforms will give you the most stable behavior and the target will be empty and you'll see that the bone orientation flipped a little bit and there are other details that we could talk about but i think i'll make another video about that because this technique is rather advanced and here is a second practical example we have this robotic character and we want to make sure that it moves is a robot in other words we don't want it to deform too much and rigging a robotic character with rigify is something that people request a lot so i'll make a separate step-by-step tutorial about that but here i'll give you the main hints and techniques that you need for something like that so so here i have the metric already set up and most of the rigidify settings are in the default state so let's generate the rig and let's try to parent with automatic weights and here if i rotate this hand you'll see that the upper arm is twisting and let's see what we can do if we didn't want that so first i'm going to shift click on layer 29 to display the deforming bones and now let's rotate the hand again and you'll see that there is this so-called twist bone that is twisting this part of the arm so this is the first thing that we need to solve for a robotic character we don't want any twist bones so let's go to object mode and go back to our meta rig pause mode and select the first bone of the arm go to bump tab rigify type and you'll find this limb segment settings if you set it to one then riggify will not generate any twist balls and we have to do this for each limb individually okay let's generate again because we change the number of deformation bones things will be a little bit messed up so let's go to the mesh and delete all groups and parent with automatic plates again now if i try to rotate the hand it will still be twisting if i show the reforming bones and rotate again we see that this bone is not twisting at all so why is the mesh twisting then and this has a little bit to do with the weights but mainly it has to do with bendy bones again if i switch this blade to bendy bones you'll see how the bendy bones are twisting if i select this deforming bone go to the bone tab bendy bones and set segments to 1 you'll see that it will stop twisting okay now this ball is kind of twisting but we can easily solve this by tweaking the weights so just select one vertex and press l to select the remaining connected vertices and here i want this ball to be deformed by the hand i guess so let's set the hand weight to 1 and all other weights to 0 and press copy now back to the armature if i rotate this you'll see that there is no twisting okay and you may find similar problems in the shoulder area in the leg and so on and you can solve them in the exact same way the last thing that i'm going to show before i wrap things up is that you can remove the bendy bones right from the meta rig so this bendy bone for the forearm we kind of tweaked manually but instead what i can do is go to my meta rig pause mode and again select the first bone of the arm go to the trick type options and under limb segments there is another setting which says b-bone segments and it is set to 10 if i just set it to 1 and do the same for the other limbs and generate you'll see that the deforming bones for the arms and legs now do not have any bendy bones the spine still does and as i said earlier rigify does not give us any rig type options for a spine but we can remove them manually or you can use the scripts that i showed earlier if this video has been useful please click like and subscribe if not let me know in the comments and by the way if you join my supporters on patreon or gumroad you'll get access to unreleased videos
Info
Channel: CGDive (Blender Rigging Tuts)
Views: 59,345
Rating: undefined out of 5
Keywords: blender3d, b3d, rigging
Id: CVRka6XEQmY
Channel Id: undefined
Length: 23min 36sec (1416 seconds)
Published: Thu Apr 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.