Metahuman body and face morphing animation with custom blendshapes
Artik Agency
Creatives, UA, Visual ASO | Insider strategies from senior marketing experts | Submit a Request!
Sometimes, when working on cinematics, characters have to do various animated body transformations. Transformation of the mesh mesh is widely used in blendshape animation, usually a variety of emotions and facial expressions. That is, those things that are not difficult to perform in statics sculptor. But there are also situations where you need to show changes in the body: in front of my eyes Dr. Benner becomes a muscular Hulk, and the fat girl becomes slender and pumps up her lips on the movement of the slider. The last example will be discussed in this article.
Model Preparation.
Additional blendshapes are needed for 2 parts of the body: the body itself (Body) and the head (Face). That's why they have to be found and exported. When Metahuman is downloaded and added to the project, the easiest way is to search through BP-asset. For the body, the skeletal mesh is searched in the corresponding Body tab.
In the Content Browser window, select export from the context menu
Note: Metahuman body usually has several LODs, so exporting skeletal mesh will export all its LODs as well! If you don't need LODs, you should set the number of LODs to 1 in the Asset Details tab. This will be discussed in more detail when exporting the head.
In the export window, it is important to check the Level of Detail checkbox, because you plan to save all LOD of the body in the particular model.
Export and save the FBX file with the original name (in this case it is f_med_ovw_body) to a previously prepared folder.
To export the head, it is necessary to repeat the procedure of finding the asset via blueprint. For the head, this will be the Face tab. Since you do not need to make a lot of LODs for a particular task, you need to remove them in the Asset Detail tab by setting the Number of LOD's parameter to 1 and applying this value by pressing Apply Changes. But it is better to do this on a duplicate facemesh.?
Next, you need to export facemesh, but unlike the settings for the body, the parameters of the format FBX 2013 and the checkbox next to Export are required Morph Targets.
Now you will need Autodesk FBX Converter (https://www.autodesk.com/developer-network/platform-technologies/fbx-converter-archives). No settings are required, just drag and drop the FBX into the program window, select the saving path and click Convert.
Import models into the 3D editor.
In this work, Blender will be used, so the location of the settings in the article will be for it. However, there are no fundamental differences for other editors, so the same actions can be applied in other programs as well.
Before importing, the scale of units is set
The FBX body model is imported into the scene. For correct subsequent export it is necessary to remove unnecessary objects and groups that were imported together with the model.
Before you can select them and press X, you will need to detach the skeleton from these objects. So?having selected it, you need to press Alt+P and select Clear Parent.
Now you can delete these 2 objects, because nothing else is attached to them. Next, for each LOD separately, in the Object Data group, tab Normals, you need to uncheck the Auto Smooth checkbox.
The next thing that will get in the way is the seam where the MetaHuman has a UV spread.
In Edit Mode, select all vertices (key A) and "merge" vertices that are close to each other by pressing M (Merge by Distance). The Distance value is sufficient by default.
Repeat this procedure for all LODs.
Similar operations are required for facemesh, except for the last point with Merge (not necessary in this example).?
Creating Blenshapes.
It is recommended to start blendshape creation with LOD0 for your body, because it is more convenient to use this model as a reference later on. In the Object Properties group of the Shape Keys tab, click the "+" button twice: the first click creates the base relative to which the morphing will be performed (Basis), and the second click creates blendshape.
You can give this blendshape a name and set the value to 1. You can proceed directly to sculpting. Standard tools, such as inflate, blob, smooth, flatten, elastic deform were used to work on the model. It is also recommended to use X-axis symmetry, to speed up the process.
The result is this morphing. If you change the value of blenshape smoothly, you can see the animation of turning one shape into another.
Now, since the task requires 4 LODs, respectively, you need to create the same blendshape for each LOD separately. To match the proportions of blendshapes exactly, use LOD0 as a reference, enabling its display in the Viewport Dispaly tab as Wire.
Once you are done with the body, you need to repeat these operations for the head as well. However, the face model already has some blends created by the Epic team for incredibly detailed facial expressions. You don't need to touch them, just add an additional Shape Key via "+".
You can name it (for example, "Lips"), set it to 1, and start sculpting.
This is the result:
Export models from 3D redactor.
In the body you need to export 4 LODs step by step, so first you need to select the skeleton and LOD0
After that, press F4 → Export→FBX and be sure to specify the following parameters in the export window:
1. Tab Include → Check Selected object
2. Tab Geometry → Smoothing → Face
领英推荐
3. Tab Armature → uncheck Add Leaf Bones
4. Remove the check mark from Bake Animation
In the file name, it is desirable to add postfix LOD0, so as not to get confused.
Now with the same settings, changing the postfix in the name to the appropriate LOD, you need to export all the remaining meshes one by one. Select the skeleton and mesh of the next LOD export by analogy.
Facemesh is similar. However, the head has one nuance: when deleting the extra groups, the information about the vertical axis of the mesh was lost. Therefore, you need to select everything (key A), rotate everything by 90 degrees along the X axis and apply the rotation transformation by pressing ctrl+A → Rotation
Import into Unreal Engine 5.
Importing FBX is done by simply dragging from the windows folder to the content browser folder. The body in the example was imported into the same folder as the original, but it does not matter. In the settings you need to select the skeleton MetaHuman, namely metahuman_base_skel and check the Import Morph Targets. LODs will be added manually.
You can check how the Morph target works by moving the slider.
Add LOD in the asset details tab, one by one loading all the files.
In the same tab you need to connect 2 assets. The first is to add to the LODsettings slot the drawing settings from the original MetaHuman body. The second is to add control rig by default, so that when you add the model to the sequencer, it will already be ready for controller animation.
The FBX head model must be dragged into the UE folder, where the duplicate is already located. That is, by dragging and dropping it from the windows folder to the content browser folder, the meshes are replaced. At the same time a situation may arise when UE loses the binding to the materials when re-importing. In this case you need to manually select materials with appropriate names.
Now, by opening BP Methauman, you need to replace the old body and head models with the new ones you just added. For the body this is done here:
For the head:
When replacing the facemesh there will be a situation where the hair is missing or loses its attachment to the head.
The thing is that in UE, every Groom-asset has to be attached to the mash via groom binding. This is done so that you can easily change your character's hairstyles in the game. But since there is no such binding for new meshes, you have to create them. Find the location of groom-assets by right-clicking on the selected asset and you can create a binding.
In the window that appears, I choose as Target Skeletal Mesh the new mesh to which I apply the binding, and in Source Skeletal Mesh the old one, from which the binding is copied.
Now you can replace the binding in BP
Similarly, create and replace bindings for the remaining Groom-assets.
Adding morphs to the control rig.
The process of creating controllers is the same for both body and head, so only one of them will be described. For example, this will be the body.
After opening the control rig asset for the body, in the curve container tab add a new morph with the name that was assigned to it when you created the blendshape. In this particular example, it was "Mod", so the morph will be called "Mod".
The Rig Hierarchy tab now needs a new controller. You can give it any name you want.
Note: If errors occur when adding new controllers or nodes, it is necessary to increase the Node Run Limit value in the Class Settings in the Rig Graph Display Setting tab by a certain amount (the number of new nodes or more).
For convenience, in order not to lose sight of the controller, you can drag it to a convenient place in the hierarchy. You should also change the controller type to Float, and preferably set the maximum value limit to 1, because in blender, when you create a blendshape, the morphing value varies from 0 to 1.
Now you can assemble the nodes. They will be connected at the end of the Forward Solve chain.
Pull the controller to the Rig Graph window via the Get function. From the pin of this node, wire the Set curve value node. In Set curve value select the created morph as curve. Connect the chain and compile.
Now you can put the keys in the sequencer and animate the blendshape.
Conclusion.
The method described in this article allows you to work with the grid without breaking the MetaHuman logic. For simplicity, only one blendshape was used, but based on this method, you can create many blendshapes and write more complex and interesting relationships in Rig Graph. Thereby creating a more lively and realistic transformation animation. Good luck!
By Art Lead Anton Martyniuk