Morph targets and .FBX importing
In recent versions of UDK, importing of characters via the FBX format has been increasingly supported. The best way to try out this approach is to first jump to the official documentation from Epic Games on the Unreal Developer's Network: http://udn.epicgames.com/Three/FBXImporterUserGuide.html.
In the export dialog from 3ds Max there is the option to include Animation and Skinning and Morph Targets. When importing an .FBX asset to UDK, the import dialog offers the same options, including StaticMesh only import from a rigged mesh.
Like other software, the FBX file format is updated from time to time. Prior to December 2011, UDK did not support FBX 2012, so it is advisable to use a current version of both 3ds Max and UDK. With older versions it is possible to switch the FBX export to an older variant when exporting the model. which can be done in the Advanced Options | FBX File Format | Version roll-out.
How to do it...
- In 3ds Max open PACKT_FemaleMesh_Idle.MAX. Select the model Packt_Character, which has the required Morpher modifier already there. To export Morph targets you need to send them out from the main character model, not export the target meshes. FBX handles this automatically. Within the Morpher modifier, press Load Multiple Targets and add EarShrinkR and EarShrinkL as targets. Keep their channel weights on zero.
- You may need to place the bones for the character on a Layer of their own in the Layer Manager and hide the layer. The b_ layer has already been populated, so hide the contents of the layer in the layer manager.
- Use the Select Highlighted Objects and Layers icon [ ], then select all the b_ bones and right-click in the scene and choose Object Properties from the quad menu. Ensure By Layer is active rather than By Object, as shown in the next screenshot.
- Select the mesh and choose File | Export | Export Selected. Then, set Morphs to be enabled under Deformations in the Animation export options, along with Skin. That should be on by default however, but it's good to check it.
- Press OK at the bottom of the export dialog.
- Now in UDK we need to import the morph targets we exported from 3ds Max through FBX's automatic functionality. A holder for loaded content is created for the morphs when you import the FBX. In the AnimSet you can also manually load morph targets from the AnimSet Editor's File | Load Morph targets menu. For that you have to first make a MorphTargetSet by right-clicking in the content browser and choosing the MorphTargetSet asset type. The FBX import creates its own asset automatically, and you should be able to locate it in the package along with the SkeletalMesh.
- Just in case you are exploring the Advanced section of the FBX import dialog, as you might if you are troubleshooting, don't be tempted to click on Import Meshes in Bone Hierarchy. If you do, you'll get visible bones along with your character model, as shown here:
- Meanwhile, in the AnimSet Editor, click on the Morphs tab, and there you should see Packt_SkinTailFBX_Morphs.
- If you are loading morphs from a .PSK file instead of FBX, choose File | Import MorphTarget in the AnimSet Editor and select the morph target .PSK files exported from 3ds Max earlier. The morph targets should now appear in the AnimSet Editor's Morph section with 0-1 sliders. If you try out the sliders, the model should show their influence. Adjusting the sliders in the AnimSet editor is just for previewing purposes; for in-game adjustment of the morphs we can use a coded method, or a Matinee driven Morph track through Kismet.