RE4 2007 PMD TOOL by JADERLINK
Oct 3, 2023 6:49:24 GMT 10
Re-Play games and UNKNOWN MODDER like this
Post by JADERLINK on Oct 3, 2023 6:49:24 GMT 10
Note: the topic is being translated by google translator, because I only know Portuguese Brazil.
SourceCode: github.com/JADERLINK/RE4-2007-PMD-TOOL
Download: github.com/JADERLINK/RE4-2007-PMD-TOOL/releases
The content below is a translation of the README.md file of the source code.
These programs are a reworked version of the "magnum29" version of the "Re4 PMD to SMD model exporter" program which was written in "perl".
The biggest difference with his version is the possibility of compressing vertices, enabling smaller .pmd files.
RE4_PMD_Decoder.exe
Decodes and creates a .obj/.smd from pmd. The .txt2 .obj .smd .mtl and .idxpmd files are created
* .txt2 files are informative files that divide the pmd into parts for better visualization, which by default are not generated;
* .MTL: file that accompanies the .obj, used to load textures into the models, the textures are .TGA files and must be in the same folder as the pmd/obj file;
* .IDXPMD: is the file that contains content that is not in the .obj or .smd, but is necessary to recompile the .PMD; (see its content below)
* .OBJ and .SMD: contain the content of the 3d model.
RE4_PMD_Decoder.txt
This file is located in the program folder, it is a settings file for the program, see what they are below:
Note: these are "true" or "false" options;
EnableDebugFiles: this option defines whether the .txt2 debug file will be generated, which is used to have information from the .pmd file (normally used by programmers);
ReplaceMaterialNameByTextureName: by default the name of the materials is named "PMD_MATERIAL_000" where 000 is a number, however with this option active, the name of the material will be the name of the texture used, e.g. myTexture.tga (see below for the differences about that)
UseColorsInObjFile: with this option active, in the .obj file in the vertex parameters, you will have the colors for each vertex, but normally 3D editors do not support this.
RE4_PMD_Repack.exe
Creates a new .PMD file from the contents of .IDXPMD and .OBJ or .SMD (and can also use .MTL):
* The program receives as input an .obj or .smd file, and must also have an idxpmd file in the same folder with the same name as the supplied file. (and also a .mtl file);
* Vertex compression is supported in SMD and OBJ files. To activate the function, the .idxpmd file must contain the tag "CompressVertices:True", if you do not want to compress the vertices, change "True" to "False".
.idxPmd file
About how to define the name of the texture used
The texture name is obtained considering the following order:
* If UseMaterialLines is "true", it will get the texture name from MaterialLine if I have the material name listed.
* if UseMtlFile is "true" the texture name will come from the .mtl file
* If everything above is "false" or invalid, the texture name will be the name of the material itself
Order of bones in the .SMD file
To fix the order of the bone IDs in the smd files, after being exported from Blender or other model editing software, use the program: GC_GC_Skeleton_Changer.exe (search for the program on the re4 forum)
Loading textures into the .SMD file
In Blender to load the .SMD model with the textures, in a new "project", first import the .obj file for it to load the textures, delete the imported .obj model, now import the .smd model, now it will be loaded with the textures. (remembering that the .tga files must be in the same folder as the .OBJ/.SMD./PMD)
Scale
The scale of the Pmd files in the xfile folder are stored to be 100x smaller than the actual scale of the game.
And of the Pmd files in the xscr folder there are 1000x smaller than the actual scale of the game (but it also has other internal scales).
by: JADERLINK
2023-10-02
SourceCode: github.com/JADERLINK/RE4-2007-PMD-TOOL
Download: github.com/JADERLINK/RE4-2007-PMD-TOOL/releases
The content below is a translation of the README.md file of the source code.
These programs are a reworked version of the "magnum29" version of the "Re4 PMD to SMD model exporter" program which was written in "perl".
The biggest difference with his version is the possibility of compressing vertices, enabling smaller .pmd files.
RE4_PMD_Decoder.exe
Decodes and creates a .obj/.smd from pmd. The .txt2 .obj .smd .mtl and .idxpmd files are created
* .txt2 files are informative files that divide the pmd into parts for better visualization, which by default are not generated;
* .MTL: file that accompanies the .obj, used to load textures into the models, the textures are .TGA files and must be in the same folder as the pmd/obj file;
* .IDXPMD: is the file that contains content that is not in the .obj or .smd, but is necessary to recompile the .PMD; (see its content below)
* .OBJ and .SMD: contain the content of the 3d model.
RE4_PMD_Decoder.txt
This file is located in the program folder, it is a settings file for the program, see what they are below:
Note: these are "true" or "false" options;
EnableDebugFiles: this option defines whether the .txt2 debug file will be generated, which is used to have information from the .pmd file (normally used by programmers);
ReplaceMaterialNameByTextureName: by default the name of the materials is named "PMD_MATERIAL_000" where 000 is a number, however with this option active, the name of the material will be the name of the texture used, e.g. myTexture.tga (see below for the differences about that)
UseColorsInObjFile: with this option active, in the .obj file in the vertex parameters, you will have the colors for each vertex, but normally 3D editors do not support this.
RE4_PMD_Repack.exe
Creates a new .PMD file from the contents of .IDXPMD and .OBJ or .SMD (and can also use .MTL):
* The program receives as input an .obj or .smd file, and must also have an idxpmd file in the same folder with the same name as the supplied file. (and also a .mtl file);
* Vertex compression is supported in SMD and OBJ files. To activate the function, the .idxpmd file must contain the tag "CompressVertices:True", if you do not want to compress the vertices, change "True" to "False".
.idxPmd file
{Spoiler}
Below is the list of commands present in the .idxpmd file, the // are comments
// defines what is to compress the vertices, recommended to keep it as "True"
CompressVertices:True
//defines whether it is a scenario file, it is only true if it is a file from the "xscr" folder
IsScenarioPmd:False
// dataset about the bone, only used for the .obj file
// for the obj file, defines which bone will be used by the mesh/mesh
ObjFileUseBone:0
// number of bones
BonesCount:69
//the "0" is the bone's id, and the field below is the bone's name
BoneLine_0_Name:Scene_Root
// bone parent
BoneLine_0_Parent:-1
//set of 26 float fields
BoneLine_0_Data: //fields omitted in this example
// end of bone set
// set of data about the groups, defines the name of the groups, and which materials are part of each group
// number of groups
GroupsCount:23
group id:group name?SkeletonIndex id?set of materials that are part of the group
Group_0:pl000a_Jacket_pl000a_Jacket_01_obj?43?PMD_MATERIAL_000
//defines whether to load the colors of the vertices from the .obj file
LoadColorsFromObjFile: False
// defines whether to load and use the .mtl file, which is where you will get the texture name, (it is used in the .obj and .smd files), if it is "false", the texture name will be the name of material.
UseMtlFile: True
// defines whether the table below materials will be used (it is set to "false" by default)
UseMaterialLines: False
//list of materials
//MaterialLine?name of the material?no of the texture used: content of 17 float and 1 int (they are texture parameters)
MaterialLine?PMD_MATERIAL_000?pl0011.tga: //content omitted
End of .idxpmd file
Below is the list of commands present in the .idxpmd file, the // are comments
// defines what is to compress the vertices, recommended to keep it as "True"
CompressVertices:True
//defines whether it is a scenario file, it is only true if it is a file from the "xscr" folder
IsScenarioPmd:False
// dataset about the bone, only used for the .obj file
// for the obj file, defines which bone will be used by the mesh/mesh
ObjFileUseBone:0
// number of bones
BonesCount:69
//the "0" is the bone's id, and the field below is the bone's name
BoneLine_0_Name:Scene_Root
// bone parent
BoneLine_0_Parent:-1
//set of 26 float fields
BoneLine_0_Data: //fields omitted in this example
// end of bone set
// set of data about the groups, defines the name of the groups, and which materials are part of each group
// number of groups
GroupsCount:23
group id:group name?SkeletonIndex id?set of materials that are part of the group
Group_0:pl000a_Jacket_pl000a_Jacket_01_obj?43?PMD_MATERIAL_000
//defines whether to load the colors of the vertices from the .obj file
LoadColorsFromObjFile: False
// defines whether to load and use the .mtl file, which is where you will get the texture name, (it is used in the .obj and .smd files), if it is "false", the texture name will be the name of material.
UseMtlFile: True
// defines whether the table below materials will be used (it is set to "false" by default)
UseMaterialLines: False
//list of materials
//MaterialLine?name of the material?no of the texture used: content of 17 float and 1 int (they are texture parameters)
MaterialLine?PMD_MATERIAL_000?pl0011.tga: //content omitted
End of .idxpmd file
About how to define the name of the texture used
The texture name is obtained considering the following order:
* If UseMaterialLines is "true", it will get the texture name from MaterialLine if I have the material name listed.
* if UseMtlFile is "true" the texture name will come from the .mtl file
* If everything above is "false" or invalid, the texture name will be the name of the material itself
Order of bones in the .SMD file
To fix the order of the bone IDs in the smd files, after being exported from Blender or other model editing software, use the program: GC_GC_Skeleton_Changer.exe (search for the program on the re4 forum)
Loading textures into the .SMD file
In Blender to load the .SMD model with the textures, in a new "project", first import the .obj file for it to load the textures, delete the imported .obj model, now import the .smd model, now it will be loaded with the textures. (remembering that the .tga files must be in the same folder as the .OBJ/.SMD./PMD)
Scale
The scale of the Pmd files in the xfile folder are stored to be 100x smaller than the actual scale of the game.
And of the Pmd files in the xscr folder there are 1000x smaller than the actual scale of the game (but it also has other internal scales).
by: JADERLINK
2023-10-02