FaceGen Tutorial

Jump to: navigation, search

3ds Max users: For a more up-to-date tutorial, and more automated tools, see Setting up a Facegen Dynamic Character with Facegen Tools.

This tutorial is designed to walk you through the steps involved in setting up an in-game character with a full body morph. Although this tutorial is meant to be fully comprehensive regarding the FaceGen process, it is recommended that you have a clear understerstanding of Dynamic Character creation, and that read through the documentation on the FaceGen Pipeline before beginning.


Step 1. - Create a Dynamic Character

Establish your basic Dynamic Character. It's easiest to begin with a barebones setup such that you have a dynamic character with only one full body dynamic part at this stage. This is not to say that a fully fleshed out character with an array of dynamic parts cannot be converted to a morphable character - this is perfectly doable. However, for the purposes of learning the process, it will be easiest to begin with a dynamic character in simplest form.

The Basic Setup

This tutorial will deal with a sample character called morphgirl. If you're following along, simply substitute in the name of your character wherever the name morphgirl appears.

The character folder will be located at HE\Character\morphgirl, and the components in the top level folder comprising the character at this stage are:

The character should, of course, have textures in place and should be set up with at least a rudimentary animation agent so that it can at play a simple looping idle animation (though if the character is already wired up with a more complex animation agent, that's perfectly fine as well).

Once you've added a character spec for your dynamic character and can successfully visualize and possess the character in HeroBlade, you're ready for the next step.

Step 2. - Creating Morph Meshes

This phase involves modeling and exporting the geometric morph extremes for your dynamic character.


For the sample morphgirl project, I'll be creating a large (muscular), tall, short, and tiny variation of the character's base design.

While morph extremes can vary in size, form and proportion, morph mesh topology must match that of the base mesh - this includes poly count, vertex count, and vertex numbering. For this reason, the morph meshes must be derived directly from the base mesh (i.e. copy the base mesh and then edit it).

Morphmesh lineup.jpg


Once you've built all of your morph meshes, you'll need to export them and your base mesh with the HeroEngine Export tools.

Align meshes.jpg

To prepare for export, check that the base mesh is aligned with the dynamic character's skeleton (it should not be skinned to it, simply aligned as if it were to be skinned). Next, align all of the morph meshes with the base mesh. Since we're working with full body meshes of varying height for this project, we'll center the pivots at the feet of each mesh.

Morphmesh export.jpg

To export, open the HeroBlade Export tool from the Utility panel.

  * Select Morph Mesh as the export mode.
  * Make sure the Include Tangent Space box is unchecked.
  * Make sure the Tangent Merge tolerance is set to 180.0
  * Make sure the Optimize Vertex Order box is unchecked.

You can export each mesh individually, or you can utilize the batch export. If you intend to use the batch export, name each mesh in the scene according to how you'd like the resulting files to be named. Use the 'export unhidden' buttons if you have anything hidden in the scene.

Convert to OBJ

Run your exported morph mesh files through the GR2toOBJ converter. If you don't already have this utility, you can download GR2toOBJ.exe converter from the Account Management System download page.

You can simply drag and drop files onto GR2toOBJ.exe one at a time to convert them, or utilize the BAT files included in the ZIP file to run the process on whole directories.

Confirm Meshes Will Morph Properly

Though this step is not required for your setup, it's a recommended means of double checking that your mesh topologies are all consistent and will give you the results you desire before delving further into the process.

First, import the OBJs (those you have just created from your original exports) back into 3DS Max. You may need to adjust the scale setting in the import dialogue to ensure the meshes are large enough to work with, or you may simply apply a uniform scale to them once they've been imported.

Select your original base mesh and apply a Morpher modifier to it.

In the modify panel, select the first empty slot, click on Pick Object from Scene, then select one of your morph meshes. You'll notice it's name will appear in the selected slot. Fill in the other empty slots with your morph meshes in the same way.

Morpher setup.jpg

Once you've added all of your morphs, you can use the rollers listed next to each morph (pictured below) to morph your base mesh into that shape. Experiment by dragging each morph to 100%, then back to 0.

Morpher rollers.jpg

Step 3. - Creating Skeletal Morphs

In this step, we will create skeletons to match any morph meshes that vary in size or proportion from the base mesh.


Bone names and bone hierarchy must be the same among the base skeleton and all of its skeletal morphs. For this reason, it is recommended that all skeletal morphs be derived from the dynamic character's base skeleton (in other words, edit copies of the base skeleton just as you edited copies of your base mesh to create morph meshes).

You will not need to skin your morph meshes to these new skeletons - simply use your morph meshes as a guideline to shape your morph skeletons. For the morphgirl character, I've created skeletons for the "Tall", "Short", and "Tiny" morph extremes. The "Large" morph mesh represents only an increase in muscle mass on the "Base" mesh with no proportional changes, and so it will utilize the same animation skeleton as the "Base" mesh. Below is the lineup of morph skeletons fitted to their morph meshes for the morphgirl character.

Skeletalmorph lineup.jpg


Open the HeroBlade Export tool in the 3DS Max Utility panel. Select Skeleton as your export mode. Be sure to include the SRB in each skeleton export, but do not include any morph meshes in the exports.

Save the skeletons to your character's root folder (in this case, HE\Character\morphgirl). Since we're working with an existing dynamic character, the base skeleton should already be in this folder and should not need to be re-exported.


The setup process for the skeletal morphs is quite simple. Once you've created and exported your skeletal morphs, you will need to edit the dynamic character's DYC file.

Facegen dyc.jpg

Step 4. - Facegen Project Setup

Initial Process

Make a copy of your Facegen template_directory. If you haven't been provided a copy of this folder already, you can download it here.

Give the folder a name that corresponds to your project. In this sample case, I'll be calling the folder 'Morphgirl'. Copy the OBJ versions of your exported morph meshes into the Morphgirl\egm\objs folder.

In Morphgirl\egm there should already exist a number of BAT and EXE files. Right click on the add_morphs.bat file and select edit. Beneath a set of instructions contained in the file, you should see the following text: Add morphs default.jpg

Add morphs edit.jpg

If you don't have three controls (morph meshes in addition to your base mesh) to add, you'll need to input some dummy controls.

Log file 5 file(s) copied. 4 diff morphs converted to EGM modes

Cache File Generation

Run the Facegen Customizer. You'll find Customizer.exe in the customizer_1_1 folder of your Facegen project folder. (If you have not yet acquired a license to run the Customizer, you'll need to do so at this point).

Click 'New Project' in the left menu. Enter the appropriate information. Make sure to place your Data Director inside the customizer_1_1 folder of your Facegen project folder. See below.

Facegen new project.jpg

"This step prepares you to re-shape your head model to FaceGen's mean face shape. Once your head model has been re-shaped, all your future accessory models or animation morphs should use this head model as your base reference." Click Next.

You'll be taken to a page listing the location of Facegen's default Internal Mean Face. You will be working with a substitute Internal Mean Face. Click Next.

You'll be prompted to import the Facegen default mean face and your registered model (custom made mesh). What you'll actually be doing is loading your substitute Internal Mean Face (which, in this case is actually a body mesh) in these locations. See below.


Click Next.

You'll be given some instructions not to delete certain files, and a suggestion to back up your registered models. Click Next again.

This is the cache file preparation stage. Click Next again. This should bring you to a seam selection stage. Facegenseams.jpg Since we're working with whole body meshes, we will not need to define any seams. Simply click Next again.

This step will generate the actual cache files. To begin the process, click Start Setup. Depending on how many control meshes you're working with and how detailed they are, this process can take anywhere from an hour to 12 hours. Be prepared to step away from the computer at this point to allow the process to complete.

Step 5. - Geometry Integration

Start up the Facegen Customizer, load your project, and select Geometry Integration from the menu. You'll be presented with a blank field assuming you haven't created an FGPRJ file yet (this is the file that defines for the Customizer which OBJs it will be running through the geometry integration process). Since you only have one part to start with, it'll be easiest at this point to just add it manually to the listing.

Click Add and you'll be prompted to enter some information:

Model Name - this will identify the part in the list.

Output Filename - this name will be given to the EGM, so you'll want it to match the name of the EGM as it's defined in your Facegen.DAT file - most likely you'll want to give it the same name as the OBJ/GR2 for this part. If it's male_body.gr2 and male_body.obj, enter male_body here.

Source File - browse to the OBJ file for this body part.

Click the Done button and the Model Name you assigned your part should now appear in the otherwise blank white field. Click on Start Integration - this will run the actual process. You'll receive a 'Done!' message in the bottom field once the process is complete.

You'll be able to find the EGM file for this part in the Facegen folder you have set up for this project under customizer_1_1\projWhateverNameYouGaveIt\csamWhateverNameYouGaveIt. You'll also see TRI and FR3D files here, but don't worry about them. You won't need them.

Step 6. - Implementation in HeroBlade


Files to upload to the Repository

Make sure you've got your dynamic part mesh file, its corresponding EGM, the Facegen.DAT file, the CTL file, the FG file, and any skeleton files you'll be using for your skeletal moprh uploaded to their respective places on your repository. The DYC, DAT, and PAR files that define the dynamic character should be there as well, of course. With all of these correctly in place, you should be able to visualize the morphs.

Assuming you've already set up the spec for this character (it sounds like you have already done those steps), create an instance of the character (/henpc create ...), possess it, and then pull up the HotSpot Menu (Shift+F1). Go to the CCS tab and click on Skeletal Morphing. The tool that pops up should display a list of the skeletal morphs you defined in your DYC file with a slider for each one. If everything has gone smoothly, both the character's body geometry and the skeleton should morph according to the slider positions.

Step 7. - Adding More Character Parts

Facegen Layouts Tool

This tool is in place to spare you from having to manually input a litany of file path data into your FGPRJ and Facegen.DAT files. If your dynamic characters are made up of only a few parts, it probably won't be necessary for you to use this. It's once you've added a lot of character parts to the PAR file of a morphable character that this utility will actually come in handy.

First, with your updated PAR file in place, bring the character in question into a clean test area. On the Render panel, scroll to the Character section where the Facegen Layout Files utility is located.

Coords To Export - check only the 'body' box (as I believe you've set up your character to use only a full body morph with no separate facial or head morphing).

Output Directory - enter a folder name where you want the layout files to be placed. I've found in the past that this tool is a bit fussy about working if the folder you indicate in this field doesn't pre-exist - this may be why it wasn't working for you. Try creating a 'layouts' folder or something of that nature right on your C drive, then specify C:\layouts in the Output Directory field.

Base Obj Directory - enter your OBJs root folder location here. This applies to the generation of the Customizer Layout (the FGPRJ file), so the folder you specify should be the one in which you're storing all of your OBJs (converted from dynamic part mesh files) for this character to run through the Geometry Integration process. In other words, it should be the same OBJ root directory you browsed to in the Customizer for the Source File when you manually added your character body part into the field for Geometry Integration.

(For example, I store all of my character OBJs at a network location I've mapped to R: on my computer, so in this field I enter R:\objs. In generating the layout, the utility will use the file path for each part in the character's PAR file to "guess" at the location of the corresponding OBJ file. As long as you've mimicked the folder structure of your character files under the OBJs root folder, this should work out correctly.)

Save - click the save button, then check your C:\layouts (or whatever name you happened to give it) folder. You should find a customizerLayouts folder and facegenDatLayouts folder inside. In customizerLayouts, there should be a YourCharacter'sName.layout file, and in facegenDatLayouts, a YourCharacter'sName.layout.body file - both of these are simply text files you're meant to copy and paste from.

What to do with these text files --

customizerLayout - copy the data to the FGPRJ file in the character's facegen folder (WhateverNameYouGaveIt\customizer_1_1\projWhateverNameYouGaveIt). Adding that one part manually earlier in the process should have automatically generated an FGPRJ in this location.

Don't paste over the existing [ModelSetInfo], [HeadModelPrep], or [IntegreateSetup] data. You can paste over everything under the [Integration] heading, however.

I've attached a sample FGPRJ file for a character facegen project named MaleHumanoidBody for your reference. It contains data for running a set of basic character parts through Geometry Integration. Note that the obj paths listed all begin with R:\objs in accordance with what I entered into the Base Obj Directory field to generate the data from the Render panel. Also note that there should be three lines of data for each model listed, and each model has a different number.

If I were to open up the corresponding Facegen project in the Customizer and select Geometry Integration from the menu, I would see all of these parts listed in the white field, ready to be run through the process.

facegenDatLayout - This should contain a list of all parts in your character PAR file with a corresponding EGM and GR2 path, similar to the body part listing under the SAMS heading of your existing Facegen.DAT file. You can simply copy all of this generated list into the DAT file under the SAMS heading.

It's a good idea to double check that the EGM paths listed are in fact where you're putting the EGMs on the repository. Because you checked the 'body' box in the layout generation utility, it will assume your EGM files are in a body folder inside the facegen folder (YourCharacter'sName\Facegen\body), so don't let that trip you up. The HeroBlade errors panel will notify you, however, of any EGM files it can't find, so misplaced EGM problems are usually an easy fix.


Skewing Geometry

At this stage, I'd recommend re-exporting your morph meshes. Double check that Include tangent space is unchecked, Tangent Merge is set to 180, and Optimize Vertex Order is unchecked. Convert the files to OBJs, replace the existing OBJs in the egm\objs folder of your facegen project folder, run process.bat again and check the log file to make sure it re-created all the necessary files.

Start up the Customizer, load that project, then hit the 'Back' button. This should bring you back to the internal statistics (cache file) set up area. Click the 'Start Setup' button. You'll receive a pop-up telling you the cache files already exist and asking if you want to continue where you left off. Click 'No', and this will start the cache file generation process over again. Once it's complete, run Geometry Integration on your body part again (you shouldn't need to do any more text file editing as the FGPRJ file already exists). Once that has finished, re-upload the FG, CTL, and body part EGM file to your repository.

See also

Personal tools