|This article or section should contain one or more images. Please spruce up the article by adding an image.|
MD2 models are 3D models that can replace sprites in OpenGL. In SRB2, to use a model, three things are needed: the model itself, a skin for the model (usually in PNG format, but PCX is also supported if no PNGs are available), and a file named
md2.dat that determines which sprites are replaced with what models. Apart from the file extension, the names for the model file and the skin file must be identical. Both files must be placed inside a folder named md2 in SRB2's main directory, or inside a subfolder within the md2 folder. It is important both files must be located in the same place.
md2.dat is a user-created configuration file that assigns the models to sprites. It must be placed in the main SRB2 directory. Only one such file is needed, regardless of how many models are loaded. For each model, one line of code must be added to the file.
A typical line of code in md2.dat looks like this:
Sonic PLAY.MD2 3.0 0.0.
The line contains four parameters:
- The first parameter is the name of the sprite set or skin that the model replaces – in the example above the skin
Sonicis being replaced. When replacing a sprite set, the four-character sprite prefix must be entered here, e.g.
SPR_THOK. Note that
SPR_PLAY, the base sprite set for all player sprites, cannot be replaced with a model – the individual player skins should be replaced individually. When replacing a skin, the skin name set in name for the S_SKIN must be used here.
- The second parameter,
PLAY.MD2, is the file name of the MD2, or the file location of the MD2 inside the md2 folder. Normally MD2 models are expected to be directly within the md2 folder, but they can also be within subfolders of this folder. In this case, the file name written in md2.dat should be
subfolder/PLAY.MD2, subfolder being the name of the subfolder in the md2 folder. Note that this parameter is also used to locate the skin file for the MD2, swapping ".MD2" with ".PNG" or ".PCX" – it is expected that the skin file is in the same folder as the MD2 itself.
- The third parameter,
3.0, is the overall size of the model displayed in-game.
- The fourth parameter,
0.0, is the offset of the model. Most models display correctly at 0.0, but some need an offset to display in the right place.
Authors usually provide the correct parameters and all that needs to be done to use them is to enter the parameters into md2.dat.