Working with Skyrim head TRIs
.TRI files are used for deforming head models in Skyrim. All character creation face shapes are controlled through these files. Here's everything I know about working with them, modifying them and creating new ones. This stuff generally requires solid existing understanding of 3D modeling and the Skyrim file structure.
This article is a work in progress and I'm adding to it as I go.
Essential tools for working with TRIs
Blender tri file import and export tool - For viewing and modifying TRI files in Blender 2.49b.
Animation Tools N2 - Command prompt based tool for extracting TRI morph states as OBJ files and compiling morphs.
Triton - One way of adding new OBJ morph states to TRIs and compiling morphs.
CharGen Extension - expired6978's API for generating extra chargen sliders out of additional morph entries in TRIs
Notepad++ for OBJ text editing
You also need Blender for quick previewing of morph files (much easier for that as you can load up entire TRIs at once). It's possible to do most of the things I'm going to describe in Blender alone, but I personally prefer using 3ds Max for morph management. Maya is also completely feasible.
I will explain the practical stuff for all of these tools in more detail below.
Headparts and what they do
This is the structure of a head model in Skyrim. There is some variance to the naming conventions in the files so pay close attention to them - this is just the gist of it. Each of these models has a primary .NIF mesh that stays untouched, which is deformed in ingame sliders according to what's found in their corresponding morph TRIs. Morphs are stacking and they form the final shape of the character's head. The general ingame hierarchy works roughly as follows:
Head -> Race morph -> Face shape morphs (jaw, cheeks, brow) -> Nose morph -> Lip morph -> Eye morph Expression morphs are overlaid on top of these.
One of the major challenges in working with morphs is that any edits made to the head deformations will not automatically show up in any of the overlay parts or eyes. Conformulating the overlay parts to adapt to the new face morphs generally does the trick, but I've found that eyes need to be set up manually as the Conformulator also deforms the eyeballs and it gets you ugly results.
Male faces pose the extra issue of having over 60 beard models that also require morphs. Having once gone through their race morphs manually for Ethereal Elven Overhaul, if you intend to do any changes at all to male heads you will want to definitely use the Conformulator to automate it.
Setting up a workspace for morphs and using Animation Tool
I like to keep a dedicated folder for BSA-extracted vanilla Skyrim meshes and textures. This way you always have backup files at hand. The meshes/actors/character assets folder is important here as it contains all head meshes. As I work with Animation Tool N2 for file management, I keep a separate directory with folders for each TRI file by part. This is because a TRI can contain over 140 morphs that will all be extracted into individual OBJs - and you don't want to get them mixed up with other morphs.
Put each vanilla morph TRI in a corresponding folder. Install Animation Tool wherever, you can access it this way.
Use TriExtractor.exe on the morph TRI, to recompile use TriCreator.exe on the generated TXT file you can see right below. After this point you can't move the files to any other folder without re-extracting as the exact filepath you extracted to is written in the text file.
Be extremely attentive when working with Animation Tool. Any mistake in naming convention or paths or anything will get you a broken TRI as a result. It's extremely unforgiving. So by default this txt file and the extracted OBJs correspond with the existing vanilla morphs. It's also possible to add new morphs as shown below. These in my example follow naming conventions that make them appear using CharGen Extension. It's not possible to add new sliders without it - otherwise you're restricted to replacing the functions of existing morph states.
Naturally just adding things to the TXT file isn't going to be enough. The morphs need to actually exist in the folder using the exact naming convention they appear in the list. I'm not going into the morph building just yet, only the file setup. For placeholders it's enough to make copies of the base headchargen.obj to represent the extra morphs and rename them to represent the final ones.
A totally valid alternative to this is adding all the new morph dummies straight into the TRI in Blender before running TriExtractor. It can be a little quicker. As said above, you need to repeat this procedure for every headpart morph that you don't run through Conformulator later.
Before you run TriCreator.exe open up every morph you edited/added in Notepad and check that they look like this. 3ds Max OBJ exporting messes this up and you need to manually edit it so the first line only says 'o [MorphName]' and nothing else. If you get a broken morph ingame this is a very likely culprit.
One way of managing morphs in 3ds Max
This is a very complex but very powerful setup for working with a large volume of morphs. If you just want to tweak a nose shape, it's not worth the trouble of setting it up - make changes in Blender instead, really. it's much less of a pain in the butt to put together.
Through a lot of experimentation I've come to prefer this setup the most - using a morph master scene and utilizing Morpher and Skin Wrap modifiers and the free Transmographier plugin for symmetrical editing. Working with a large volume of morphs gets cluttered quickly and this system provides at least a degree of organization to the workflow. One added complication comes out of the fact that Skyrim head meshes aren't completely symmetrical, so multiple Transmographier vertex masking instances have to be used to prevent deformation stacking of the plugin's realigning of a few asymmetrical vertices on the head across multiple morphs. I learned it the hard way. So I have multiple symmetry sources for each part of the face that I target to in the heads I'm editing. Selection masking is generally very valuable during morph work.
All OBJs should be imported and exported this way. The vertex order of the mesh MUST stay intact. Do not add or delete vertices, weld anything or touch the UVs. Only move vertices around.
The Core head only contains a Morpher modifier with modified copies of the head as targets and is kept at the exact position it imports in. It should not be moved or rotated at all, period. This is extremely important. The Core also has all the relevant head parts overlayed on top of it with Skin Wrap modifiers in them to make them conform to the head. For the eyes I made an element selection mask below Skin Wrap to cancel out any wrap effects on the eyeballs - only the eyelashes follow vertex deformation in the core head's eyes.
The morph targets are made by duplicating the Core Head and moving vertices around. Transmographier helps a lot in symmetry editing but it's not mandatory - it's totally feasible to also pick corresponding vertices on each side of the mesh and scale, move and rotate. If you just make replacer shapes for noses, lips or eyes you only need one shape. For CharGen Extension each slider needs a 0 and 1 state which represent opposite ends of the slider.
Exporting is done from the Core head. I zero all channels just to be sure, pick a morph, set it to 100%, check that the face parts are conforming right and export the core headmesh into the work folder I extracted the TRI into using the desired naming convention, with the settings from above. Always immediately run the exported OBJ through Notepad and correct the header:
If everything was done right, you can now run TriCreator on the .txt file and it should go through just fine. It's a good idea to test the TRI ingame before jumping to Conformulator and troubleshoot if something went wrong.
It's broken, help!
Crashing on game load usually means the TRI has been corrupted or is missing. Check the filename and location.
Missing / crumpled up head with floating eyes and teeth means you didn't correct the text data in Notepad for a morph.
This is horrible, I just want to make something quick in Blender.
I can't blame you. Here's the quickest and most effortless way of editing existing morphs.
It works, let's Conformulate!
The Conformulator's primary purpose was to generate TRI and EGM files for Oblivion hairstyles, but it's our savior with morphs. To prep up, put the tool and the files from Hair Morph Helper in an easy-to-access uncluttered location. Pick the parts you need to adapt to your headmorphs (usually brows, masks and beards) and open up their individual NIFs in Nifskope. Export the parts as OBJs from NifSkope to a dedicated folder in your workspace. It's smart to set this up to mimic the Skyrim character assets folder structure.
I picked my CharGen Extender female TRI for this and made a duplicate of the corresponding dummy EGM supplied with Hair Morph Helper, and renamed it to match my TRI. This is important!
In Conformulator, use these settings. Pick your head file and choose the OBJ for the headpart you want to adapt in the Hair File slot. Hit Conformulate. Done!
Repeat this for any other parts you want to adapt to the new morphs. Check naming conventions in the generated new TRIs and place them in your Skyrim Data folder. Test ingame. You should now have lovely, pretty custom morphs that have no clipping issues.