CP2077: Mesh replacement with variants

From Nexus Mods Wiki
Jump to: navigation, search

This tutorial will teach you how to switch a player mesh for an NPC garment and map its variants to the existing colours.

We'll assume that you know how to edit mesh appearances. If you don't, check the corresponding tutorial.

Step 1: Replace the mesh

Find the mesh that you want to use ("target mesh") and replace it with the one that you want to switch in ("source mesh").
Example: Replacing the short-sleeved poser jacket with the monk shirt with the tied-back sleeves.

target mesh base\characters\garment\player_equipment\torso\t2_084_jacket__short_sleeves\t2_084_pwa__short_sleeves.mesh
source mesh base\characters\garment\gang_monk\torso\t2_135_jacket__monk_shirt\t2_135_wa_jacket__monk_shirt.mesh

Open the target mesh in WKit. Now, replace it with the source mesh.

The target mesh will have a number of variants. You need to find their names:
See target mesh variants.png
Now, open the target mesh (that you've replaced with the source mesh). It will also have variants, but they'll be different:
Edit source mesh variants

Step 2: Change the .mlsetups

Now comes the annoying part: we need to find out which spawn code corresponds to which meshMeshAppearance. The process is a little tedious.

I've documented my results here, you're very welcome to add to the list once you've figured them out.

Now, open the target mesh (that is named like your source mesh). It will also have variants, but they'll be different:
Configure variants

For example, the appearance "black" with the chunks pointing at pasted_ml_t2_135_wa_jacket__monk_shirt_fancy will look for:

yes archive\base\characters\garment\gang_monk\torso\t2_135_jacket__monk_shirt\textures\ml_t2_135_wa_jacket__monk_shirt_fancy.mlsetup
no base\characters\garment\player_equipment\torso\t2_084_jacket__short_sleeves\textures\ml_t2_135_wa_jacket__monk_shirt_fancy.mlsetup

Don't ask me how the lookup/naming works, I have no idea. Just copy it from the source mesh.

The names of the meshMeshAppearance need to be taken from the target mesh - when spawning an item, the game will look for the variant "black", since that's mapped to the corresponding item code.
The values in the chunkMaterials belong to the source mesh. 

Rename all the variants in the source mesh with those from the target mesh. Then, make sure that you can tell them apart (e.g. by giving each variant an individual appearance or colouring the mlmasks. What worked for me was using primary colours on the mlmasks, and then using each of them fully or with plastic sleeves. Your mileage may vary.)

Step 3: Success!

After you've found out which spawn code corresponds to which appearance, you can now alter the appearance files. Enjoy!