Retarget Animations in Unreal Engine 5.2 (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back to another video what if I told you you could take animations from one character and use them for a completely different character that is basically the process of retargeting retargeting animations allows for the ReUse of animations on a completely different character model that means that I can purchase a character on the marketplace if it's already rigged and it comes with no animations I can go ahead and take another animation pack from the marketplace say this motion capture animation pack and use them together learning how to retarget animations inside of unrealgent 5 is a very useful skill that you will likely need to use at some point in time and in this video I will show you guys all the things that you need to know when retargeting animations from one character to another and by the end of watching this video you will learn the principles that you need so you can retarget any animations that you have to any Target character that you want now before we get any further I really quickly want to tell you about my Multiplayer Survival game course learn how to create a multiplayer survival game side of Unreal Engine 5 there's currently over 40 hours of course content in this course you will learn how to make things like a drag and drop inventory system a complete crafting system where you can craft all sorts of different items a harvesting system where you can chop down any tree rock or bush that you see on the map we create nine unique weapons and tools things like a rocket launcher pickaxe Hatchet rifle we create an entire building system where you can build your own bases using foundations walls ceilings and you can upgrade your base from wood to then Stone and then to metal this course is currently in Early Access but if you enroll today you'll get a big Early Access discount the price of this course will be raised later on but if you enroll now you'll get access to the entire course and all future lectures that will be added so take your game development skills to the next level by enrolling in this course the link will be in the description below or you can head over to smartpoly.teachable.com to check out the course so the first thing that we're going to do is I'm going to create a blank project then I'm going to add an animation pack from the marketplace if you need some animations to start off with you search for animations in the marketplace and filter by free we have some different animation packs now I'm going to use this animation starter pack because this is free and it's by epic now you can see it only supports unrealogen version 5. you don't see 5.1 or 5.2 and add it you just click add you want to click on the show all projects and then search for your Unreal Engine project name select it it will give you this red message asset not compatible please select the closest alternative version so you just want to select the closest version to 5.2 which is 5.0 and then click add to project now for the character model that I want to retarget these animations to I'm going to use a free character model from the Unreal Engine Marketplace if you search for Paragon bellica this character is free to use and you can go ahead and all also added to your project so I'm going to click add to project show all projects search for my Unreal Engine project select the latest compatible version and click add okay so I'm going to Dock and lay out my content browser so I have it open here we have our annum starter pack so this comes with a bunch of different animations you can use any other animation pack that you have and then we have our actual character model here now I'm going to create a new folder for our animation retarget and in there all you have to do to get started is you want to right click and we're going to create a new animation ik rig okay so we have the ik retargeter and the ik rig now we want to create an ik rig per each character for the The Source character that we're taking the animations from and then another one for the Target character that we're going to be applying the animations to so create a new ik rig and this will be called The ue4 Mannequin ik rig and double click open that up so this ik rig window to select the character model that you want to use over here in the right we have preview skeletal mesh so if you click this little drop down it will show you all the characters that you have in your project so in my case this is our mannequin and our source so we want to select our SK mannequin because this is the character that all those animations are bound to okay so we have our mannequin let's go ahead and create another ik rig so go to animation ik rig and select that and this will be our Delica underscore ik rig this will be our Target so open this up and for our preview skeletal mesh we'll click this drop down and you can see this bellica character comes with different skins they're all on the same skeleton so they all share the same skeleton so it doesn't matter which one you retarget it to in my case I'll choose this belica biohazard skin we have sort of like this yellow outfit and then lastly the last thing that we need to create is if we go into our folder we need to create a animation down in the ik rig an actual ik retargeter so you're going to create one of these ik retargeters per each different character that you want to retarget animations to so click on that this will be named ue4 mannequin to belica and then underscore ik retargeter and open that up now when you double click this this is going to ask you select the source to copy animation from so our source will be the ue4 mannequin rig then it's going to say select Target to copy animation 2. so this will be the bellico rig so now what this will open is our actual retargeter now really quickly I'll explain this window you have over here the bone hierarchy so you know you have things like the hand bone spine this is our Target so you can see it's highlighting for the bellica model and then over here is our source so this is the mannequin skeleton now over here on the right if I deselect the bone so if I click anywhere in the viewport it will give me our default details and over here you can see the source so you can change this if you want to in our case our source is our SK manikade and then the target is our belica character now down here in the preview settings what I want to do is set a Target mesh offset so if you take this value and move it over you can see that we can move our characters side to side of course you could reset this back to Overlay like this and we might use this later on as well it's very useful to see the actual animations playing side by side or overlaid now let's go ahead and start the retargeting process so the first thing that we need to do is go into our source ik rig in our case our ue4 manikin ik rig and the first thing that we need to do is set our retargeting route so if you right click on anywhere in the graph you can see we have this little menu and under the retargeting we have this option set retargeting root so what I want to set our retargeting route to is our pelvis bone so the pelvis bone is usually right here on the character so I want to right click onto that bone and click set retargeting root save that then also go into your bellica ik rig or into the target character and do the same thing select the pelvis and set the retargeting route okay now if we go over into our ik retargeter over here in our asset browser you can see all of the animations from our source character so I'm going to scroll down and choose this walk forward rifle iron sights and so now you can see that the character here is animating this is the actual animation that I want to take and now you can see that because we set that retargeting route we can already see some of the movement translating over onto our character so the next step that we want to take is we want to get things like our arms and legs animated and properly copying over the animation data so let's go over to our mannequin ik rig and the next step that we're going to do is we're going to add the bone chains on our source so you want to select bones spine zero one through spine zero three shift select that right click and then down here we want to add a new retargeting chain so click on that it's going to ask you to add new retargeting chain click add chain and then down here in the ik retargeting window you're going to see the name of the chain in our case it's spine the start bone spine zero one the N bone through spine zero three so we're going to add a total of six different chains so we're going to add five more and the chains will start from clavicle l so this bone right here all the way down to our hand right click add a new retargeting chain click add chain scroll down we have clavicle R through hand r select that shift select it right click add new retargeting chain add chain and if you scroll all the way down we have our thigh l through our ball so all the way down here and I'm going to unselect the twist bone so we have calf twist and I'm going to choose everything other than the twist bone so that is the thigh L all the way to the ball l without the twist to right click add a new retargeting chain a chain and the same thing for thigh R all the way down to ball R I'll select the twist right click add a new retargeting chain add chain lastly we're going to add one from our neck bone to our head bone so right click that add a new retargeting chain and add the chain so now we should have in total six different chains and this is really just the bare minimum that you need to start retargeting animations so now let's go ahead and save this go to our Target which is our bellica ik rig and we're going to do the same exact process so we're going to choose spine zero one through spine zero three right click add a new retargeting chain add chain clavicle l through hand L right click new retargeting chain add chain then scroll down we have clavicle R through hand R right click that add a new retargeting chain keep scrolling down we have neck zero one through head now this has an extra bone and it doesn't really matter if there's extra bone so we'll just shift select that right click add a new retargeting chain and keep scrolling down we'll have the legs so we have thigh l through ball L and I'm going to unselect the twist because we don't need that bone click right click add new retargeting chain add chain and lastly thigh R through ball R unselect the calf twist right click add a new retargeting chain and add the chain so again we should have six total chains in the skeleton and now we should be able to save this so save both of these head over to our retargeter and now what we want to do is from our asset browser we want to click on this chain mapping window and we need to map the chains together so we have the two different chains on each skeleton and now if you select the spine you can click this drop down and you can see we have the spine chain okay now you can also Auto map these so you can manually map these if you want to by clicking and selecting them through this drop down but you also have this Auto map chains so if you click on this you can Auto map the chains so in my case I'm going to select this Auto map fuzzy so this will try and guess you know the names together and figure out which chain is which you have also another option Auto map exact so this would Auto map exactly if the names are exactly the same so I'm going to choose the Auto map fuzzy and what this will do is it will auto map the chains together so we have spine to spine left arm the left arm neck to head and all that stuff so now over here what we can see is the animation is already starting to play on the character we have things like the legs and arms animating and if we go to our asset browser we can choose different animations we have this death animation so you can see we're really quickly getting some fast results we can also if you select anywhere in the viewport we can set up preview settings under our Target mesh offset we can reset that to the default value so this will overlay both of these character models together and now we can really see where we might want to tweak some of these animations now if you are fine with the animation so for example say I have this death 3 animation this looks completely fine to me I think the results are great I don't need to modify anything in here all you have to do is Select that animation in the asset browser and click export selected animations so if you click on that it will ask you where you want to save your animations to in my content folder I'm going to add a new folder this will just be our animations click export and now if I open this up we have the retargeted animation on our character now this character you can see they have a gun mesh and that's just how all these Paragon characters are set up they have a weapon mesh automatically attached to the character usually you would attach it separately so just ignore this for now but as you can see we have an animation playing on the character and this is pretty good now for some of the other animations if we go back to our walk forward rifle if I click the pause what we can see is that the arm here is completely messed up and in our Target mesh offset if I click this reset value it will go ahead and overlay these two characters together so I can see that the animation retargeting is not perfect and we need to go ahead and tweak some of the positioning so the way that we're going to do that is we're going to use ik goals now ik goals are a very useful system to retarget animations because it gives you flexibility and complete creative control over how you retarget your animations now let's go ahead and add the ik goals so to add ik goal you want to go to your target rig and all you have to do is add the ik calls to your target rig so you don't have to do it for the source only for the Target so over here in our bellica ik rig we're going to add a solver and we're going to add the full body ik solver that way we can use ik goals so click on the full body ik and now this is going to be grayed out it's going to say missing the root bone so what we need to do is Select our full body ik solver and select our root bone right click that and down here in the settings we have set root bone on selected solver so because I have this selected I can click set root bone on selected solver and that will go ahead and set the selected bone root on our full body ik solver now it's going to say missing goals so we're going to need to add some ik goals to our character so we're going to add goals for each of our hands and then each of our feet so over on the hand we're going to right click on the hand L bone and add a new ik goal so click on that it's going to ask you to assign the goal so it's going to guess that you want the hand L goal to be assigned to your retargeting chain called left arm which is the right one that we want it to click assign goal and what this will do is it will add this little yellow box control on our character's hand that we're going to use later on to modify the character's hand position also what you'll notice is in the ik retargeting and our left arm chain it will add that hand L goal okay so that is what we want it to do so now if we scroll down we're going to add all the other ik goals for our other hand so Hand R right click add new ik goal assign goal then we're going to add them for each of the feet so scroll all the way down we're going to add it onto the ball l so ball L right click new ik goal assign goal and then also ball R right click that add a new ik goal and assign it so it will assign all the goals in of our chains and now we have one of these ik goals for each arm and leg okay so save that and this is all set so now let's head over to our ik retargeter so now what we can do is you'll see those little yellow boxes appear here on the character and if you select a box so this one right here in our details panel we have a ton of different options that we can modify so if you scroll down to the ik we have this blender source so what this does is if I put this value to one what you can see is that it takes the character's arm and we can modify the position of this arm so we can click blend a source and put that all the way to one and now you can see that the character will be able to match the exact position of the wrist and then I could also select this ik goal right here click blend of source it is also going to put the wrist right where we want it to so we could take this even further so right now you can see that the hands aren't aligned up perfectly still need a little bit more tweaking and this is exactly where the ik goal system shines because you can tweak the exact position of these bones so for example if I select the ik goal right here we have things like static offset so this will allow me to adjust the location the X the Y and the Z location then I have things like the rotation itself so if I wanted to rotate this hand and position it the closest I can to this mannequin's arm I could and I could also take this other hand right here and modify the rotation and positioning to match it up exactly okay so now if I deselect off of this I can add a offset position and we can go ahead and play the selected animation okay so this already looks a lot better than what we had before now there's also some other options that I'd like to highlight with ik goals so if you select your ik goal right here we also have things up in the FK things like our pull vector so what the pull Vector does is it controls essentially where the elbow location is at so you can control basically the rotation of the character's arm using the pull vector and this also adds just a little bit more control to the overall look now if I want to take this rig even further I can go in and add chains for all of the fingers as well so we can get the same exact finger location so the way that you would do that is you'd need to go into both the source and Target you would go into your index so you'd have index 0 1 through index 0 3 you go in right click and add new retargeting chains for all of those fingers so you'd select middle 0 1 through 0 3 add new chain and you just go in and add the retargeting chains for both the source and the target skeleton now I've already done this in a separate project so I can show you the walk forward and if I unselect everything you have this debug draw so if you uncheck that it will get rid of all the ik goals and all the bones so you can see the character mesh and I basically have mapped all of the fingers and I can reset the offset so I can show you exactly what it looks like so it looks pretty darn good for you know about 30 minutes of work and you can see exactly how the animation is lining up now if you're still not satisfied with things like the finger position you could go in and add things like the goals and modify further the positions but the main thing is that I can go to pretty much any of the animations and now that we've set up those goals and those offsets will apply to all the animations so you can see how well they look overall I'm pretty pleased with the results of the ik retargeting system as it allows for a lot more flexibility and control over how you retarget your animations and once you have your ik retargeter set up for that character any animation that you import for that Source character you can take and retarget so the neat thing is any animation for this ue4 mannequin that I download from the marketplace I can import it to this character and retarget it because I have set up this rig so you could go in and set up multiple different ik rigs for different character models for example I have this mixer mode to ue4 retarget rig and I can take a animation from the miximo skeleton and reach targeted for the ue4 skeleton and I'm just using the simple chain mapping the six different chain maps and some simple ik goals on the character's hand now there's one thing that you need to note so if I click the stop playback you're going to sometimes have character models that have different rest poses so for example the miximo skeleton is in a t-pose whereas this ue4 manikin is in this apose so oftentimes if your character models have different rest poses what you will need to do is in the retargeter you want to click on the stop then click on this edit pose what the edit pose will allow you to do is if I go to my character bones and show all hierarchy I can select the bones and rotate them to match our source pose so this is not going to mess up our character model this is just setting the pose inside of our retargeting system so what you want to do is you want to ideally match the pose exactly to your Source pose so I'm going to take things like the arms and straighten them out on both sides and the more that you get this to match your Source pose the better results that you'll get so now you can click out of the edit mode and if we go to the animations we can go to the walking and you can see the walking animation playing of course we can go ahead and turn off the bones so selected only and again if you want to tweak things like the hand positions say I want our hands to be a little bit spaced out I can select this ik goal that I've set up on our ue4 mannequin and I can add an offset so that it has you know a lot more space on both sides so that is the retargeting process inside of unrelated 5. in my opinion it has certainly improved from what it used to be in unreligion 4 and there's a lot more control and flexibility that you can get using those ik goals to tweak your animations so now you can take the basic principles that you learned here and take any other character mesh that you have set up your ik rig and ik retargeter and retarget any animations to any character model that you want now if you guys enjoy the video make sure you guys leave a comment a like and consider subscribing because I make all sorts of Unreal Engine 5 content tutorials courses all free here on the channel if you want to check out some of my paid courses you can head over to smartpoly.teachable.com and yeah that's going to be it for this video I hope you guys enjoyed and I'll see you guys in the next one
Info
Channel: Smart Poly
Views: 46,026
Rating: undefined out of 5
Keywords: Unreal Engine 5, Unreal Engine 5 Release, Unreal Engine 5 New Features, Unreal Engine 5 Next-Gen, Unreal Engine 5 Nanite, Unreal Engine 5 Lumen, UE5 Release, UE5 Next Gen, UE5, Lyra Starter Game, Unreal Engine 5 Lyra Game Tutorial, UE5 Lyra Tutorial, Unreal Engine 5 Open World Tutorial, Unreal Engine 5 Open World GamesUnreal Engine 5, Unreal Engine 5 Open World Games
Id: xvHOamXuZDI
Channel Id: undefined
Length: 26min 23sec (1583 seconds)
Published: Sat May 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.