https://wiki.unvanquished.net/api.php?action=feedcontributions&user=Gavlig&feedformat=atomUnvanquished - User contributions [en-gb]2024-03-29T10:08:52ZUser contributionsMediaWiki 1.25.3https://wiki.unvanquished.net/index.php?title=Tutorials/Exporting_models&diff=638Tutorials/Exporting models2012-08-14T09:18:53Z<p>Gavlig: /* Engine Limitations */</p>
<hr />
<div>[[Category:Modeling]]<br />
<br />
==Overview==<br />
<br />
''Notice: This guide was written for Blender 2.61. Most of this guide should apply for other versions of Blender, but this is not guaranteed.''<br />
<br />
Getting a finished model out of Blender and into the game is a relatively involved process with a number of possible pitfalls. This guide aims to describe the process in as much detail as possible to assist users who have not done it before, or those who have exported models for other games and would like to know what (if anything) is different.<br />
<br />
At present, this guide primarily describes the process for exporting models to the MD5 format. While the engine supports both MD3 and MD5, the latter is preferred.<br />
<br />
Before a model may be exported and used in-game, it must be adequately prepared:<br />
<br />
* [[Exporting_Models#Engine_Limitations|Engine limitations]] must be adhered to.<br />
* The model must have a texture applied to it. This texture is not automagically applied to the model after it is exported and loaded in-game, this is only necessary to satisfy the MD5 exporter.<br />
* The model must be a mesh and must have an armature modifier applied to it.<br />
* The armature's bones all must have at least one keyframe.<br />
<br />
The actual process of exporting a model is straightforward:<br />
<br />
# After ensuring that the above requirements are met, the mesh itself is exported.<br />
# Each animation is exported separately.<br />
# A configuration file specifying data such as the bounding box size and vertical offset is written. This may include information that is specific to the particular type of model (i.e., buildable or player model).<br />
# A shader is written that determines how the model is textured in-game.<br />
# Finally, everything is compressed into a .pk3 archive, properly named, and placed in the correct folder to ensure that it is loaded and may be tested in-game.<br />
<br />
==Advantages and Disadvantages of the MD5 format==<br />
<br />
===Advantages===<br />
<br />
* Unlike MD3, MD5 is bone-based, meaning that instead of storing an entire mesh for each frame of animation, there is only one mesh file. This single mesh file is deformed using a vertex shader.<br />
* Because there is only one mesh, only one VBO (vertex buffer object) needs to be created for each MD5 model. The deformation is performed entirely on the GPU, so it is (theoretically) faster than MD3, and uses less memory.<br />
* Because the format is in plain-text, it can be easily verified for sanity (i.e., to ensure that it was exported correctly and not corrupted in some way).<br />
<br />
===Disadvantages===<br />
<br />
* Some forms of motion are more difficult to achieve.<br />
* Because the Blender 2.5/2.6 MD5 exporter can only export models animated only with bones, certain animation techniques (such as lattices) are not usable.<br />
* Because the format is in plain-text, it takes up more space than it needs to, though this is negligible and a MD5 model will typically be smaller than the same model in MD3 format.<br />
<br />
==Engine Limitations==<br />
<br />
The engine places certain limitations on the fidelity of your models. These are:<br />
<br />
* There may not be more than 128 bones.<br />
* There may not be more than 100,000 vertices.<br />
* There may not be more than 10,000 triangles.<br />
* No vertex may belong to more than four vertex groups (i.e., one vertex may not be controlled by more than four bones). An error message will be displayed in-game if this requirement is not met. See [[Exporting_Models#.22R_LoadMD5:_vertex_.25i_requires_more_than_.25i_weights_on_surface_.28.25i.29_in_model_.27.25s.27.22|this]] for more information. This is a limitation of the vertex shader ([https://github.com/Unvanquished/Unvanquished/blob/master/main/glsl/vertexSkinning_vp.glsl main/glsl/vertexSkinning_vp.glsl]) that deforms the base mesh.<br />
<br />
==Limitations of the MD5 format==<br />
<br />
The MD5 format only supports bones. You may not<br />
<br />
* Use lattices or any other means of deformation.<br />
* Scale bones.<br />
* Use keyframes on anything other than bone poses. You may, however, set keyframes on bone constraint influences or anything else that would affect a bone's position or rotation.<br />
<br />
Note that you do not have to have a parent/child relationship between bones. In fact, in some instances, avoiding a parent/child relationship is necessary to acheive certain effects, such as moving bones around.<br />
<br />
==Acquiring and installing the exporter==<br />
<br />
You can download the exporter from [http://www.katsbits.com/smforum/index.php?topic=178.0 this thread on katsbits.com]. Installation instructions are in the thread.<br />
<br />
Please be aware that there are [[Exporting_Models#All_or_part_of_the_mesh_appears_to_be_sucked_to_the_center|issues]] with certain versions of the exporter with certain versions of Blender.<br />
<br />
As of 15 May 2012, there is another MD5 exporter available for Blender 2.63+, available on [http://www.katsbits.com/smforum/index.php?topic=404.0 katsbits]. This is largely untested by the Unvanquished development team, although we are evaluating its use at present. The instructions in this guide currently apply only to the older exporter.<br />
<br />
==Exporting the mesh==<br />
<br />
''Please be aware that there are issues with the exporter and the current version of Blender. See [[Exporting_Models#All_or_part_of_the_mesh_appears_to_be_sucked_to_the_center|the troubleshooting section]] below for more information.''<br />
<br />
# Select the armature and the mesh. The order in which you select the two does not matter.<br />
# Click File &rarr; Export &rarr; Quake&nbsp;Model&nbsp;5&nbsp;(.md5)<br />
# On the left shelf that appears in the file prompt, change the Exports combo box to "Mesh only." Don't worry about the scale or name fields.<br />
# Click "Export MD5".<br />
<br />
Once this has been completed, you must manually edit the mesh file (the one with a <code>.md5mesh</code> extension) to specify the correct shader to use.<br />
<br />
<pre><br />
--- snip ---<br />
mesh {<br />
shader "models/buildables/medistat"<br />
<br />
numverts 4<br />
vert 0 ( 1.000000 0.000000 ) 0 1<br />
vert 1 ( 0.000000 0.000000 ) 1 1<br />
--- snip ---<br />
</pre><br />
<br />
Note that <code>models/buildables/medistat</code> is '''not''' a file path to a shader; it is the name (again, not filename) of the shader to use. That is, a shader with the matching name will be used for this model.<br />
<br />
To avoid having to do this every time you export the mesh, set the name of the material applied to the object in Blender to the same as you edited the md5mesh.<br />
<br />
Note that for buildables and weapons, the filename of the exported mesh is dictated by the corresponding [[Exporting_Models#Configuring_the_model|configuration file]]. All player models, however, are hardcoded to look for <code>body.md5mesh</code>.<br />
<br />
==Exporting the animations==<br />
<br />
===MD3===<br />
<br />
Exported MD3 animations require a configuration file that specifies which frames of the animation correspond to which actions the game will display.<br />
<br />
This varies slightly by the type (i.e., weapon or buildable) of model.<br />
<br />
===MD5===<br />
<br />
''Please be aware that there are issues with the exporter and the current version of Blender. See [[Exporting_Models#All_or_part_of_the_mesh_appears_to_be_sucked_to_the_center|this]] for more information.''<br />
<br />
The procedure for exporting animations is the same as for exporting the mesh with regard to selecting the mesh and the armature. Before using the exporter, however, you must be certain to set the start and end frames to encompass only the particular animation that you wish to export; each animation must be exported separately.<br />
<br />
[[Image:Md5_export_timeline.png|frame|center|The timeline view in Blender, which is used to set which frames of animation to export. Here, only one frame of animation (frame 180) is being exported.]]<br />
<br />
At the export file prompt, choose "Anim only." from the "Exports" combo box. Enter as the filename the name of the particular animation that you are exporting; the correct names to use are given below.<br />
<br />
===Weapon animation names===<br />
<br />
For more information, see the <code>CG_ParseWeaponFile()</code> function in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/cgame/cg_weapons.c src/gamelogic/gpp/src/cgame/cg_weapons.c]</code>.<br />
<br />
Developers: weapon state constants are enumerated in the <code>weaponstate_t</code> enum in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/game/bg_public.h src/gamelogic/gpp/src/game/bg_public.h]</code>:<br />
<br />
Artists may safely ignore this table.<br />
<br />
{| class="wikitable"<br />
|-<br />
! Constant<br />
! Description<br />
|-<br />
| <code>WEAPON_READY</code><br />
|<br />
|-<br />
| <code>WEAPON_RAISING</code><br />
|<br />
|-<br />
| <code>WEAPON_DROPPING</code><br />
|<br />
|-<br />
| <code>WEAPON_FIRING</code><br />
|<br />
|-<br />
| <code>WEAPON_RELOADING</code><br />
|<br />
|-<br />
| <code>WEAPON_NEEDS_RESET</code><br />
|<br />
|-<br />
|}<br />
<br />
Note that for both MD3 and MD5 models, there may be separate models for first- and third-person views. Please see "[[Exporting_Models#Weapons|Configuring the model]]" for more information regarding how to specify separate models.<br />
<br />
====MD3====<br />
<br />
MD3 does not use separate files for separate animations. Instead, a configuration file specifies what frames of a single MD3 animation are used for each in-game animation.<br />
<br />
''TODO: Find out how barrel spin is handled by the engine. Is it animated into the barrel model or is it done procedurally?''<br />
<br />
In addition to the base weapon mesh, there may be as many as three additional MD3 meshes:<br />
<br />
{| class="wikitable"<br />
|-<br />
! Search string<br />
! Tag<br />
! Description<br />
|-<br />
| <code>%s_flash.md3</code><br />
| <code>tag_flash</code><br />
| The weapon's muzzle flash.<br />
|-<br />
| <code>%s_barrel.md3</code><br />
| <code>tag_barrel</code><br />
| The weapon's barrel.<br />
|-<br />
| <code>%s_hand.md3</code><br />
| N/A<br />
| Hands holding the weapon model. Note: this is not used for third person models.<br />
|}<br />
<br />
For non-programmers, the <code>%s</code> string is replaced by the parameter given to the <code>weaponModel</code> or <code>weaponModel3rdPerson</code> keyword.<br />
<br />
The tag <code>tag_weapon</code> is used on the main weapon model to align the third person weapon model to the third person player model.<br />
<br />
====MD5====<br />
<br />
Note that each animation filename must have the <code>.md5anim</code> extension.<br />
<br />
{| class="wikitable"<br />
|-<br />
! Animation name<br />
! Engine constant<br />
! Description<br />
|-<br />
| <code>%s_view_idle</code><br />
| <code>WANIM_IDLE</code><br />
| Animation played when a weapon is not fired<br />
|-<br />
| <code>%s_view_lower</code><br />
| <code>WANIM_DROP</code><br />
| Animation palyed when a weapon is switched from?<br />
|-<br />
| <code>%s_view_reload</code><br />
| <code>WANIM_RELOAD</code><br />
| Weapon reload animation<br />
|-<br />
| <code>%s_view_raise</code><br />
| <code>WANIM_RAISE</code><br />
| Animation played when a weapon is switched to?<br />
|-<br />
| <code>%s_view_fire</code><br />
| <code>WANIM_ATTACK1</code><br />
| Default attack animation<br />
|-<br />
|<br />
| <code>WANIM_ATTACK2</code><br />
| rowspan="7" | Not sure what these are used for<br />
|-<br />
|<br />
| <code>WANIM_ATTACK3</code><br />
|-<br />
|<br />
| <code>WANIM_ATTACK4</code><br />
|-<br />
|<br />
| <code>WANIM_ATTACK5</code><br />
|-<br />
|<br />
| <code>WANIM_ATTACK6</code><br />
|-<br />
|<br />
| <code>WANIM_ATTACK7</code><br />
|-<br />
|<br />
| <code>WANIM_ATTACK8</code><br />
|-<br />
|}<br />
<br />
===Buildable animation names===<br />
<br />
====MD3====<br />
<br />
As always, MD3 buildable models require a separate configuration file that specifies which frames of the animation correspond to actions displayed by the game. This file is parsed by <code>CG_ParseBuildableAnimationFile()</code> in [https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/cgame/cg_buildable.c src/gamelogic/gpp/src/cgame/cg_buildable.c].<br />
<br />
Each line in the configuration file corresponds to a single animation. Those animations are in the same order as in the table for MD5 animation names below.<br />
<br />
The order that animations appear in the configuration file must match this order exactly. Animations may not be omitted.<br />
<br />
The syntax is as follows:<br />
<br />
<var>firstFrame</var> <var>numFrames</var> [<var>loopFrames</var> [<var>fps</var>]]<br />
<br />
* <var>firstFrame</var> &mdash; Specifies the initial frame of the animation.<br />
* <var>numFrames</var> &mdash; Specifies the number of frames following the initial frame that comprise that animation.<br />
* <var>loopFrames</var> &mdash; (''Optional'')<br />
* <var>fps</var> &mdash; (''Optional, may only be used if loopFrames is specified'') Specifies the framerate of the animation. If not specified, defaults to 1.<br />
<br />
C and C++ style comments (i.e., <code>//</code> and <code>/* */</code>) are permitted past the last argument.<br />
<br />
====MD5====<br />
<br />
As with weapon animations, each animation filename must have the <code>.md5anim</code> extension.<br />
<br />
These animation constants are in the <code>buildableAnimNumber_t</code> enumeration in [https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/game/bg_public.c src/gamelogic/gpp/src/game/bg_public.c].<br />
<br />
{| class="wikitable"<br />
|-<br />
! Animation name<br />
! Engine constant<br />
! Description<br />
|-<br />
| <code>construct</code><br />
| <code>BANIM_CONSTRUCT1</code><br />
| rowspan="2" | Construction animation, shown when the buildable is being built.<br />
|-<br />
| <code>construct2</code><br />
| <code>BANIM_CONSTRUCT2</code><br />
|-<br />
| <code>idle</code><br />
| <code>BANIM_IDLE1</code><br />
| Idle animation, shown when the buildable is not doing anything.<br />
|-<br />
| <code>idle2</code><br />
| <code>BANIM_IDLE2</code><br />
| Used for the unshrink animation for the barricade.<br />
|-<br />
| <code>idle3</code><br />
| <code>BANIM_IDLE3</code><br />
| Just another idle? (need to check this)<br />
|-<br />
| <code>attack</code><br />
| <code>BANIM_ATTACK1</code><br />
| rowspan="2" | Animation played when a buidlable is attacking.<br />
|-<br />
| <code>attack2</code><br />
| <code>BANIM_ATTACK1</code><br />
|-<br />
| <code>spawn</code><br />
| <code>BANIM_SPAWN1</code><br />
| Used only by spawn points (the telenode and the egg) when someone is spawning from them.<br />
|-<br />
| <code>spawn2</code><br />
| <code>BANIM_SPAWN2</code><br />
| Not used<br />
|-<br />
| <code>pain</code><br />
| <code>BANIM_PAIN1</code><br />
| Pain animation, used when a buildable is damaged in any way.<br />
|-<br />
| <code>pain2</code><br />
| <code>BANIM_PAIN2</code><br />
| Pain animation used for the barricade when it is damaged and shrunk.<br />
|-<br />
| <code>destroy</code><br />
| <code>BANIM_DESTROY1</code><br />
| Played when a buildable is killed or destroyed.<br />
|-<br />
| <code>destroy2</code><br />
| <code>BANIM_DESTROY2</code><br />
| Not used as far as I can tell<br />
|-<br />
| <code>destroyed</code><br />
| <code>BANIM_DESTROYED</code><br />
| The animation played after the buildable's destroy animation finishes playing but before it blows up; essentially, the buildable in a dead state.<br />
|-<br />
|}<br />
<br />
===Player animation names===<br />
<br />
As with weapon animations, each animation filename must have the <code>.md5anim</code> extension.<br />
<br />
Items in italics need to be double-checked.<br />
<br />
Note that at present, some of these strings do not match the constants.<br />
<br />
{| class="wikitable"<br />
|-<br />
! colspan="3" | Animation name<br />
! colspan="2" | Engine constant<br />
! rowspan="2" | Humans?<br />
! rowspan="2" | Aliens?<br />
! rowspan="2" | Description<br />
|-<br />
! Assumed Correct<br />
! Actual (Humans)<br />
! Actual (Aliens)<br />
! Humans<br />
! Aliens<br />
|-<br />
| <code>attack</code> <!-- checked --><br />
| <code>attack</code><br />
| <code>attack</code><br />
| <code>TORSO_ATTACK</code><br />
| <code>NSPA_ATTACK1</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>attack2</code> <!-- checked --><br />
| <code>idle</code><br />
| <code>attack2</code><br />
| <code>TORSO_ATTACK2</code><br />
| <code>NSPA_ATTACK2</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>attack3</code> <!-- checked --><br />
| <code>attack3</code><br />
| <code>attack3</code><br />
| N/A<br />
| <code>NSPA_ATTACK3</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>charge</code> <!-- checked --><br />
| N/A<br />
| <code>charge</code><br />
| N/A<br />
| <code>NSPA_CHARGE</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| Tyrant charge animation<br />
|-<br />
| <code>crouch</code> <!-- checked --><br />
| <code>crouch</code><br />
| N/A<br />
| <code>LEGS_IDLECR</code><br />
| N/A<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| <br />
|-<br />
| <code>crouch_backward</code> <!-- checked --><br />
| <code>crouch_forward</code><br />
| N/A<br />
| <code>LEGS_BACKCR</code><br />
| N/A<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| <br />
|-<br />
| <code>crouch_forward</code> <!-- checked --><br />
| <code>crouch_forward</code><br />
| N/A<br />
| <code>LEGS_WALKCR</code><br />
| N/A<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| <br />
|-<br />
| <code>die</code> <!-- checked --><br />
| <code>die</code><br />
| <code>die</code><br />
| <code>BOTH_DEATH1</code><br />
| <code>NSPA_DEATH1</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>gesture</code> <!-- checked --><br />
| <code>gesture</code><br />
| <code>gesture</code><br />
| <code>TORSO_GESTURE</code><br />
| <code>NSPA_GESTURE</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>idle</code> <!-- checked --><br />
| <code>idle</code><br />
| N/A<br />
| <code>LEGS_IDLE</code><br />
| N/A<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| Human idle animation. It seems as though NSPA_STAND ("stand") is used as the idle animation for aliens.<br />
|-<br />
| <code>jump</code> <!-- checked --><br />
| <code>jump</code><br />
| <code>jump</code><br />
| <code>LEGS_JUMP</code><br />
| <code>NSPA_JUMP</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>jump_back</code> <!-- checked --><br />
| <code>jump</code><br />
| <code>jump_back</code><br />
| <code>LEGS_JUMPB</code><br />
| <code>NSPA_JUMPBACK</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| Evidently although humans have a separate constant for jumping backwards, they use the same animation file as for jumping forwards.<br />
|-<br />
| <code>land</code> <!-- checked --><br />
| <code>land</code><br />
| <code>land</code><br />
| <code>LEGS_LAND</code><br />
| <code>NSPA_LAND</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>land_back</code> <!-- checked --><br />
| <code>land</code><br />
| <code>land_back</code><br />
| <code>LEGS_LANDB</code><br />
| <code>NSPA_LANDBACK</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| Like with jumping, humans evidently use the same animation for both LEGS_LAND and LEGS_LANDB.<br />
|-<br />
| <code>pain1</code> <!-- checked --><br />
| N/A<br />
| <code>pain1</code><br />
| N/A<br />
| <code>NSPA_PAIN1</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| Humans evidently do not have a pain animation?<br />
|-<br />
| <code>pain2</code> <!-- checked --><br />
| N/A<br />
| <code>pain2</code><br />
| N/A<br />
| <code>NSPA_PAIN2</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>run</code> <!-- checked --><br />
| <code>run</code><br />
| <code>run</code><br />
| <code>LEGS_RUN</code><br />
| <code>NSPA_RUN</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>run_backwards</code> <!-- checked --><br />
| <code>run</code> (?)<br />
| <code>run_backwards</code><br />
| <code>LEGS_BACK</code><br />
| <code>NSPA_RUNBACK</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| Note: Not sure if this is correct for the humans<br />
|-<br />
| <code>run_left</code> <!-- checked --><br />
| N/A<br />
| <code>run_left</code><br />
| N/A<br />
| <code>NSPA_RUNLEFT</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>run_right</code> <!-- checked --><br />
| N/A<br />
| <code>run_right</code><br />
| N/A<br />
| <code>NSPA_RUNLEFT</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>stand</code> <!-- checked --><br />
| <code>?</code><br />
| <code>stand</code><br />
| <code></code><br />
| <code>NSPA_STAND</code><br />
| ''No''<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| TORSO_STAND is in the code, but I didn't see an animation loaded for the humans<br />
|-<br />
| <code>stand2</code> <!-- checked --><br />
| <code>idle</code><br />
| <code></code><br />
| <code>TORSO_STAND2</code><br />
| <code></code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| ''No''<br />
| <br />
|-<br />
| <code>step</code><br />
| <code>step</code><br />
| <code></code><br />
| <code>LEGS_TURN</code>?<br />
| <code></code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| ''No''<br />
| <br />
|-<br />
| <code>swim</code> <!-- checked --><br />
| <code>swim</code><br />
| <code>swim</code><br />
| <code>LEGS_SWIM</code><br />
| <code>NSPA_SWIM</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>turn</code><br />
| <code>step</code><br />
| <code></code><br />
| <code>LEGS_TURN</code><br />
| <code></code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>walk</code> <!-- checked --><br />
| <code>walk</code><br />
| <code>walk</code><br />
| <code>LEGS_WALK</code><br />
| <code>NSPA_WALK</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>walk_backwards</code> <!-- checked --><br />
| <code>walk</code><br />
| <code>walk_backwards</code><br />
| <code>LEGS_BACKWALK</code><br />
| <code>NSPA_WALKBACK</code><br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>walk_left</code> <!-- checked --><br />
| N/A<br />
| <code>walk_left</code><br />
| N/A<br />
| <code>NSPA_WALKLEFT</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
| <code>walk_right</code> <!-- checked --><br />
| N/A<br />
| <code>walk_right</code><br />
| N/A<br />
| <code>NSPA_WALKLEFT</code><br />
| style="background:#ff1a1d;color:#fff;" | No<br />
| style="background:#3c9e2d;color:#fff;" | Yes<br />
| <br />
|-<br />
|}<br />
<br />
<!-- other animation constants seen that aren't in the table:<br />
LEGS_WALKCR_BACK<br />
--><br />
<br />
==Writing shaders==<br />
<br />
As was implied before, the texture(s) used by a model are not stored in the md5mesh or md5anim files; they are specified by a separate shader file that is placed in the <code>scripts/</code> directory.<br />
<br />
Shaders are a very large topic and are outside the scope of this guide. The [http://tremap.xtr3m.net/__Games/Xreal/Manual_Shader_1/ShaderManual.htm XReal shader guide] explains shaders in detail. However, the following shader should do for most purposes:<br />
<br />
<pre><br />
models/buildables/trapper<br />
{<br />
diffuseMap models/buildables/trapper/trapper.tga<br />
bumpMap models/buildables/trapper/trapper_n.tga<br />
specularMap models/buildables/trapper/trapper_s.tga<br />
}<br />
</pre><br />
<br />
Do take note that<br />
* <code>models/buildables/trapper</code> is NOT a path, it is merely a string that matches the shader specified by the <code>.md5mesh</code>, and<br />
* <code>bumpMap</code> actually refers to a normal map.<br />
<br />
==Configuring the model==<br />
<br />
Aside from the textures used by a model, the scale, vertical position, and bounding box size of the model must be specified. This is done with a configuration file. These were formerly placed in <code>overrides/buildables/</code> (for buildables) or <code>overrides/classes/</code> (for player models), but are now placed in <code>configs/</code>.<br />
<br />
===Player models===<br />
<br />
Reading the configuration file for player models is handled by the <code>CG_ParseCharacterFile()</code> function in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/cgame/cg_players.c src/gamelogic/gpp/src/cgame/cg_players.c]</code>.<br />
<br />
The configuration file may use the following keywords:<br />
<br />
''Note: this list is incomplete''<br />
<br />
<ul><br />
<li><code>headoffset <var>x</var> <var>y</var> <var>z</var></code></li><br />
<li><code>sex <var>gender</var></code><br />
<p><br />
Sets the gender of the model. Options are <code>f</code> for female or <code>n</code> for neuter. Any other character is interpreted as male.<br />
</p><br />
</li><br />
<li><code>fixedlegs</code></li><br />
<li><code>fixedtorso</code></li><br />
<li><code>firstTorsoBoneName</code></li><br />
<li><code>footsteps</code><br />
<p><br />
* <code>default</code><br />
* <code>flesh</code><br />
* <code>metal</code><br />
* <code>splash</code><br />
* <code>none</code><br />
</p><br />
</li><br />
<li><code>lastTorsoBoneName</code></li><br />
<li><code>torsoControlBoneName</code></li><br />
<li><code>neckControlBoneName</code></li><br />
<li><code>modelScale</code></li><br />
</ul><br />
<br />
As an example:<br />
<br />
<pre><br />
name "Basilisk"<br />
model level1<br />
modelScale 1.0<br />
skin default<br />
shadowScale 1.0<br />
hud alien_general_hud<br />
mins -18 -18 -18<br />
maxs 18 18 18<br />
crouchMaxs 18 18 18<br />
deadMins -18 -18 -4<br />
deadMaxs 18 18 4<br />
zOffset 0.0<br />
</pre><br />
<br />
===Weapons===<br />
<br />
Weapon configuration files are parsed with <code>CG_ParseWeaponConfig()</code> function in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/base/src/cgame/cg_weapons.c src/gamelogic/base/src/cgame/cg_weapons.c]</code>.<br />
<br />
The configuration file may use the following keywords:<br />
<br />
<ul><br />
<li><code>weaponModel <var>path</var></code></li><br />
<li><code>weaponModel3rdPerson <var>path</var></code></li><br />
<li><code>idleSound <var>path</var></code></li><br />
<li><code>icon <var>path</var></code></li><br />
<li><code>crosshair <var>path</var></code></li><br />
<li><code>disableIn3rdPerson</code></li><br />
</ul><br />
<br />
After those keywords, one of the following keywords must be used, followed by an opening curly brace (<code>{</code>), more commands, and a final closing curly brace (<code>}</code>):<br />
<br />
* <code>primary</code> (engine constant: <code>WPM_PRIMARY</code>)<br />
* <code>secondary</code> (engine constant: <code>WPM_SECONDARY</code>)<br />
* <code>tertiary</code> (engine constant: <code>WPM_TERTIARY</code>)<br />
<br />
The configuration between the curly braces is handled by <code>CG_ParseWeaponModeSection</code>, in the same file. It accepts the following keywords:<br />
<br />
<ul><br />
<li><code>missileModel <var>path</var></code></li><br />
<li><code>missileSprite <var>size</var> <var>shader</var></code><br />
* <var>size</var> &mdash; The size of the missile sprite. If this value is negative, it is made zero.<br />
* <var>shader</var> &mdash; The shader describing the missile sprite.<br />
</li><br />
<li><code>missileRotates</code></li><br />
<li><code>missileAnimates <var>startFrame</var> <var>numFrames</var> <var>frameRate</var> <var>looping</var></code></li><br />
<li><code>missileParticleSystem <var>name</var></code></li><br />
<li><code>missileTrailSystem <var>name</var></code></li><br />
<li><code>muzzleParticleSystem <var>name</var></code></li><br />
<li><code>impactParticleSystem <var>name</var></code></li><br />
<li><code>impactMark <var>size</var> <var>shader</var></code></li><br />
<li><code>impactSound <var>index</var> <var>path</var></code><br />
* <var>index</var> &mdash; The index of the sound file, clamped to the range [0,3]; up to four impact sounds may be defined with this keyword.<br />
* <var>path</var> &mdash; The file path of the sound file to use.<br />
</li><br />
<li><code>impactFleshSound <var>index</var> <var>path</var></code><br />
* <var>index</var> &mdash; The index of the sound file, clamped to the range [0,3]; up to four impact sounds may be defined with this keyword.<br />
* <var>path</var> &mdash; The file path of the sound file to use.<br />
</li><br />
<li><code>alwaysImpact</code></li><br />
<li><code>flashDLightColor <var>red</var> <var>green</var> <var>blue</var></code><br />
<p>Specifies the color of the muzzle flash <!-- didn't actually double check this --> dynamic lighting.</p><br />
* <var>red</var> &mdash; The red color component as a floating point number in the range [0,1].<br />
* <var>green</var> &mdash; The green color component as a floating point number in the range [0,1].<br />
* <var>blue</var> &mdash; The blue color component as a floating point number in the range [0,1].<br />
</li><br />
<li><code>continuousFlash</code></li><br />
<li><code>missileDlightColor <var>red</var> <var>green</var> <var>blue</var></code><br />
* <var>red</var> &mdash; The red color component as a floating point number in the range [0,1].<br />
* <var>green</var> &mdash; The green color component as a floating point number in the range [0,1].<br />
* <var>blue</var> &mdash; The blue color component as a floating point number in the range [0,1].<br />
</li><br />
<li><code>missileDlight <var>size</var></code><br />
* <var>size</var> &mdash; If this value is negative, it is made zero.<br />
</li><br />
<li><code>firingSound <var>path</var></code></li><br />
<li><code>missileSound <var>path</var></code></li><br />
<li><code>flashSound <var>index</var> <var>path</var></code><br />
* <var>index</var> &mdash; The index of the sound file, clamped to the range [0,3]; up to four impact sounds may be defined with this keyword.<br />
* <var>path</var> &mdash; The file path of the sound file to use.<br />
</li><br />
</ul><br />
<br />
As an example, this is the configuration for the chaingun (<code>models/weapons/chaingun/weapon.cfg</code>):<br />
<br />
<pre><br />
weaponModel models/weapons/chaingun/chaingun.md3<br />
<br />
icon icons/iconw_chaingun<br />
crosshair 48 gfx/2d/crosshair-chaingun_s<br />
<br />
primary<br />
{<br />
flashDlightColor 1.0 1.0 0.0<br />
flashSound 0 models/weapons/chaingun/flash0.wav<br />
flashSound 1 models/weapons/chaingun/flash1.wav<br />
flashSound 2 models/weapons/chaingun/flash2.wav<br />
flashSound 3 models/weapons/chaingun/flash3.wav<br />
<br />
impactMark 8 gfx/marks/bullet_mrk<br />
<br />
impactSound 0 models/weapons/chaingun/impact0.wav<br />
<br />
impactParticleSystem models/weapons/rifle/impactPS<br />
muzzleParticleSystem models/weapons/chaingun/muzzlePS<br />
}<br />
</pre><br />
<br />
===Buildables===<br />
<br />
Reading the configuration file for buildables is handled by the <code>BG_ParseBuildableFile()</code> function in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/gamelogic/gpp/src/game/bg_misc.c src/gamelogic/gpp/src/game/bg_misc.c]</code>.<br />
<br />
The configuration file may use the following keywords:<br />
<br />
<ul><br />
<li><code>model <var>index</var> <var>path</var></code><br />
* <var>index</var> Some models may actually have several different model files (not sure why); this argument specifies which. Clamped to the range [0,3] (which should actually be [0, MAX_BUILDABLE_MODELS]), which means that you may use as many as four models per buildable. This is only used by the machine gun turret, which is composed of different parts.<br />
* <var>path</var> The file path where the model file is located. Note that for MD5 models, an extension of <code>.md3</code> is still to be used; it will automatically be changed by the engine.<br />
</li><br />
<li><code>modelScale <var>scale</var></code><br />
<p>Scales the model linearly.</p><br />
</li><br />
<li><code>mins <var>minX</var> <var>minY</var> <var>minZ</var></code><br />
<p>The coordinates passed to this and <code>maxs</code> define the bounding box for the model that is used for collision. The bounding box is always aligned to the global coordinate axes regardless of the orientation of the model, which is something to keep in mind when defining these values. You will likely have to debug these values by enabling drawing the bounding boxes. Load a map in developer mode with <code>\devmap</code> and set <code>\cg_drawBBOX</code> to 1. The three arguments combined form the coordinate of one corner of the bounding box, and <code>maxs</code> the opposite corner.</p><br />
</li><br />
<li><code>maxs <var>minX</var> <var>minY</var> <var>minZ</var></code><br />
<p>Defines the opposite corner of the AABB. (See above.)</p><br />
</li><br />
<li><code>zOffset <var>offset</var></code><br />
<p>Sets the vertical offset of the model; in other words, how far off the ground it is.</p><br />
* <var>offset</var> The offset as a floating point (decimal) value.<br />
</li><br />
</ul><br />
<br />
As an example:<br />
<br />
<pre><br />
model 0 models/buildables/trapper/trapper.md3<br />
modelScale 0.8<br />
mins -15 -15 -15<br />
maxs 15 15 15<br />
zOffset -15<br />
</pre><br />
<br />
Note that at present, you do not have to change the filename extension of the model to match what it actually is; that is, if the model is actually an md5, you may leave the extension as ".md3" and not ".md5mesh" or whatever.<br />
<br />
==Directory overview==<br />
<br />
This section provides an overview of the subset of the directory structure used by models; directories used for other purposes have been omitted.<br />
<br />
* <code>armor/</code> Location of configurations for the three armor types (i.e., light, helmet, and battlesuit). You should not have to edit these.<br />
* <code>configs/</code> Location of configuration files for various models.<br />
** <code>buildables/</code><br />
* <code>scripts/</code><br />
* <code>gfx/</code> Location of various 2d effect textures, such as those used for weapons.<br />
** ''Subdirectories omitted for brevity''<br />
* <code>models/</code><br />
** <code>ammo/</code><br />
*** <code>tesla/</code> Contains a single image used for the tesla sparks. Not sure why it's located here.<br />
** <code>buildables/</code><br />
*** <code>acid_tube/</code> Acid tube<br />
*** <code>arm/</code> Armory<br />
*** <code>barricade/</code> Barricade<br />
*** <code>booster/</code> Booster<br />
*** <code>dcc/</code> Defense Computer<br />
*** <code>eggpod/</code> Egg<br />
*** <code>hive/</code> Hive<br />
*** <code>hovel/</code> Hovel<br />
*** <code>medistat/</code> Medistation<br />
*** <code>mgturret/</code> Machinegun Turret<br />
*** <code>overmind/</code> Overmind<br />
*** <code>reactor/</code> Reactor<br />
*** <code>repeater/</code> Repeater<br />
*** <code>telenode/</code> Telenode<br />
*** <code>tesla/</code> Tesla generator<br />
*** <code>trapper/</code> Trapper<br />
** <code>players/</code><br />
*** <code>builder/</code> Human builder model.<br />
*** <code>human_base/</code> Unarmored human model. Also includes the jetpack and battery pack.<br />
*** <code>human_bsuit/</code> Battlesuit model.<br />
*** <code>level0/</code> Dretch.<br />
*** <code>level1/</code> Basilisk and advanced basilisk. (The advanced basilisk uses the same model as the regular dragoon, but a different texture.)<br />
*** <code>level2/</code> Marauder and advanced marauder. (Same as basilisk with regard to advanced model.)<br />
*** <code>level3/</code> Dragoon and advanced dragoon. (Same as basilisk with regard to advanced model.)<br />
*** <code>level4/</code> Tyrant.<br />
** <code>weapons/</code><br />
*** <code>abuild/</code> As there is no weapon model for the granger, the only thing in this directory is a config to hide the (nonexistant) weapon model in third person (a hack, I guess).<br />
*** <code>abuildupg/</code> Advanced granger weapon. Same as above, except the config file specifies sounds for the attack sounds (which are also located in this directory).<br />
*** <code>ackit/</code> Advanced construction kit.<br />
*** <code>blaster/</code> Blaster.<br />
*** <code>chaingun/</code> Chaingun.<br />
*** <code>ckit/</code> Construction kit.<br />
*** <code>flamer/</code> Flamethrower.<br />
*** <code>grenade/</code> Grenade.<br />
*** <code>hive/</code> Sprites, configuration file, and sound file for the hive.<br />
*** <code>lcannon/</code> Lucifer cannon.<br />
*** <code>level0/</code> Dretch configuration and attack sound file.<br />
*** <code>level1/</code> Basilisk configuration and attack sound files (hit and miss).<br />
*** <code>level1upg/</code> Advanced Basilisk configuration and added gas attack sound file.<br />
*** <code>level2/</code> Marauder configuration and attack sound files (hit and miss).<br />
*** <code>level2upg/</code> Advanced Marauder configuration and added electric attack sound file.<br />
*** <code>level3/</code> Dragoon configuration and attack sound files (hit, miss, and pounce).<br />
*** <code>level3upg/</code> Advanced Dragoon configuration and added barb sound files and model.<br />
*** <code>level4/</code> Tyrant configuration and attack sound files (hit and miss).<br />
*** <code>lgun/</code> Lasgun<br />
*** <code>lockblob/</code><br />
*** <code>mdriver/</code> Mass Driver<br />
*** <code>mgturret/</code> Machinegun turret '''''FIXME: why does this show up twice?'''''<br />
*** <code>prifle/</code> Plasma rifle<br />
*** <code>psaw/</code> Painsaw<br />
*** <code>rifle/</code> Rifle<br />
*** <code>shells/</code><br />
*** <code>shotgun/</code> Shotgun<br />
*** <code>teslagen/</code> Tesla generator '''''FIXME: why does this show up twice?'''''<br />
* <code>overrides/</code> Depreciated directory for model configuration files. Use <code>configs/</code> instead.<br />
** <code>buildables/</code> Depreceated location for buildable model configs.<br />
** <code>classes/</code> Depreceated location for character model configs.<br />
* <code>scripts/</code> Location for shaders.<br />
<br />
==Getting the model in game==<br />
<br />
There are two approaches to test your model in-game. The model and related files may be in actual folders, or the engine can load them from a <code>.pk3</code> file, which is really just a zip-compressed archive with the extension changed.<br />
<br />
The engine always prioritizes files in <code>.pk3</code> archives over files and folders at the same priority. The priority from highest to lowest is as follows:<br />
<br />
# <code>fs_homepath/fs_game</code><br />
# <code>fs_basepath/fs_game</code><br />
# <code>$PWD/fs_game</code><br />
# <code>fs_homepath/fs_basegame</code><br />
# <code>fs_basepath/fs_basegame</code><br />
# <code>$PWD/fs_basegame</code><br />
# <code>fs_homepath/BASEGAME</code><br />
# <code>fs_basepath/BASEGAME</code><br />
# <code>$PWD/BASEGAME</code><br />
<br />
<code>BASEGAME</code> is a preprocessor macro (for non-programmers, a constant; i.e., this cannot be changed at runtime) set to <code>main</code> in Unvanquished. <code>$PWD</code> is the directory that Unvanquished was started from.<br />
<br />
Programmers may be interested in <code>[https://github.com/Unvanquished/Unvanquished/blob/master/src/engine/qcommon/files.c src/engine/qcommon/files.c]</code>.<br />
<br />
The default locations for <code>fs_basepath</code> and <code>fs_homepath</code> are as follows:<br />
<br />
{| class="wikitable"<br />
|-<br />
|<br />
| <code>fs_basepath</code><br />
| <code>fs_homepath</code><br />
|-<br />
| Windows<br />
| TODO<br />
| TODO<br />
|-<br />
| Linux<br />
| $HOME/.Unvanquished<br />
| The directory in which Unvanquished is installed.<br />
|-<br />
| Mac OS X<br />
| TODO<br />
| TODO<br />
|}<br />
<br />
Basically, the process to get data in-game is to create a temporary directory somewhere and copy the model, shader(s) and configuration file to that directory (creating sub-directories as necessary), then compress the temporary directory as a <code>.zip</code> archive. Change the extension of the <code>.zip</code> archive to <code>.pk3</code> and move it into whichever directory you please, knowing that higher priority files will be used over lesser priority files. An example directory structure might look like this:<br />
<br />
* tmp<br />
** configs<br />
*** buildables<br />
**** acid_tube.cfg<br />
** models<br />
*** buildables<br />
**** acid_tube<br />
***** acid_tube.md5mesh<br />
***** acid_tube.tga<br />
***** acid_tube_g.tga<br />
***** acid_tube_n.tga<br />
***** acid_tube_s.tga<br />
***** idle.md5anim<br />
***** ''other animations omitted for brevity''<br />
** scripts<br />
*** acid_tube.shader<br />
<br />
Please note that the exact name of the textures used is not strictly defined; these may be whatever you please and are specified by the shader file. See [[Exporting_Models#Writing_shaders|Writing shaders]] for more information.<br />
<br />
==Testing the model==<br />
<br />
Once you have the model exported, the shader and configuration written, and everything packaged into a .pk3 file and in place, you are ready to test.<br />
<br />
===Testing externally===<br />
<br />
Rather than testing the exported model in-game, you may also test the model with a stand-alone MD5 viewer. At present, there is a viewer for Windows available [http://www.katsbits.com/files/md5/modelviewer_0.93a.zip here].<br />
<br />
===Testing in game===<br />
<br />
Start the game, and enter the following commands:<br />
<br />
\sv_pure 0<br />
\devmap atcshd<br />
<br />
You may also load a map with the regular <code>\map</code> command. Be aware, however, that <code>devmap</code> enables cheats which can make it easier to test (such as being able to jump directly to stage 2 or 3 if required). Also note that with <code>devmap</code>, the build time for buildables is zero, so the building animation(s) will not play.<br />
<br />
====Tips====<br />
<br />
* If the model is a buildable, weapon, or player model that is not immediately available (i.e., not available until a later stage), you can change the stage with <code>g_alienStage</code> or <code>g_humanStage</code>. Both of these cvars accept a single parameter, which is the zero-based index of the stage; to skip to stage 2, use 1 as a parameter, and to skip to stage 2, use 2 as a parameter (stage 1 is 0).<br />
* If you do not have sufficient credits to purchase an item model you wish to test, or evos to evolve to the desired class, you may give yourself the maximum amount that you can carry with <code>\give all</code>.<br />
* To make yourself invincible, use the <code>\god</code> command.<br />
* To stop buildables from attacking, use the <code>\notarget</code> command.<br />
* To stress test the engine's ability to display a large number of buildables, set <code>g_humanBuildPoints</code> or <code>g_alienBuildPoints</code> to as high as you wish; this will allow you to build as much as you please.<br />
<br />
====Debugging the model====<br />
<br />
* To determine what file was loaded for a particular asset (e.g., to determine if files are being read from a particular <code>.pk3</code> archive), use the <code>\which</code> command with the relative path to the asset as an argument, such as <code>\which&nbsp;models/buildables/acid_tube/acid_tube.md5mesh</code>. Note that <code>which</code> accepts both forward- and backslashes regardless of platform.<br />
* To visually inpsect a model's bounding box, which is set by its configuration file, set <code>\cg_drawBBOX</code> to 1.<br />
* To visually inspect the bone structure of a MD5 model, set <code>r_showSkeleton</code> to 1. ''Note: at present there is a bug that causes bones to be displayed incorrectly. See [https://github.com/Unvanquished/Unvanquished/issues/2 Issue #2] on GitHub for more information.''<br />
* To hide map geometry, set <code>r_drawworld</code> to <code>0</code>. Note that with this set to <code>0</code>, PVS will still be in effect, so it might still be difficult to view your model.<br />
<br />
==Troubleshooting==<br />
<br />
===Error while exporting from Blender with the MD5 exporter===<br />
<br />
{| class="wikitable"<br />
|-<br />
| [[Image:Md5_export_error_no_armature.png]]<br />
| style="vertical-align:top;" | This error displays when the selected object does not have an armature modifier. Any object exported as an md5 needs bones, even if it is static. If you are unsure of how to create a static object with md5, just add an armature, set the playback start and end frame to 1, and add a location or rotation keyframe at frame 1.<br />
|-<br />
| [[Image:Md5_export_error_no_animation.png]]<br />
| style="vertical-align:top;" | This error displays when there are no keyframes. Follow the abov instructions for exporting a static object with md5.<br />
|-<br />
| [[Image:Md5_export_error_no_material.png]]<br />
| style="vertical-align:top;" | This error displays when the object does not have a material applied to it. This is required by the script, even though it really does not affect the exported result.<br />
|-<br />
|}<br />
<br />
===Appearance problems in-game===<br />
<br />
====All or part of the mesh appears to be sucked to the center====<br />
<br />
''Please note that as of 2012-02-27, the MD5 exporter does not work properly in several more recent versions of Blender. Use Blender 2.59 until this is fixed. See [http://www.katsbits.com/smforum/index.php?topic=167.msg2135#msg2135 the MD5 exporter thread] for more information.''<br />
<br />
This can happen for a number of reasons:<br />
<ul><br />
<li>There are vertices without weights.<br />
<p>''Solution'': apply weights to vertices that do not have them. If those verts are not to be animated, weight them to a bone that does not move.</p><br />
</li><br />
<li>You are using Blender 2.61 and you have bones that have animated positions.<br />
<p>''Solution'': Use an earlier version of blender until this is fixed in the exporter.</p><br />
</li><br />
<li>You are using Blender 2.62 and you have bones that are not located at the origin and do not have a parent or have animated positions.<br />
<p>''Solution'': Again, use an earlier version of blender until this is fixed in the exporter.</p><br />
</li><br />
</ul><br />
<br />
==="R_LoadMD5: vertex %i requires more than %i weights on surface (%i) in model '%s'"===<br />
<br />
This error is displayed in the console in game when a vertex belongs to too many groups.<br />
<br />
You can use this script to check your model for this before exporting:<br />
<br />
<pre><br />
# Copyright 2012 Nicholas De Cicco. <velociostrich@gmail.com><br />
#<br />
# Licensed under the Apache License, Version 2.0 (the "License");<br />
# you may not use this file except in compliance with the License.<br />
# You may obtain a copy of the License at<br />
#<br />
# http://www.apache.org/licenses/LICENSE-2.0<br />
#<br />
# Unless required by applicable law or agreed to in writing, software<br />
# distributed under the License is distributed on an "AS IS" BASIS,<br />
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />
# See the License for the specific language governing permissions and<br />
# limitations under the License.<br />
<br />
import bpy, math<br />
from bpy.props import *<br />
<br />
MAX_GROUPS_PER_VERT = 4<br />
<br />
# Switch to object mode for vertex selection to work<br />
bpy.ops.object.mode_set(mode='OBJECT')<br />
<br />
for obj in bpy.context.selected_objects:<br />
# Check to see that the object is a mesh.<br />
if obj.type != 'MESH':<br />
continue<br />
<br />
# Select verts that belong to too many groups<br />
for vertex in obj.data.vertices:<br />
if len(vertex.groups) > MAX_GROUPS_PER_VERT:<br />
vertex.select = True<br />
else:<br />
vertex.select = False<br />
<br />
# Switch back to edit mode so the user can see any selected verts<br />
bpy.ops.object.mode_set(mode='EDIT')<br />
</pre><br />
<br />
====Using the Script====<br />
<br />
# Select the mesh (or meshes) that you would like to check.<br />
# Create a new text editor window and text data block.<br />
# Copy and paste the script into the text editor.<br />
# Click "Run Script".<br />
<br />
Once the script has ran, the 3d view will switch to edit mode and any offending vertices will be selected. A handy tip: clicking an individual vertex will reveal which groups it is a member of in the properties shelf.<br />
<br />
[[Image:Properties_shelf_vertex_groups.png|frame|center|The vertex group section of the properties shelf]]<br />
<br />
==Resources==<br />
<br />
* [http://www.modwiki.net/wiki/MD5_%28file_format%29 MD5 file format documentation]<br />
* [http://www.katsbits.com/tools/# Tools for MD5 and other file formats]<br />
* [http://download.blender.org/release/ Older versions of Blender]</div>Gavlig