Making face mods for FaceTypePatcher - Neerhom/COM3D2.FaceTypePatcher GitHub Wiki
The issue of face mods
Before talking about the issue of face mods let's talk about how skin menu treat faces. In this example I'm going to use the menu for default skin which both CM3D2 and COM3D2 have - skin_normal_normal_i_.menu
Here, the outlined parts are the part of the menu that are responsible for loading face textures onto the face when when this menu is selected in-game. While one should be knowledgeable enough in order to make a face mod and know what those parts are, I want to going into detail how game chooses which face texture to load. In this particular example, the main tex is set to *_skin_002.tex and shadow tex is set to *_skin_002_shadow.tex. As you can see both texture names start with * but what does this mean to the game? The * means a filename without extension of the face model that maid currently uses. So for instance your maid has a menu file, that equips face005.model into head slot. When you select a skin, in this case default skin, the game will take filename of the model, and add _skin_002.tex and _skin_002_shadow.tex to it i.e. face005_skin_002.tex and face005_skin_002_shadow.tex and this will be the texture that game will be searching for.
So when one makes a face mod, that is not intended to override default face model, the filename of mod model must differ from those that game already has. So for instance I want to make a face mod that uses face model which is called myface.model. When I load this mod into a game, I'll get an error, because the game will be searching for myface_skin_002.tex and meyface_skin_002_shadow.tex when I want to use a default skin, which I didn't make. In order to avoid this error, i have to provide a set of textures FOR EACH skin, that follow KISS' face texture naming skin, otherwise some skins are not going to work properly.
Because face mods tend to be derivative of game's faces and they have the same or compatible UV-layout, modders usually duplicate a set of texture and name them accordingly to be usable in-game, which works fine for skin that are part of the base game, but become dodgy when the modder wants their face to work with DLC skins, as this would mean distribution of unmodified DLC files. Or the modder might now have the DLC and so the users that do have it cann't use the face with them.
The solution
The aim of FaceTypePatcher, is to fix that issue by introducing what I like to call a Face Type system. What is the Face Type system? In this system every face model form base CM3D2 or COM3D2 gets assigned a face according to their filename. KISS uses a simple naming convention for their face models, which is composed of face and three numbers i.e. face###.model. So when you browse trough game file, you can see that face models are called face003.model, face004.model and so on.
The FaceTypePatcher fakes the model filename of mod face and passes the face filname that game already has, which allow mod faces to work with ALL skins that game has or might have in future, without the need for providing any textures!
How FaceTypePatcher works
In order for FaceTypePatcher to fake the name the model filename of face mod must have a specific name. This was necessary as to enable model to specify texture set of what face they want the game to use for their face.
The patcher looks at the model filename and searches for a facetype keyword. If the model has this keyword It then check if there is a custom texture for this face, by using standard search pattern that game uses. This is done because some authors might actually want to use custom textures for default game skins.
If there is no custom texture available, the patcher will then check 3 characters after factype keyword to determine what face type the model has. The face type corresponds to three number that default face model have in their name i.e. face004.model has face type 004; face006.model, has face type 006 and so on.
So for example your face is a derivative of face012.model and you want your mod to use it's textures. In this case the filename of your model must contain facetype012 in it's name i.e. you can call it facetyp012_myface.model or you can call it myface-facetype012.model, both names are valid for . The name of the menu file is irrelevant.