Resident evil 5 - Modification of the character and more
Oct 1, 2021 21:20:43 GMT 10
Night Furious, Wesky, and 6 more like this
Post by HenryOfCarim on Oct 1, 2021 21:20:43 GMT 10
Foreword
While I was looking for a starting tutorial that describes in detail the process of modding 3D meshes for RE5, I came across the sad fact that it does not exist.
There are too many silent process demonstration videos where you can easily get lost in non-obvious subtleties, posts with deleted videos and dead image links, etc. So I decided to write such a tutorial by myself, based on information gained from my experience. I am not a top-tier guy in modding, but I would highly appreciate if someone leaves me some new knowledge or corrects my mistakes.
A lot of work has been done, I express my deep gratitude to Sraigius for making this text readable.
Note: This guide covers the modding process in a 3ds max environment. There is a much more advanced plug-in for the blender, but unfortunately, its developer has stopped the project, and documentation is almost absent.
Programs and scripts you will need
- FluffyQuack's ARC unpacker\repacker and PC batch files for it
- Any texture editor that can work with RGB channels and export files to DDS format as Gimp or Photoshop with the DDS plugin
- 3ds max 2012 or newer. 2012 works perfectly for import, however gpoly feature that is necessary for an easier way to fixing textures existed only in 2013-2016 versions. Warning: 2016 can corrupt imported skinweights for certain models.
- RE5 MOD TOOL Import-export script for 3ds max
- AlphaZomega's ResetMesh Script to fix leaked textures
- Noors normal thief script for transfering normals
- Re5TriStrip tool for converting exported from 3ds max .NewMod file to the game's .mod format
- Noesis 3d model viewer
- FLUFFY MANAGER 5000 mod manager will save your time will take over the backup files
Installing the tools
For installing the ARC tool, unpack the downloaded archive to a convenient and accessible location, then unpack the batch files to the same place. You only need pc-re5.bat.
To unpack any .arc archive, just drag and drop it on the pc-re5.bat file, but by default, it does not convert textures to DDS formats, so you need to edit it. Click the right mouse button on the pc-re5.bat file, then select Edit from the context menu and add -tex parameter to this row.
arctool -alwayscomp -re5 -texRE5 -v 7 -pc %1 %2 %3 %4 %5 %6 %7 %8 %9
It should look like this
arctool -alwayscomp -re5 -tex -texRE5 -v 7 -pc %1 %2 %3 %4 %5 %6 %7 %8 %9
Note:If you have the same bad luck as me and the ARC tool simply flashing for a second CMD window and does nothing, maybe it requires adding a path to ARCtool.exe in the batch file. In my case:
С:\User\Tutorial\Desktop\arctool -alwayscomp -re5 -tex -texRE5 -v 7 -pc %1 %2 %3 %4 %5 %6 %7 %8 %9
There is no need to install RE5ModTool and ResetMesh scripts, however it would be better to place them in some folder that can easily be reached. When you click "Run Script" 3ds max by default opening
3ds max installation folder\scripts
so I recommend you to move them there.
The NoorsNormalThief script just needs to be drag-n-dropped to the 3ds max viewport and then bound to somewhere via the Customize User Interface. I prefer to add it to the context menu
RE5TriStripV3 can be used in two ways:
- drag-n-drop a .NewMod file on the RE5TriStrip.exe
- set RE5TriStrip.exe app as default for opening ".NewMod" files
Therefore, choose the installation path depending on which way suits you best.
Noesis and Mod Manager both can be unpacked anywhere. I prefer to keep all tools in one folder
Quick explanation before importing
Before you start, I need to tell you about the archives, all game files are contained in .arc archives. The game archives are found here:
Resident Evil 5\nativePC_MT\Image\Archive
The names of these archives are mostly cryptic and it might be difficult to guess what is inside.
You can use this list to find the model you need.
The game is using slightly different 3d models of the same character for cut-scenes, campaign, mercenaries mode, and sometimes for figurine mode.
In addition, the archive of each cut-scene contains a duplicate of the models used in it. Sometimes the game skips loading the duplicate one when the model with the same name already is loaded but there is no guarantee that it will always work.
To unpack the archive, you need to drag-n-drop the .arc file to the pc-re5.bat batch file. It'll create a new folder in the same location where .arc file is and with the same name as the .arc file has where you will find many folders and files of which you only need .mod a 3d model file, .dds a texture file, and maybe .txt a texture header file
Width and Height prescribe the size of a texture, if you change the texture size or aspect ratio, please change the header's values accordingly.
Mips is a mysterious value, I believe 2 to the power of it should be bigger than Width or Height values. 2 to the power of 10 = 1024
Float1-3 is sorta a texture light reflectivity(in RGB channels?)
Importing and prepare the scene
After deciding which model you want to modify, go to the folder with the game and copy the corresponding arc archive
Usually, I create a project folder for the mod on the desktop, then create two more folders in it, one will store a backup copy of the .arc archive with the model, the other will be an unpacked version that I will modify. In both of them, I paste the copied file.
Next, the archive in the Mod folder, you need to unzip by dragging the batch file. After unpacking, you need to find where the mod file is, Noesis can help
After finding it, you need to run 3ds max, go to the max script section and run the RE5 Mod script
This is a very primitive utility that can
ImportMod - import a .mod file
ExportMod - export selected meshes to a .NewMod file
Mesh Rename - a section for simplified management of mesh parameters, as they will be written in the name of a mesh
Mesh_161_00 - Mesh ID that cannot be changed
LODx252 - ID Level of detail mesh
MatIDx3 - Material ID
Groupx0 DisplayModex0 - ID of unknown purpose, 99% of their change does not lead to anything
Click on ImportMod, go to a .mod file in the unpacked .arc folder, and select it. Importing process takes quite some time and during it the 3ds max window will not respond.
As you see model was imported and can now be edited. But before that, to understand what is happening in the scene, you need to open the scene explorer in a hierarchical view.
What we usually have after importing a character:
1. A skeleton consisting of helpers as bone objects with b_ prefix in their names, they, unfortunately, have only numerical indexes instead of proper names, which will not help in the skinning process, but rather make it unbearable
2. A sphere and several helpers that, judging by the names, are responsible for the collision or interaction of the character
3. And, finally mesh parts of our character, divided into Lod groups
Note: LodGroup node itself is useless, it's just a parent helper to which the child meshes with the corresponding LOD ID are attached to structure the imported objects in the scene.
As you might guess, LodGroup_1 will be displayed when the model is as close as possible to the game camera, LodGroup_2 a little further, LodGroup_252 as far as possible, but LodGroup_255 destroys logic. Models with this index will always be displayed, regardless of the distance. There are another "secret" LodGroup_0, which allows you to hide the mesh, which we will also need, because we can not add new models to the game, only replace parts of existing ones
For convenience, it will be better to create layers for each of the LodGroup, as well as for the bones.
Note: The import script does not always import vertex normal properly and when you export you may encounter black spots on the model. You can fix this by adding the modifier edit normals and weld the nearest normals. See how to deal with it in the Appendix chapter.
Creating a master mesh
3d models in RE5 have certain limitations:
- The maximum number of bones affecting the mesh should not exceed 32 (otherwise glitches may appear)
- A single mesh cannot contain more than 1 material
- The body itself must be divided into several parts because the game engine uses aggressive frustum culling technique, clipping off parts of the mesh, which provides only partial visibility. The torso occupies most of the body, so do not be surprised by the disappearing arms and legs, if you use a one-piece 3d model.
Also, I believe every mesh has kinda precalculated visibility so would be better to not use the shoe's ID for a head and vice versa - The seams on the UV mapping must match the seams on the 3d mesh, otherwise, you'll get "leaked" textures
Given the above, I will show you a workflow that can't be called non-destructive, but at least it allows you to go back and do changes without too much pain. For doing this, a single body(except eyes, hair, etc) mesh is created with the adjusted vertex normals and skin weights, then it is duplicated, the duplicate is divided into parts, and the values from the master mesh are transferred to these parts.
So, first things first, let's open an already prepared scene with imported mesh. Then import (or create a new in 3ds max) meshes for your mod (I like to move these meshes on a new Master layer), then adjust them roughly to fit the size and posture of the original model. After that, reset x-form and converted it into an editable mesh.
Before skinning, it would be better to merge vertices and adjust smoothing groups.
Now add the Skin wrap modifier to the master mesh and add to the list the parts of the original model from LodGrout1 that overlap the modified one. Set the settings as in the picture and press Convert To Skin.
Face Deformation is better for models with different topology
Falloff
Determines the extent to which the control vertices affect nearby points in the base object. This is a
global setting. Default=1.0. Range=0.001 to 10.0.
Threshold
Determines the distance in system units that 3ds max uses to find the closest face to a control vertex. The greater the distances by which the control object's and base object's surfaces deviate, the higher the Threshold value needs to be. Default=5.0
Depending on your luck, this may be enough, otherwise, you will face manual adjusting and torment when the mirroring skin weights tool copy them to the wrong bones because Capcom animators use unusual skeleton structure and a few bones are too close to each other and I didn't find any way how to map them manually in 3ds max.
Finalizing the mesh
Theoretically, this mesh can be already exported to the game, but the result might be unpredictable.
Therefore, in order not to try our luck, let's duplicate our master mesh, split it into parts so that they roughly resemble the division of the original mesh, also take into account the materials, because the game engine allows only one material per mesh.
Note: Don't try to outsmart devs, there is a reason why hands for one character split into two parts and another has them as a single one, etc. Believe me, I tried a few times, but every time this ended by re-editing to match the original partition.
So split your clone of the master mesh into parts to match the original partition and move them on a new layer, which I usually name as Exported. Also, I usually move duplicates of those meshes, but it's up to you on how precautious you want to be.
After this select meshes from LodGroup 1 or\and 255 which will be replaced by your mod meshes and move them on a new layer, usually, I name it as Replaced and copy-paste mesh names from Replace layer to corresponding ones from Exported
After that for each part we add a Skin wrap modifier with a master mesh as a target, then I usually duplicate these parts and move clones to a new layer Exported. This step with duplication is your choice. The experience forces me to be too careful.
Select your first modded part from the Exported layer and run the ResetMesh script. Depending on what version of 3ds max you are using, settings might be slightly different. For 3ds max 2013-2016
For other versions
WARNING Before using this script you should import any 3ds file to your scene, only to turn off the "Convert units" option, you can export-import any file from the scene and delete it at once.
Set this
The reset mesh script creates an already fixed clone of the selected mesh with the same name, so as not to get confused, it is desirable to immediately remove the original mesh that has in the stack of modifiers SkinWrap. Also, the script creates a SkinData file that was necessary for 3ds max for the transfer of skin weights. Usually, I create a SkinData layer which I make active and hidden then move the SkinData file here, every SkinData file after will move into this hidden layer.
Repeat these for all mod parts from the Export layer
Now we are at the finish line. ResetMesh script didn't transfer skin weights too precisely, so let's fix them. Select the master mesh and use Skin utility to extract skindata to the mesh from it, then select this skindata mesh, add first mesh from Export layer to the selection, press Import Skin Data From Mesh, and in dialog window press Match by Name and press Ok
Do the same for other meshes from the Export layer
Note: I am not sure is it right or useless but by default, the Skin modifier sets a limit of 20 bones per vertex, but the game only works with 4, so I set this limit for every part just in case.
The ResetMesh script also destroys the normals, to restore them, you need to transfer them from the master with NoorsNormalThief.
Select the master mesh as the Source object, then select the first mesh from the Export layer as Target object and press Steal! Repeat for each remaining mesh from the Export layer.
Note: In most cases, you can transfer normals from a mesh that contains modifiers, but if something goes wrong - make a duplicate of the master mesh, collapse the modifiers, and reset ResetXform, after you can use it as the Source object.
Now, the mesh is ready for export. Select the meshes in the Exported layer and press the ExportMod button from the Modtool window, next select the .mod file, that you imported before and wait. Depending on how many files you exporting it would take quite some time.
ModTool will create pl0100.Newmod file in the same place where your selected .mod file was. To convert it to the game format, drag-n-drop it on ReStripV3, It'll create pl0100.mod, then copy the name from the original .mod file, delete this, and pl0100.Newmod files and finally rename pl0100.mod with the name from the clipboard.
Let's see how the converted model looks with Noesis.
You can see that not only the textures on the mesh are incorrect, but there are still many parts from the original model that are no longer needed. Let's fix it.
Materials, LODs, and the mod manager
First, you need to deal with needless parts of the original model, just rename them with ModTool by setting the value of the LOD to 0. Since I'm not going to create low-res meshes for my mod and meshes from layers: Lod2, Lod3, Lod252 will be visible in the distance. I'll hide them too.
However, this will cause the remaining parts from Lod1 to disappear at a distance, you need to rename them by setting the LOD value to 255, now they will always be visible, regardless of the distance to the camera.
Next, materials, it's a pretty frustrating thing. Each mesh has its own MatID this MatID represent a material with a few linked textures(usually diffuse, specular, and normal map) to it, and I do not know another way than to choose a certain piece of the original model in 3ds max, look at its MatID, compare it with what textures Noesis displays, and then look for them in the unpacked .arc folder.
When you choose what textures you are going to change, apply corresponding MatID to your exported meshes with ModTool. The next step is replacing textures.
As for the textures, there is a great video where you can fully understand how they work, but in a nutshell:
DDS format with always enabled mipmaps
Diffuse texture = DXT5 compression for a map with transparency, DXT1 without it
Specular texture = DXT1 compression
For a normal map, you should create an alpha channel, copy a red channel to this alpha channel and fill the red channel with white color. Then export the texture with DXT5 compression.
Note: Sometimes you can notice that your normal maps don't look right, veins look like cavities, etc. To fix this, try to invert the green channel.
After replacing textures in your unpacked .arc folder, you are ready to re-export your mesh with ModTool, this time select all meshes from lod groups. I hide helpers in the viewport and select meshes there.
When it's done do the same step as before: drag-n-drop pl0100.Newmod on restrip, copy name from .mod file, delete this .mod and pl0100.Newmod, then rename pl0100.mod with clipboard value.
Finally drag-n-drop the unpacked .arc folder on pc-re5.bat and get a .arc archive with your mod that can be immediately copied to the folder with the game, but it would be wiser to use the Mod manager.
To make it work with the Mod manager, run it first and choose Resident Evil 5, after this, it should make this subfolder:
\Re5\Mods
You can create any folder there, and the name of this folder appears in the Mod manager mod list, but to make it work, you should re-create a path to your .arc, for example:
MySuperMod\NativePC_MT\Image\archive
When you copy your modded .arc archive here and enable it in the mod list, you can run the game
The Mod manager also supports a compressed folder with a mod but unfortunately only in .rar format.
That's all folks. You can find the mod from this tutorial here
Appendix
Known bugs and how to deal with them
Black spots on parts of the original model
ModTool does not every time import normals correctly
To fix it, add Edit normals modifier, set normals, turn on Use threshold, set a small value, select all(or only affected part) and press Selected
Glitchy shadow in figurine mode(and cut-scenes)
This, unfortunately, is a hellish pain, wise guys said this is the only Gold edition port problem that brought too many glitches. What I know is, this is a problem with bone influences, a mesh with a certain mesh ID could have only certain affecting bones. SkinWrap added small weights from the adjacent bone? You'll get a glitch.
Debugging process is very tedious, I remove unused bones from the skin modifier with this script and compare the original and modded parts. To find which mesh is causing the problem, you can alternatively assign a Lod0 to your mesh and see what happens in the game. Hidden parts don't cause the bug.
Stripes on the texture
You replaced the texture but didn't change the .txt header file with updated width and height
Head editing
The game is using hi-res heads with a haircut and eyes for cut-scenes. The hi-res head is hiding specific mesh IDs on the body model(so it's important to keep them in the same places for your mod).
Unfortunately, Capcom's implementation of this feature is weird, it makes visible seam between head and body despite the same skin weights and position of vertices. That's why all characters have necklaces, high collars, and so on.
Until ModTool v0.33 head editing was almost impossible, it works now but you should do a very similar partition as an original mesh has with the right MeshID. When you do it randomly, you'll get something like this:
Using alternative 3d editors
You can use 3ds max only for import-export and edit meshes in other 3D editors that have, for example, much better tools for skinning, using FBX as an intermediate format. If anyone is interested in Maya editing I can explain some subtleties.