	MD3toMDL
Version: 0.3
By: Preach (andrew.denner@btinternet.com)
http://tomeofpreach.wordpress.com/md3tomdl

++++++++++++++++++++++++++++
This is the third release of the command line tool for creating .mdl format files from a .md3 format model.

This program takes a very simple text file, along with a .md3 file and optionally a skin, and outputs a .mdl file which should resemble the original .md3 model. I have lots to say about how you can use this tool on the blog linked above - but the main worth of this program is it lets you create .mdl models in modelling suites like 3dsmax, maya or blender which support .md3 exporting.

	1: The MD3

You need an .md3 file to use this program. When creating your .md3 you should keep in mind the limits of the .mdl format. md3tomdl itself does not enforce these limits but you may produce a model that some engines refuse to load. The main limits are:

1000 triangles
2000 vertices(old glquake engines will complain if you exceed 1000, but the released source code fixes that)
256 frames

This tool will import multiple surfaces from a .md3 file. .mdl format only supports one 'surface' though, so all the surfaces are combined by simply overlaying the uv mappings on top of one another, and writing all the vertices from each surface into the .mdl frames.

One of the most attractive features of md3tomdl is that it preserves the skinmapping of the md3 file, allowing you to create properly unwrapped models for quake 1. A lesser benefit is that the vertex normals in the .md3 file are also exported to .mdl. This means that you can also apply smoothing groups to your model and see them in game (to the extent that they can be seen in Quake).

WARNING: QMe will recalculate the vertex normals when it saves your .mdl, based on the current geometry of the model. This can have negative interactions with the two features above: the smoothing groups may be erased, and the unwrapped uv map requires some vertices to be split, meaning QMe creates a new hard-edged smoothing group along the seams of your model. If you use either of those features, you should avoid editing in QMe.

	2: The Skin

In order to keep the program low tech and lightweight, the only skin format accepted is an 8bit pcx file. Please make sure it is in the quake palette already, as no colour checking is performed, the palette indices are just mapped straight out of the file.

	3: The Text File

To use the program, you need to write a short "command file". Make a plain text file, containing the following commands:

md3file <path>
skinfile <path>
mdlfile <path>

where you replace <path> with the path to the .md3 file, the pcx skin and the desired output file. In the "example" folder you will find a sample command file named "arch.txt", along with a .md3 and .pcx file to test the tool with.

	4: The Tool

Run the tool with the command line md3tomdl <textfile>, where <textfile> is replaced by the name of the command file you just wrote. In seconds the model should be written. That's all there is to it, unless you want to look at the source! Have a go with the example files, then start experimenting. A quick way to explore the possibilities is replacing arch.md3 with a .md3 file of your choice.

	5: The Source

The source code is included for people who want to look, tweak, or port the tool to some obscure platform. It's my first proper c++ project, so I doubt it's a paragon of excellent code.

Hopefully it's written in portable c++, the only thing used outside the standard libraries is boost/cstdint.hpp, which is used for the fixed width integers required in the mdl binary. If you don't want to install boost, you can probably get away with including the C header file of the same name instead, and removing the "using boost::int8_t" lines. I haven't tried though, and would be interested to hear if someone pulls it off.

The source code for this tool is placed into the public domain.

	6. The Changes
	
v0.1: Initial release, converts simple md3 files with correct skinmaps and animation.

v0.2: Adds additional features: support for multiple surfaces in md3 file and for conversion of vertex normals.

v0.3: Fixes bugs in vertex position rounding, decoding of md3 vertex normals.

v0.4: Fixes handling of MD3 files where frames have non-zero origin, and crash when skinfile is not specified.