Setting up .model files

From Rigged Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
2016 4chanlogo.png
Pro Evolution Soccer 2016
Game
Rules
Info
Tools
Modding

In PES (14, 15 and 16) .xml files are some of the most important files in the game. It has the data of which .model file and which .mtl file to load. The .mtl file is actually a sort of .xml file that assigns textures, shader settings and other material settings to .model files. Almost every single .model file requires a .mtl and texture to work correctly. This page has been written to supplement the RigEx page for self-made .model files.

.xml file

The most important file is usually the .xml file. As explained above it contains the most important info for PES to correctly load a .model and texture it. Although not every .model file has one, for example boots and balls do not have a .xml file, but gloves do. It is advised to copy an existing .xml file and edit it to your needs instead of making one from scratch yourself in most situations. If you want a decent .xml editor, download Notepad++ with the XML plugin.

For this guide we'll use the glove.xml of an existing GK glove in PES as example. Keep in mind that some .xml files might still be zlibbed, so unzlib them first if necessary.

<?xml version="1.0" encoding="UTF-8"?>
<config>
	<model level="0" type="gloveL" material="./glove_l.mtl" path="./glove_l.model"/>
	<model level="0" type="gloveR" material="./glove_r.mtl" path="./glove_r.model"/>
</config>
  • <?xml version="1.0" encoding="UTF-8"?> is the header of the .xml file, don't do anything with this.
  • Everything between he <config> </config> tags determine what is loaded, everything outside these tags is not.
  • The level determines the detail level. In PES 0 is used for closeup, 1 for LOD.
  • The type determines several settings in PES, there are some types that will make the .model automatically attach to a specific bone or use a specific texture regardless of the material.
  • The material is the .mtl file with all the shader and texture settings. The ./ implies it will use the specified file in the same folder the .xml is in.
  • The path is the .model file that will be used.

Watch out with using spaces in file names, the .xml file treats spaces as separators. So it is advised to use underscores for filenames.

Because there are so many different .xml files with different settings the example above cannot be used for any situation. So again, please copy an existing file and edit that instead of writing one from scratch yourself.

There is no .xml file

If a .model has no .xml file in standard PES, there is a very big chance that all/some files are named in a very specific way. So it is advised to name your files the same way PES has named them.

.mtl file

As stated above, the .mtl assigns the shader and texture settings to .model files in PES. For this example we'll use the glove_l.mtl file as mentioned in the .xml example above. It also advised for these files to open them with Notepad++. Keep in mind that some .mtl files might still be zlibbed, so unzlib them first if necessary. Also here it is advised to copy an existing .mtl file and edit it to your needs instead of making one from scratch yourself in most situations.

<materialset>
    <material name="Boots_Game_mat" shader="Boots">
        <sampler name="DiffuseMap" path="./g001_c.dds" srgb="1" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <sampler name="NormalMap" path="./g001_n.dds" srgb="0" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <sampler name="SpecularMap" path="./g001_sr.dds" srgb="1" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <state name="alpharef" value="0" />
        <state name="blendmode" value="0" />
        <state name="alphablend" value="0" />
        <state name="alphatest" value="0" />
        <state name="twosided" value="0" />
        <state name="ztest" value="1" />
        <state name="zwrite" value="1" />
    </material>
    <material name="Boots_Game_Alpha_mat" shader="Boots">
        <sampler name="DiffuseMap" path="./g001_c.dds" srgb="1" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <sampler name="NormalMap" path="./g001_n.dds" srgb="0" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <sampler name="SpecularMap" path="./g001_sr.dds" srgb="1" minfilter="linear" magfilter="linear" mipfilter="linear" uaddr="wrap" vaddr="wrap" waddr="wrap" maxaniso="2" />
        <state name="alpharef" value="0" />
        <state name="blendmode" value="0" />
        <state name="alphablend" value="1" />
        <state name="alphatest" value="0" />
        <state name="twosided" value="1" />
        <state name="ztest" value="1" />
        <state name="zwrite" value="0" />
    </material>
</materialset>
  • The <materialset> </materialset> note the start and the end of the .mtl files, everything outside these tags will not be read.
  • The <material> </material> note the end and start of a single entry for a single mesh in the .model file.
  • The name is the name of the mesh in the .model file the next material settings will be applied to. If you use RigEx, it is the name you gave to the mesh, also shown in the Object: box.
  • The shader is the shader (or rather, a shader config file) that will be used for the mesh. There are a lot of different shaders in PES, almost all of them can be found in dt15.cpk\common\render\shader\surfaceShaders. If you have no idea what shader to use, use the one that came with the .mtl file or a very similar one in the same file. If you have a shader that does not fit, you will notice it very quickly because the object will turn red, black, white or just look weird in general.
  • The sampler is a texture entry for the .model
  • The name of the sampler is the type of the texture that will be used. If you have no idea what a specific Map is, just google it. A mesh can only have the samplers that the shaders allows it to have. So open the .xml of the shader in the dt15.cpk folder and you'll see what samplers the shader has.
  • The path of the sampler is the texture that will be used for that specific sampler.
  • All the other sampler settings should be left alone in most cases. Only change them if you really know what you are doing.
  • The alpharef is used when the alphatest is enabled. This is a 0-255 scale, every pixel that has a transparency of and below the alpharef view will not be rendered.
  • The blendmode determines how the mesh is blended into the meshes below it.
  • The alphablend will render the .model with the transparency of the DiffuseMap if this is 1.
  • The alphatest will render the .model with transparency of the DiffuseMap, but it depends on the alpharef whether a pixel is rendered or not.
  • The twosided will make the .model visible from both sides. If you have set up the normals correctly in Blender it can be left at 0 as it required extra CPU and GPU power when enabled.
  • The ztest and zwrite are better left at their default values.

Keep in mind that not all shaders allow all the state settings, for example kit shaders will always ignore the alpha settings. And again watch out with using spaces in file names, the .mtl file treats spaces as separators. So it is advised to use underscores for filenames.

Because there are so many different .mtl files with different settings the example above cannot be used for any situation. So again, please copy an existing file and edit that instead of writing one from scratch yourself.

The .mtl file lacks specific settings

For some situations, like kits, the game does not use a specific DiffuseMap for a .model and will only list a few settings. You can still add the DiffuseMap sampler yourself, but it might not always work as the game will overwrite this setting. This is usually very dependent on the type in the .xml files. Sometimes states are missing because they are not needed, but they can still work if you add them yourself.