Rigging a character for Unreal Engine with Blender, Rigify and Uefy 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back everyone today we're going to rig this character and take it to unreal engine 4. this character we're rigging already has a skeleton and you might wonder well why don't i just use this skeleton it already has one well there are many reasons for one thing it doesn't have a root bone it doesn't have twist bones there are no ik bones it's also not compatible with the original mannequin skeletons you can't import it on top of that and you'll be locked out of a lot of functionality that the engine offers if you don't have the correct bone hierarchy also the most important reason is that this skeleton is not suitable for creating animations if you want to make new animations you need a proper animation rig like the one that prigify provides now before we get into the step-by-step guide let's take a brief overview there are three stages to rigging this character in the first stage we will rename the bones update the bone rolls and get this character to be in the same pose as the unreal engine mannequin we have tools in ue5 to help us do this in the second stage we add a metal rig and adjust its pose to match the character it's nearly automatic we just need to adjust the spine a little and the third stage is almost completely automatic you just tell ue5 to make the rig compatible for unreal and it's taken care of all right then let's get started i'm going to select everything with a x2 delete then in scene properties set the unit scale to 0.01 so unreal engine doesn't have problems later now i can set the view clipping distance to 50 meters so we have the full range of view then i could do file import fbx and find my character's fpx file now i don't want any animations and in armature i'm just going to import it as it is now i can select the armature go to armature data properties take viewport display to the top and put it in front while in object mode i'm going to click on the mesh and in item properties i'm going to make sure that you mesh it at location 0 it has 0 rotations and the scale is 1 1 1 and then i will click on the armature and then check these values again so again we need zero here we need zero rotations on this so we'll have to fix this and the scale on this is also one one one so that's good otherwise we might have had to fix that as well now i'm going to go into orthographic view with the 5 key and then i can scroll down here to uefi expert tools and i will click on any of these meshes this armature has multiple meshes attached so just pick any one of them and i'm going to click on extract mesh so that'll extract that'll separate all of our meshes from the armature so they are all now standalone objects and then i don't want to deal with multiple meshes in this video so i'm just going to join them together but this process works just as well with multiple mesh objects so you can keep them apart if you want and i will just select everything there and do ctrl j to create one single mesh and then i can do r to rotate x to lock the axis and then nine zero to put it back in place now again look at the item values here for this single mesh object we have rotation of 90 here we need this to be zero we need these to be zero and we need scale to be one one one so what i'll do is ctrl a and then apply all transforms so that fixes our mesh object if you had multiple meshes you would need to repeat this process for each one of them individually then i can select the armature and then again check these item values so for the armature again we have a rotation here so we need to fix this now if i do control a uh apply all transforms that should take care of it the second thing that you want to check for your armature object you go to edit and then and then you go to pose mode pose mode and edit mode okay so use the tab to uh cycle through these modes and there should not be a change here if your armature is moving about that means that your rest pose is not the same as your uh animation pose so what i what i'll do is i'll go to the pose mode and then i will do control a apply pose as rest pose so now the two should be the same if i go back to edit mode or pose mode there is no change with the armature and the mesh fixed separately now i can go to object mode select the mesh shift click on the armature and then do control p with our maturity form and this will reconnect both of them so now we have a single character again so you can just test this by going to pose mode and see that it is working now we can go back to object mode and then just confirm once more that we have the correct rotation and location and scale for both of these objects individually now it's time to bring in the unreal engine mannequin so i'll just create a new collection here in object mode i will go file import fpx and find the mannequin now i'll select the mannequins file here i don't want any animations when we bring in the mannequin we have to select automatic bone orientation import the import fbx then i will click on the armature for the mannequin do gy1 to move it back by one grid line and i will go to the data properties here put it in front so we can see what's going on and then i will click on refresh list and i will okay one thing you have to make sure is that your character's rig should not be called armature so i'm just going to rename it to be character because we need that name later on so i'm going to make sure that this value is the name of the character's armature this value is the name of the unreal engine mannequins armature and we haven't yet brought in a metal rig or a rig so we can ignore these two and we'll just hit refresh list again to make sure everything is okay now i can select the armature for the mannequin and when we import one of these there's usually a problem with the foot so i'll just do fix mannequin and that'll fix our issue i can edit this armature hide some of these large bones so we can see what is going on and then i can scroll up here turn on names and look at the bone names in this bone hierarchy okay it's for the spine this one is called pelvis spine underscore zero one spinous score zero two and so on so if i go back to object mode and select well let's just hide the mannequin we don't need right now so i'm going to select this armature again turn on names and what we need is for these names these bones to have the same name as their corresponding bone is in the mannequin and we have a few tools and you if i add add-on to help us with this if we scroll down to the uefi script panel to character operators i'm going to click on this and you'll see that there is nothing here this thing is empty on select mapping but if i click on this second button and then try this again and we'll have two values here that come by default so i'm going to select miximo original and this character is a miximo character so they all have the same bone hierarchy right and then i can just do apply and all of my bone names have been updated but this is only going to work for mixamo characters that were originally released for example this this is not going to work for the fuse characters or for characters from another source or from the engine samples so what we really need is some way to make our own character mappings i'm just going to undo this so we can figure out how we can make our own mappings so this is back to what the original was if i check this drop down again you'll see there's nothing here so we'll just do scan this time and there'll be a new value called custom so if i go to scripting and then in this drop down there'll be a uefi mapping custom json file and i can look at this and then if i go back to layout uh let's just click on this button again to get those two extra values back and then back in scripting if i in this drop down you'll see those two values here as well i'm going to expand this window like so just grab the corner and drag it and then use the mouse wheel to scroll over here and from here i will select ufi mapping mannequin the first values listed here are the names of the bones as they are in the armature and the second values are what we would like them to be so if i can just uh go over here you can see we've got a hips spine spine one spine two and so on so these these things are listed over here and i can just replace them with what i would like them to be so these are uh these are what they should be like in the mannequin so i just open this file as a reference and i can just copy this and paste it over there and so i can just replace these values one by one and that's all there is to it it's just a copy-paste job and creating these character mappings was really difficult with uefi script uh even for me but in this add-on it's really simple anyone can do this if i scroll over here and use this drop-down menu we're uh editing ufi mapping custom but if you open ufi mapping mixing original you'll see it is exactly the same file i use the seam tool to do a scan and get this list and then i updated the second column to what the names should be and now because i have this file anytime i want to rig a miximo character it's just one click so uh creating these is really simple uh if you name the you can also change the names here so if i let's say i fill out this custom file and then i can just simply go here leave ufi mapping underscore as it is and then just change this to the what whatever i want this to be called and then if i go back to layout it'll be listed over here right we named it my name so it'll be listed over here so you can just fill out a file like this rename it and basically you can copy paste this into any new project that you want and that's it you'll you'll have it done in one click this data gets fed to python so you have to watch out for the incandescent but otherwise it's just a text file i usually use notepad plus plus to edit these but you can also do this in blender i'll just use the miximo original list to update the names on this and now we can scroll up here and turn on axes and we can update the rolls on these bones we could bring in the mannequin and one by one check what uh what the rule is on every corresponding bone like for the pelvis the spine one by one check them but there's an easier way to do this i'm going to scroll back to the uefi script panel uh go back to character operators and click on auto rolls and this will try to guess what the roles should be and it mostly gets it right except for sometimes not on fingers so we now need to check if the rolls are correct and the way you do this is for the spine this red line needs to point towards the back of the mesh so the from the pelvis all the way through the neck to the head everything has the x-axis pointing towards the back of the neck we don't care about the eyes or any other bones so just these six bones over here these two bones over here they should be pointing towards the back on the x-axis we're considering only the left side so we don't really care what's going on over there for uh the arm it'll be the same for this phone this phone this phone x goes towards the back of the mesh and uh it seems like the script did a good job over here guessing what these values should be for the foot this bone it it'll be in the same direction as this line and for for the final bone it will be going straight up and remember this is not part of the hierarchy and even if this was controlling something in the mesh we don't care we just care about these two bones uh these two and the spine along with these three bones so if there are additional bones like twist bones or whatever there is just ignore that these are the only ones we care about for the hand uh this is where it most often can get things wrong but for the hand this x-axis needs to point out from the bottom of the hand so if your hand is kind of rotated it'll be pointing straight out the bottom of the hand not necessarily going straight to the ground same for the fingers x-axis needs to exit from the bottom of the fingers for each of these bones and including the thumb so if you look at the thumb here its bottom is towards the side so x-axis is pointing correctly on all of these bones so the script got everything right and we didn't have to do anything but if if it didn't it'll be it's pretty easy you select the bone that you want to update you go down to uh the uefi extra tools and there is a bone roll tool here and you can select the axis where you want the x-axis to point toward and then you just roll the bone and it's as easy as that if you do rule one of these bones using the tool be sure to right-click on it and click on summit tries so the other side is also fixed but if this script got everything right then we just really don't have to do anything okay so scrolling back to the uefi script panel we used the character mapping we did the auto rolls now we have to post the character but before we do that we can actually improve uh the armature just a little so we get a better pose out of it if i bring back the mannequin and just hide the character for a second here if we look at these shoulder bones you'll see that they're kind of dipping that way from the front and from the top you'll see that it is really pulled back and the shoulders have quite quite a stretch on them backwards [Music] so we need something similar in our character from the front i can just edit this grab this part here and take it up like so and then from the top we could move it forward lock it use the g key and then lock it on the y axis and then just bring this forward just a little not too much and then we can also adjust the rolls on it so it is not slanted towards any one side okay from the top we do want it to be pointing backwards like so but not as much as it is in the mannequin because when we do the pose character we want this uh character to have its shoulders pulled back at least more than they are right now but if you match this exactly like it is on the mannequin the shoulders won't move at all and that's not what we want and then i could just right click on this and do symmetrize and it'll fix the other side another change that we can do is in the hands so if we select the hand bone and look at it from the top uh in the mannequin this bone is more like like this okay it is between these two fingers and from the front it's also a little bit towards the top like so okay and the third thing that we can do is to fix this thumb uh these these bones are not connected although it it'll probably work as it is but we'll get a strange stretch on the thumb so what we want to do is select this part do shift this cursor to select it and then select this shift test selection to cursor and then i could select this part do shift s uh cursor to select it and then select this bit do shift that selection to cursor and that kind of improves things a little bit here i could also do alt d select everything box select this and then just kind of straighten this out a little and maybe even alt 8 deselect everything box like this and then also straighten this out a little and then i could do select this this this shift in active bone and that makes the rolls a little bit better as well then we could do [Music] um go to wireframe mode uh box select everything right click on it and semi tries and that'll fix the other side and we no longer need names and rolls on this so i'm going to just going to turn those off we can go back to the uefa script panel and we have to post the character now we'll need the mannequin for this part so we just bring the mannequin back and we click on post character and that poses our character for us and then we don't need the mannequin anymore if we go to the side view here by with three key we need to improve the positioning of the feed a little so i'll use the deselect everything use the box select these two bones well just only these two so these two are selected and then i can use the r key to position them like so then i'll select the a key to select everything g to grab z to lock the axis and then bring everything down so it's on the floor like that and then i'll take to deselect everything and then you can look at from the front similarly just rotate this into position lock it on the z axis bring it like so and then rotate it like that okay so right now we don't really care where this bone is pointing at or what it looks like what we really want is for the the foot to look like it like it is in the mannequin all right so the foot it looks like this is kind of pointing straight and this this bit kind of juts out a little over there but that's that's what we're going for so our foot basically looks like that right now so this is good and we don't really care where these bones are at back in pose mode we can then select these two to control c to copy them shift ctrl v to fix the other side you can also improve the fingers a little now this really depends if you're using an emission packs you purchased for unreal engine from the marketplace it could be that they just expect the fingers to be like that because this is what the fingers are like in the mannequin but if you're making your own animations mostly uh it is going to help if we select these lower lower parts not these ones and then do alt r to straighten them up a little because when when we curl the fingers it's just easier for rigidify to handle this but if you're mostly going for the animations packs you could probably just leave it leave them as they are and then if you do do this you do ctrl c to copy them shift ctrl v to fix the other side okay if we switch between pose mode and edit mode you'll see that the edit mode is still in a t-pose but we want this to be like this all the time so what we can do is go to object mode select the mesh okay not the armature select the mesh go to the ue5 extra tools and do update rest pose and that'll just fix it so if we go back to post mode here and then go back to edit mode you'll see there is no difference anymore and we didn't have to do anything other than click a button now that the pose is fixed there's still one more thing we can do to help us fit the meta rig better to this character if we go to the front go down here we can hide the hide this bone here we don't need it and then we can improve the position of these bones so i'm just going to select these two parts like so and then just grab them and move them like that and move this like so i could also improve the roll on this a little and it might help to look at the axes on these okay so it is still correct this points that way and this point straight up like it should and then we could select both of these right click symmetrize and that'll fix the other side now we can go back to object mode i will create another scene collection and bring in our meta rig this is the object that will give us our final animation rig so i'm going to do shift a go to armature and select human meta rig and i will press the s key and type in 100 to scale it up this comes in small because we set the unit scale at the start of the project which is necessary then i will press the s key scale it down so the shoulders are a rough match this doesn't need to be exact and then again we look at the item properties scale needs to be one one one so we do control a and apply all transforms and then just confirm that the location is zero rotation is zero and scale is one one one i'm going to put the meta rig up in front so we can see and then down to the uefi script panel we'll hit refresh list make sure this value is the name of the meta rig which we just brought in and then further down in meta rig operators we can do fix meta rig to make it compatible and then post meta rig to make it match our character if we look at the fingers here you'll see that they don't quite match up like they do 100 most of the time uh that's probably because in this character just like the thumb the uh the bones for the fingers were not perfectly overlapped or they were not connected so if you want a perfect match here that is something you'll have to update in your characters but i guess this works too we can select the characters armature and then shift click on the meta rig to have both of these objects selected at the same time and then we can go into edit mode and take a look at the front and for the time being we can turn off the mesh so we have just these two things visible i'll tell you to deselect everything i'm going to box select this side and then just hide it and then box select the other side and then hide that as well and then we look at it from the side and i want to select the metal rig and i'll make sure it's the metal rig by looking over here and then with the cursor on any of the bones in the battery i'll press l and all do the same for the neck so cursor on the neckbone then press l to select this entire chain and then i can use the g key to match the base of the neck with the base of the neck and the character like so a rough match like that and then i can select these bones match the next joint like that select these bones match the next joint like that select this one put it over there and then select this one and put it over there then i can also select the headphone and place it where it needs to be like like that and then we could also bring in the mesh hide the original characters armature so we just take a look at how these bones are positioned and if this works for us it looks fine to me and then we can do alt e to deselect everything alt h to bring back everything then alter deselect everything again go back to object mode and i just want to select the meta rig here so i'm just going to select on click on the meta rig hide the character's armature for a minute here and then i will edit this and put this heel bone in place so grab this i'll lock it on the x-axis so i'm going to put this over there this about over there three key look at it from the side g key lock it on the y axis and then bring it like that right click and then submit price to fix the other side all right so the metal rig is basically fixed so i'm just going to hide it for a minute bring back the character's armature and we're almost done with this so go to object mode i'm going to select on the mesh go back to the uefi extra tools and extract the mesh okay so the mesh is now separate from the character's original armature i'm just going to drag it over there and we don't need this anymore okay so bringing back the meta rig in object mode i can select the meta rig and then click on generate rig this will generate as the final rigifi rig that we've been working for and now we can hide the meta rig and i will bring this to the front as well so you can see now i can click on the mesh shift click on the rig and then do control p armature deform this will attach the mesh to our new rig and then we can go down here click on refresh list make sure that this rig value is pointed towards our new rig and then further down we can do a preprocess and then make sure that mode is epic skeleton and then we can just do build skeleton and give this a minute this is going to rename the rig to armature and at this point this character will basically be rigged and working there will be a few missing pieces that are not in the epic skeleton mannequins hierarchy for example the eyes on this character are not wheat painted as you can see over there now if this character had uh twist bones or accessories like shoulder pads or backpacks or whatever those would also not be working at this point and you have additional tools to make them work as well because of the way the fingers are in the mannequin it pays to check if these riggify fingers are working correctly so i will select this control here press s to scale and then move it forward and it should twist inwards but it's not it's going it's moving sideways okay it's not actually curling inwards this finger is working correctly that's how it should behave but you see you'll see most of these fingers they're kind of broken okay this one works and this one is also broken all right so we can fix this first we have to go to object mode bring back the meta rig let's just hide the armature for a minute here if we select the metal rig and go to pose mode i will select the base of each of these uh fingers and then go into the bone properties here go down to the rigified type and bend x rotation axis set this to x manual all right so i'm going to set all of these to x manual because rigid five fingers are kind of uh crooked while while the mannequin's fingers are crooked while rigify expects them to be perfectly straight so we have to set this to be x manual and then let's just box select all of this to right click well actually discuss to edit mode and then symmetrize this and then on the other side uh let's just make sure select this one bone properties all right bend rotation axis is x manual all right good okay so we go back to object mode i'll deselect everything armature data properties with the metal rig selected okay we need to have the armature or the rather the rig visible at this point and then we can just click on generate break and then we just fall back down to uefi script panel and then click on build skeleton once more give this a minute and now we try our fingers try the thumb okay that's the right direction correct direction that's also working okay let's just get the metal rig out of the way so we can see and this is also working this finger is kind of turned in the mannequin as well so that's fine and this is also working so that is something that you might have to if i go to object mode and select the mesh i can look in the vertex data properties over here vertex scripts in the object data properties look in the vertex group and i will find the left eye and the right eye okay so we go into edit mode alt a to deselect everything i will select the left eye and then click on select and this basically selects the eye over there and then i will remove the all of the way paint from this and then i'll find the head and then i'll just assign it over there same for the right eye altay to deselect everything so nothing is selected click select here and then remove these vertices from the right eye group and then click on head and assign these vertices to the head with full weight okay so i'll take to deselect everything go back to object mode select the rig again uh go to pose mode and now if we move you'll see the eyes move with the head so that is one way you can update the weight paint with just uh the vertex scripts uh in other tutorial videos we'll show how to add additional bones and get all those twists and accessories working as well if we scroll up here and click on this layer this contains the export chain that deforms the mesh if you want to update any wheat paint these are the only bones that you will update don't add any paint to the control phones the next layer has the facial rig if we added one and this layer has the ik chain that is exported to the engine we don't add any wheat paint to it but it does get exported with the other bones to export this armature we can go to object mode select the mesh shift select the armature go file export fbx up select the name of the file you want to export it to or type it in over there we want to export only the selected objects we want to export only the default bones don't want to add any leaf bones and we're not dealing with animation right now so export fpx and then i can export it a second time if i wanted to use the unreal engine mannequin skeleton during import in unreal i just have to click here once but before we do that make sure you make a backup the blend file because this breaks the blend file for uh for animation and you can't use it for anything other than exporting so i'm just going to click once here select the mesh shift select the armature file export fbx uh this time a different file and then again selected objects armature only the default bones and we're not dealing with animation so export this in the engine we can then do import find the file that we exported with the blender blender-based joint curls open this i'm not going to select any skeleton just leave it at none and do import and i'll create a new skeleton for me and now i can open this character go to the skeleton tab and confirm that this bone hierarchy actually matches the the unreal engine mannequin then we can do options show retargeting options and we're going to set this to be recursively set this to be skeleton and we set the root to animation and the pelvis to animation scaled we go down here uh set the ik bones to be animation and we need to do this for retargeting to work correctly by the default value of animation that you get on new skeletons doesn't work very well we also want to click here to apply the asset otherwise you'll have problems selecting the skeleton while retargeting and then finally in the retarget manager you want to make sure that this select rig is set to select humanoid rig the other values will already be configured properly because of the way the uefi add-on built the skeleton and our pose will also be accurate it matches the mannequin perfectly next we will go to we will i'm going to select some of the marketplace animations that i purchased and i'm going to retarget them onto our newly imported character so i'll just select some animations to retarget anime assets duplicate anime assets and i will pick the manic can i will pick the skeleton for my new character right it would be this one uh that we just imported i'm going to change the location where i want these files to end up i'm going to select the directory here and then just do retarget then back over here this should just work [Music] perfectly now i am a little concerned that because we didn't really spend too much time on fixing the fingers on the original characters i just want to make sure that uh fingers yeah they seem to be working pretty well if you want to absolutely perfect re-target you will have to make sure that the meta rig matches the character skeleton perfectly and it it looks exactly like it is in the unreal engine mannequin the closer you get to it the more work you put into it the better the retarget will be at this stage but this works pretty well uh in any case if you would like to import your character onto the mannequin skeleton well let's just create a new folder here we'll do we can also import it directly onto the mannequin skeleton so i'll use the second file this time with the unreal engine mannequin joint rolls and open this and all you have to do is select the mannequin skeleton here i have a bunch of them but i need the original uh mannequin skeleton which will be in game mannequin character mesh that's the default location and third person template so pick this skeleton and then do import and if you use the if you set the joint rolls to be unreal in the mannequin in blender this will work out perfectly it works correctly but if you go to the skeleton tab you'll see the the mannequin and if you go to the animation tab we can do preview mesh and select our newly imported character and all of the mannequin animations will just work with this immediately and you don't have to re-target anything but it does complicate matters when you're making new animations because then you'll you'll have to import them twice you'll have to import them to your blender based character and then retarget them to the original mannequin uh it's kind of an extra step i usually don't bother with this i just use the blender based uh character directly and all of my animations can just come in immediately on this be sure to review the video i made on rigging the mannequin i explain in it how i use how i set up my project to share animations using the blender rigged mannequin so that's something that you can also do that's all for this time hit like on this video and if uefi has been helpful to you please consider telling other developers about this project thank you for watching
Info
Channel: Rakiz Farooq
Views: 80,129
Rating: undefined out of 5
Keywords: uefy, uefy2, uefy 2, uefy script, ue4, unreal engine 4, blender, b3d, animation, rigging, rigify, ue5
Id: mg75kSkKkug
Channel Id: undefined
Length: 40min 12sec (2412 seconds)
Published: Fri Jul 31 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.