Creating a custom morph target for Metahuman's face

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello community. In this video I want to  show you how to add a custom morph target   to a metahuman head in blender. I will talk a  lot about the level of detail. I think it is   quite important especially for games, while in  almost all tutorials that I’ve found this topic   was ignored. You can generate LODs in unreal  editor, but generated are not so good default  If you are OK with keeping only the  lowest LOD, things will be much easier  So, let’s get started. I use a metahuman demo project, metahumans  and create project  open editor  Click quickly add to project, quixel bridge,   don't forget to sign in, cause otherwise  you will not see your own metahumans.  Metahumans - My metahumans. Choose which  one you want to import. This one has been   downloaded previously. So click download if it  is not downloaded yet, I only need to click add.  If there is a first metahuman of the project you  will get a few warning messages about missing   plugins. Just enable everything and restart  the editor. Demo project is preconfigured,   that's why I didn't get these messages. And as for source content I   don't import source content So close everything. In content   we have “Metahumans”, and here folders for each  metahuman of the project. My metahuman is called   Vivian. So I go to Vivian. Face. And here we have  skeletal mesh called Vivan underscore face mesh.  Let's duplicate it. It will be handy in future.  Duplicate. I will call it SKM_VivianFace. OK.   Open it.  The first problem. There are two slots with  the same name. One is for saliva and another   one is for eye edges. It will be better If we  will replace one of them. So I browse to this.   Duplicate material instance. And I will call it   MI_saliva_Inst and replace the  default material with this new one.   Now we can export the FBX. Navigate to metahumans, Vivian, face, SKM Vivian   face, asset action and export. And I will save  it at my desktop.Default settings are good.  Before importing FBX in blender you  need to do one very important step.  You need to install Autodesk FBX  Converter. I have it installed.   Open it. Drug and drop exported  file here, click convert.  If you will skip this step all material slots,  and all existing morph targets will be missing  In Blender we need use this new  file from the folder FBX2013  Here this one so we can close the application and  open blender. Let's clear the scene. First thing   we need to do we need to set up correct unit  scale. Goto scene properties unit and 0.01.   Ok. Now file import FBX find on the  desktop. In folder FBX2013 find this file.   Default settings are almost OK. As for the orientation. I prefer to follow the   next simple rule: use manual orientation and keep  in mind the axes when importing the mesh, then use   the same orientations for export. This way axes  orientations will be the same as in the initial   FBX. I will set here forward Y, up Z. Import. Finally we can create new shape keys.  The best way is to create shape keys  for the lowest LOD and then transfer   them for all further LODs. So I will  hide everything except the lowest LOD.   And go to object data properties, and create  new shape key here. I'll call it CustomMorph.   And pin it. Now we can go to sculpt  mode and sculpt whatever we want.  As soon as it’s done we need  to transfer all created shape   keys from the lowers LOD to other LODs. I'm going to use my add-on for it. The link is   in the descriptions. You may do it manually or use  any tool you are comfortable with. I go to object   mode. Unhide everything and select all LODs except  the lowest. At the end I select the lowest LOD.   And wind my addons menu at N-panel, tools, here  this menu. Click transfer by list. And initialize   list as unchecked. Here. Uncheck all. It will not  transfer all LODs and we can find at the very end   CustomMorph. And I check it. You can check a  few morph targets if you have created a few. Now   final step. Transfer shape keys. Let's check the  result. Unpin it. Select the lowest LOD and try to   change value. So as you see  all LODs are also changed.   So, works well. Now obviously we want export  the model back to Unreal, but there is problem.  If we do it right now, at  the end we will get this.  “Incorrect LOD video” It happens because the   unreal engine processes everything  like it is a single mesh, while   we have a few separate levels of detail. So we need to change hierarchy to provide   more explanations to the unreal engine  exporter about what we actually want.  But before we fix hierarchy you should know  one fun fact. An index at the end of LOD mesh   name here means nothing. Order of LODs is  defined only by the object creation time.   So even with the right hierarchy, with 99  percent probability the order will be wrong.  To fix it we need to duplicate  objects in proper order.  I have a script for it Let's select all meshes.   And paste script. The script just creates a copy  of each mesh in correct order. So run the script.   And see here. Here we have initial objects  marked as outdated. We need to delete them.   And here we have the objects  created in correct order.   Let's fix the hierarchy. We don't  need this empty. Unhide everything.   This empty is handy Now we need to parent all   LODs meshes to the armature. So  select all of them. at the end select   armature. Click control + P and choose armature  deform. It is very important. Armature deform.   then parent the same meshes but to the empty.  select all of them select empty Ctrl + P. Object.   At the end select empty only select  armature and parent to object.  So at the top of hierarchy should be  armature. After this should be empty.   And under empty should be all LOD meshes with  armature modifier. Here armature deform modifier.   Hierarchy is OK. We need to select the empty.  object properties, and add a new custom property.  type should be string. Property name “fbx_type”.   Value “LodGroup”. L and G are capital. That's it. Now select everything. All armature, empty, LODs.  Double check. All of them should be visible and  should be selected. Go to file. Export. FBX.   Start with defaults. Selected  only. Here. Should be checked.   Now it is a good time to remember axes orientation  we have used to import. So forward Y, Up - Z.  Geometry. Smoothing should. face. Uncheck apply modifier, cause as it   stated here, it “Prevents exporting  shape keys”. It should be unchecked.  Armature. Uncheck leaf bones  and uncheck bake action.  Now we can save it somewhere. Here. On my desktop.  I will save it as SKM_VivianFace_Morph. Export.  Now go back to unreal engine.  content folder. And open   the skeletal mesh. Now scroll down.  At the end we have Import settings.   Expand mesh. Check import mesh LODs. Check it.   As for transform. we don't need  this transform. So all translations,   all rotations should be 0. Scale 1. And set file path, source path. Find   the final mesh from the blender SKM  Vivian Face Morph. Open. Save it and.   Content. Find the icon of this mesh. Right click.  And reimport. It takes a long time. Unfortunately.  Now we need to set proper asset material here. Select the same as in the left column.   Done.   Let's check what we have. Scroll up. So.  Number of materials is the same as in the   initial mesh. 15 materials. And let's go through  all LODs. LOD1. LOD2. LOD3. Something strange.   We need to fix it. LOD5 and LOD7. So we need to  go through all LODs and check materials for them.   Let's check custom the morph target.   It is here. And it works. Now. The initial  mesh will be very handy. Open the initial mesh.   Go to LOD sections. and check all materials  of these two meshes. And compare all of them.   Teeth, saliva, left eye, right eye, head teeth,  saliva, left eye, right eye. Eyeshell, eyelashes,   eyeshell eyelashes, eyesell,  eyelashes, eye edge, and cartilage.   So for the zero LOD everything is  OK. Let's go to the second. LOD1.   LOD1. Sections. Here LOD1 shader.   Here, the first problem. At LOD1 as a skin shader  we have the lowest LOD shader while here should be   LOD1 shader shader. All other looks good.   Let's go to LOD2.   Sections. LOD2 shader,  teeth shader, saliva shader.   LOD2, sections. The same  thing. Wrong skin material.   Here should be LOD2 shader. Teeth shader,  saliva shader is ok. Left eye, right eye, eye   occlusion,   higher LODs and lacrimal fluid inst. Eye  occlusion. Here we have lower eyelashes shader.   So we need to check. Here should  be eyelashes HiLOD shader shader.  LOD3.   This creepy one. Sections. The same  thing. Skin material is not correct. LOD3.   Teeth shader. We don't have saliva, so here  should be section 2 left eye, section 3 right eye.   Left eye, where is the left  eye. Left eye. Right eye. Eye   occlusion. eyelashes. and eye edges.   Eye shell. eyelashes higher LOD and eye edges.   Go to LOD4. Also creepy. LOD4. Sections.  head, teeth, left eye, right eye and eyeshell.   Wrong here. LOD4. Teeth ok. Left eye,   right eye, and at the end eye edges. Looks  nice. LOD5. LOD5. Sections. The same thing.   LOD5. Here correct five seven shader shader. Teeth  shader. Left eye shader, and right eye shader.   As for the further LODs it is the same.  So now everything is OK. So we have  metahuman with all LODs with proper   materials and with the extra morph target.  And the morph target works with all LODs.   And animations also works.  Let's check preview animation.  Now the head works well as  a single thing, but it still   does not work well with the other body parts. Let me show it. Go to Vivian folder. To blueprint.  And I want to replace face skeletal mesh  component here with the new one. SKM_VivianFace.   And something goes wrong with hair.   It is a woman so obviously we don't really  need to cade about mustache and the beard   but we still need to fix four grooms. eyelashes,  fuzz, eyebrows, and hair. Let's start with hair.   Here we have the problem. The groom  is bound to the previous mesh.   We need to create a new binding for the  new mesh. So browse to the groom asset.   Right click on it. Crete binding.   Select target skeletal mesh. SKM_VivianFace.  Conversion. As the source skeletal mesh select   initial vivian face mesh. And create new binding.  Nice. Save it. Let's go to VIvian blueprint and   choose another asset.   Now it works well. And let's do  the same for all other grooms.  Now everything works well and you can control  the morph targets from blueprint or from code.   Let me show it. Event graph. I will set   a morph target for face. Morph target's  name is CustomMorph. Value is 1.   Compile. And for demonstration I want to replace  the default female character with my new one.  Here I need to go to the content drawer.  And place the character on the scene.   Now we can to the sequence,  metahuman sample sequencer.   Go to characters, Ada, right  click and assign another actor,   Vivian. Ok. And finally enjoy the result.   If you want to see more videos like this one  click thumb up and don't forget to subscribe.   Let me know if you also want to see similar  video about metahuman body customization.  Thank you for watching. Bye-bye
Info
Channel: Squeezy Pixels
Views: 40,033
Rating: undefined out of 5
Keywords: Blender, Unreal Engine, Tutorial, UE5, Metahuman, Morph Target
Id: 3sHQ1AEeHg0
Channel Id: undefined
Length: 26min 44sec (1604 seconds)
Published: Wed Feb 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.