File: olh_quakemd3.htm

package info (click to toggle)
mm3d 1.3.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,268 kB
  • sloc: cpp: 97,649; sh: 4,043; perl: 2,464; makefile: 1,307; ansic: 380; xml: 76
file content (589 lines) | stat: -rw-r--r-- 20,740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<h2>Contents</h2>
<ul>
  <li><a href="#modeltypes">Model Types</a> </li>
  <ul>
     <li> <a href="#playermodels">Player Models</a></li>
     <li> <a href="#weaponmodels">Weapon Models</a> </li>
     <li> <a href="#handmodels">Hand Models</a> </li>
  </ul>
  <li> <a href="#tags">Tags</a> </li>
  <li> <a href="#animations">Animations</a> </li>
  <li><a href="#paths">Paths</a> </li>
  <li> <a href="#textures">Skins And Textures</a> </li>
  <ul>
    <li> <a href="#shaders">Shaders</a> </li>
  </ul>
  <li><a href="#md3limits">MD3 Limits</a> </li>
  <li><a href="#quake3limits">Quake3 Limits</a> </li>
</ul>
<h2><a name="modeltypes"></a>Model Types</h2>

<p>
An MD3 model contains a set of meshes and tags. Some in-game Quake models
are actually composites of several MD3 files. For example, a player
model consists of head.md3, upper.md3, and lower.md3 files. Tags within
these files tell Quake how to assemble the model files into one single
model.
</p>

<p>
Maverick Model 3D is capable of loading and saving a single MD3 file, or loading 
and saving all files in a player model as one model.
</p>

<p>
If you attempt to load
a file named head.md3, upper.md3, or lower.md3 and the other two files are
present, MM3D will ask you if you want to load all sections as a player model.
Answer <b>Yes</b> to load all three files as one model. Answer <b>No</b> to
load only the specified model file.
</p>

<p>
When you save a model, MM3D will ask to save as a player model if the following conditions
are met. If any of the following conditions are not met, the model will be saved
as a single MD3 file.
</p>

<ul>
<li>The saving file name is head.md3, upper.md3, or lower.md3</li>
<li>The model contains at least two points; named <b>tag_torso</b> and
   <b>tag_head</b>.</li>
<li>The model contains at least one group beginning with h_ (for head meshes),
u_ (for upper body meshes), and l_ (for lower body meshes).</li>
<li>The MD3_composite <a href="olh_metawin.html">metadata</a> value is not set to <b>0</b> (zero)</li>
</ul>

<p>
Skin files are read automatically for player and non-player models. Skin files
are never created or modified by MM3D. If you wish to change or create
a skin file you must do this step manually.
</p>

<h3><a name="playermodels">Player Models</a></h3>
<p>
A typical MD3 player model might be 60 GL units tall and 30 wide.
The base of the feet should be at -24.</p>
<p>Player models consist of three model
files: head.md3, upper.md3, and lower.md3. Usually these correspond to
head, torso, and legs respectively. These three models are connected with <a
 href="#tags">tags</a> (Points in MM3D). The weapon and Team Arena CTF flag
the player is holding are also connected to the player model with a tag.</p>
<p>
Typical tags for player models:<br>
<table border="1">
  <tbody>
    <tr>
      <th><b>Model File</b></th>
      <th><b>Tags in model</b></th>
    </tr>
    <tr>
      <td>head.md3</td>
      <td>tag_head</td>
    </tr>
    <tr>
      <td>upper.md3</td>
      <td>tag_head, tag_torso, tag_weapon, (Team Arena) tag_flag</td>
    </tr>
    <tr>
      <td>lower.md3</td>
      <td>tag_torso</td>
    </tr>
  </tbody>
</table>
</p>
<p>
Other unknown tags will be saved in all model files which can be used by Quake 3 mods.
</p>
<p>You can have multiple skins for a player model. Each md3 file should
have a corresponding skin file (head_default.skin, lower_default.skin,
upper_default.skin). Usually there are at least three skins for a
player model: _default.skin, _red.skin, and _blue.skin. For more on
skins see <a href="#textures">Skins and Textures</a>.
</p>

<p>Player models need an animation.cfg file to specify which frames
correspond to in-game actions. An animation.cfg file might look like 
the <a href="#animation_cfg_example">example below</a>.
All animation sequences should have at least one frame.
</p>

<p>
Head models do not have animations in Quake 3. The head is attached to
the <b>tag_head</b> tag in the upper body model. If you want to animate
the head, you can hide the <b>tag_head</b> inside the model
and do all the head animations in the torso (upper) meshes. You should
still make a head model because it is displayed on the HUD.</p>

<p>It's possible to add support for head animations by modifying the
Quake 3 code. MM3D supports <b>ALL_</b> animation prefix for head/upper/lower animations and
<b>HEAD_</b> animation prefix for head-only animations.</p>

<p>
The animation name affects which sections of the player the animation is exported to.<br>
<table border="1">
  <tbody>
    <tr>
      <th><b>Animation Prefix</b></th>
      <th><b>Models</b></th>
    </tr>
    <tr>
      <td>ALL_</td>
      <td>upper.md3, lower.md3, head.md3</td>
    </tr>
    <tr>
      <td>BOTH_</td>
      <td>upper.md3, lower.md3</td>
    </tr>
    <tr>
      <td>TORSO_</td>
      <td>upper.md3</td>
    </tr>
    <tr>
      <td>LEGS_</td>
      <td>lower.md3</td>
    </tr>
    <tr>
      <td>HEAD_</td>
      <td>head.md3</td>
    </tr>
  </tbody>
</table>
</p>

<p>
Quake 3 player model animations must be in the same order as listed below.
The optional Quake III: Team Arena animations at the end of the list require <b>tag_flag</b>
tag in the upper model to be used in-game.
It is recommended to set <b>Loop</b> for each animation as listed below in the <a
 href="olh_animwin.html">Animation Panel</a>. This controls
whether the individual animations are marked as looping in the exported animation.cfg.<br>
<table border="1">
  <tbody>
    <tr>
      <th><b>Animation</b></th>
      <th><b>Loop</b></th>
      <th><b>Description</b></th>
    </tr>
    <tr>
      <td>BOTH_DEATH1</td>
      <td>no</td>
      <td>Random death 1, for example twirl death.</td>
    </tr>
    <tr>
      <td>BOTH_DEAD1</td>
      <td>no</td>
      <td>Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH1.</td>
    </tr>
    <tr>
      <td>BOTH_DEATH2</td>
      <td>no</td>
      <td>Random death 2, for example other side twirl death.</td>
    </tr>
    <tr>
      <td>BOTH_DEAD2</td>
      <td>no</td>
      <td>Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH2.</td>
    </tr>
    <tr>
      <td>BOTH_DEATH3</td>
      <td>no</td>
      <td>Random death 3, for example backflip death.</td>
    </tr>
    <tr>
      <td>BOTH_DEAD3</td>
      <td>no</td>
      <td>Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH3.</td>
    </tr>
    <tr>
      <td>TORSO_GESTURE</td>
      <td>no</td>
      <td>Taunt.</td>
    </tr>
    <tr>
      <td>TORSO_ATTACK</td>
      <td>no</td>
      <td>Firing gun. This is synced with first person <a href="#handmodels">hand model</a> and must have 6 frames.</td>
    </tr>
    <tr>
      <td>TORSO_ATTACK2</td>
      <td>no</td>
      <td>Guntlet punch. This is synced with first person hand model and must have 6 frames.</td>
    </tr>
    <tr>
      <td>TORSO_DROP</td>
      <td>no</td>
      <td>Drop weapon. This is synced with first person hand model and must have 5 frames.</td>
    </tr>
    <tr>
      <td>TORSO_RAISE</td>
      <td>no</td>
      <td>Raise weapon. This is synced with first person hand model and must have 4 frames.</td>
    </tr>
    <tr>
      <td>TORSO_STAND</td>
      <td>no</td>
      <td>Holding gun.</td>
    </tr>
    <tr>
      <td>TORSO_STAND2</td>
      <td>no</td>
      <td>Holding gauntlet.</td>
    </tr>
    <tr>
      <td>LEGS_WALKCR</td>
      <td>yes</td>
      <td>Walking while crouching. It is played in reverse when walking backward.</td>
    </tr>
    <tr>
      <td>LEGS_WALK</td>
      <td>yes</td>
      <td>Walking forward. It is played in reverse when walking backward.</td>
    </tr>
    <tr>
      <td>LEGS_RUN</td>
      <td>yes</td>
      <td>Running forward.</td>
    </tr>
    <tr>
      <td>LEGS_BACK</td>
      <td>yes</td>
      <td>Running backward.</td>
    </tr>
    <tr>
      <td>LEGS_SWIM</td>
      <td>yes</td>
      <td>Swimming.</td>
    </tr>
    <tr>
      <td>LEGS_JUMP</td>
      <td>no</td>
      <td>Jump forward (jump off the ground).</td>
    </tr>
    <tr>
      <td>LEGS_LAND</td>
      <td>no</td>
      <td>Jump forward (land).</td>
    </tr>
    <tr>
      <td>LEGS_JUMPB</td>
      <td>no</td>
      <td>Jump backward (jump off the ground).</td>
    </tr>
    <tr>
      <td>LEGS_LANDB</td>
      <td>no</td>
      <td>Jump backward (land).</td>
    </tr>
    <tr>
      <td>LEGS_IDLE</td>
      <td>yes</td>
      <td>Idle standing.</td>
    </tr>
    <tr>
      <td>LEGS_IDLECR</td>
      <td>yes</td>
      <td>Idle crouching.</td>
    </tr>
    <tr>
      <td>LEGS_TURN</td>
      <td>yes</td>
      <td>Standing still and turning left or right.</td>
    </tr>
    <tr>
      <td>TORSO_GETFLAG</td>
      <td>no</td>
      <td>Team Arena; give order to get flag.</td>
    </tr>
    <tr>
      <td>TORSO_GUARDBASE</td>
      <td>no</td>
      <td>Team Arena; give order to guard base.</td>
    </tr>
    <tr>
      <td>TORSO_PATROL</td>
      <td>no</td>
      <td>Team Arena; give order to patrol.</td>
    </tr>
    <tr>
      <td>TORSO_FOLLOWME</td>
      <td>no</td>
      <td>Team Arena; give order to follow me.</td>
    </tr>
    <tr>
      <td>TORSO_AFFIRMATIVE</td>
      <td>no</td>
      <td>Team Arena; confirm order.</td>
    </tr>
    <tr>
      <td>TORSO_NEGATIVE</td>
      <td>no</td>
      <td>Team Arena; reject order.</td>
    </tr>
  </tbody>
</table>
</p>

<h4><a name="animation_cfg_example">Example animation.cfg</a></h4>
<pre>//Quake3 player animation file

sex m
footsteps normal

// first frame, num frames, looping frames, frames per second

0       32      0       25              // BOTH_DEATH1
32      1       0       25              // BOTH_DEAD1
32      35      0       20              // BOTH_DEATH2
67      1       0       20              // BOTH_DEAD2
68      25      0       25              // BOTH_DEATH3
93      1       0       25              // BOTH_DEAD3

94      39      0       15              // TORSO_GESTURE
133     7       0       15              // TORSO_ATTACK  (MUST NOT CHANGE -- hand animation is synced to this)
140     11      0       15              // TORSO_ATTACK2 (MUST NOT CHANGE -- hand animation is synced to this)
151     5       0       15              // TORSO_DROP    (MUST NOT CHANGE -- hand animation is synced to this)
156     6       0       15              // TORSO_RAISE   (MUST NOT CHANGE -- hand animation is synced to this)
162     31      0       10              // TORSO_STAND
193     11      0       10              // TORSO_STAND2

94      12      12      15              // LEGS_WALKCR
107     12      12      15              // LEGS_WALK
120     12      12      17              // LEGS_RUN
133     14      12      17              // LEGS_BACK
148     12      12      14              // LEGS_SWIM
159     6       0       8               // LEGS_JUMP
167     6       0       12              // LEGS_LAND
172     6       0       10              // LEGS_JUMPB
178     6       0       10              // LEGS_LANDB
185     6       6       5               // LEGS_IDLE
192     7       7       5               // LEGS_IDLECR
200     6       6       20              // LEGS_TURN
</pre>

<h4><a name="playermetadata">Player Metadata</a></h4>
<p>
Set MD3_CFG_* <a href="olh_metawin.html">metadata</a> to insert a keyword into the animation.cfg. For example, set <b>MD3_CFG_sex</b> meta data to value <b>f</b> to specify that the player model is female. Keywords and values are automatically detected when loading a player model. Any arbitraty keywords can be used. Keywords should not start with an animation prefix (ALL_, BOTH_, TORSO_, LEGS_, or HEAD_) as it may be detected as an animation when loaded by MM3D. Quake 3 only supports sex, footsteps, headoffset, fixedtorso, and fixedlegs.
Example:<br />
<pre>
sex f // m, f, or n
footsteps normal // footstep sfx: normal, boot, flesh, mech, or energy
headoffset 0 0 0 // head offset when displayed on HUD
fixedtorso // don't rotate torso pitch when looking up or down
fixedlegs // don't rotate legs (always align with torso)
</pre>
</p>
<p>
Set the <b>MD3_AnimKeyword</b> metadata value to <b>1</b> to list animation names at the beginning of line in animation.cfg. This is automatically detected when loading a player model. It is not supported by Quake 3. It is used by Elite Force Single Player and Turtle Arena.
Example:<br />
<pre>
BOTH_DEATH1 0       32      0       25
BOTH_DEAD1  32      1       0       25
</pre>
</p>
<p>
Set the <b>MD3_NoSyncWarning</b> metadata value to <b>1</b> to disabling writing sync warnings in animation.cfg for TORSO_ATTACK, TORSO_ATTACK2, TORSO_DROP, and TORSO_RAISE. It is used by Turtle Arena which does not feature first person <a href="#handmodels">hand models</a>.
</p>
<p>
Set the <b>MD3_EliteLoop</b> metadata value to <b>1</b> to use Elite Force Single Player style looping values in animation.cfg. -1 for not looping and 0 for looping instead of Quake 3 style 0 for not looping and number of frames for looping. It is not supported by Quake 3. This is automatically detected when loading a player model if a looping value is -1.
</p>


<h3><a name="weaponmodels">Weapon Models</a></h3>
<p>
A typical MD3 weapon might be 5 GL units wide
and 45 long. They usually would have no animations, although it should
be possible to add animation by modifying the Quake 3 code. You can
also add texture animations with shaders. Weapons are attached to the
<b>tag_weapon</b> <a href="#tags">tag</a> in the player model's upper
model or first person hand model. Weapons typically have tag named
<b>tag_weapon</b> at the model origin (0,0,0), however it is not used by
the Quake 3 code. Some weapons have a tag named <b>tag_flash</b> where
Quake 3 attaches the muzzle flash model (typically (weapon)_flash.md3 in
the same directory). Some weapons have a tag named <b>tag_barrel</b>
where Quake 3 attaches the barrel model (typically (weapon)_barrel.md3
in the same directory).
</p>

<h3><a name="handmodels">Hand Models</a></h3>
<p>
A hand model is used for positioning the first person weapon model.
The model consists of only an animated <b>tag_weapon</b> <a href="#tags">tag</a>
and is not rendered by Quake 3.
</p>

<h2><a name="tags">Tags</a></h2>

<p>
Quake 3 uses tags to join models to each other. MM3D
loads tags as points, so if you want to create a tag make a Point
(<a href="olh_pointdetails.html">more details about points</a>). The
point name should be whatever you want the name of the tag to be. The
red axis of the tag is forward, the blue axis of the tag is up, and the
green axis of the tag is left. For example you want the red side of
that tag to face front for tag_weapon.
</p>

<p>
The MD3 orientation for tags is not the default orientation for MM3D points,
so you must rotate any points you create into the correct orientation.
</p>

<h2><a name="animations">Animations</a></h2>
<p>
MD3 animations specify vertex positions for each
vertex for each frame of each animation. This can be tedious. When
creating a model from scratch it is usually
easier to save the model in MM3D format and create skeletal animations.
Then
when you are ready to export to MD3, convert the skeletal animations to
frame
animations using the <a href="olh_animsetwin.html">Animation Sets
Window</a>
and save as an MD3.
</p>
<p>
Because of the enormous overhead of saving undo information for
animations upon
insertion and deletion of vertex and face primitives, you are not
allowed to
add or remove primitives from a model that has frame animations. You
may,
however, merge another existing model into the one you are working on.
This is another reason why it is best to work with MM3D files and
skeletal
animations and only export MD3 files when necessary.
</p>
<p>
MM3D will save all frame (vertex, mesh deformation) animations when 
saving as MD3.
</p>

<h2><a name="paths">Paths</a></h2>
<p>
When an MD3 model is saved, path information is stored
in the model. Quake3 uses a VFS (virtual file system), and you must tell
Quake3 where your files are located in this VFS. For
example a player model might be located in the Quake3 VFS at
models/players/man/. So all the models and textures should probably be
located in there and when you make a pk3 file (zip file really), it
should contain that directory hierarchy.</p>
<p>
We still need MM3D to save paths and filenames with
models/players/man/. This is where the MD3_PATH <a
 href="olh_metawin.html">metadata</a> attribute comes in. You should
set the MD3_PATH metadata attribute to models/players/man/. MD3 Filter
will append all filenames that gets stored in the MD3 file to
MD3_PATH. So your body.tga texture when saved would be written in the
MD3 file as models/players/man/body.tga. When quake3 opens it that is
where it will look in the VFS.</p>
<p>
Note: The Quake 3 VFS does not start with a /.
</p>

<h2><a name="textures">Skins and Textures</a></h2>
<p>
The MD3 filter can load any image type as a texture if
MM3D can use it. When looking for a texture file it ignores the
extension and finds any loadable texture with the the right file name
(regardless of extension). For example if the model says it should use a file
called body.tga, MD3 Filter could use body.png if it exists.</p>
<p></p>
<p>MD3 filter looks for texture images and skin
files in the same directory as the model regardless of the values for
paths contained in the model.</p>
<p></p>
<p>In general the MD3 filter attempts to load skins
in the following manner:
</p>
<ul>
  <li> First it will look for .skin files with the
following pattern. {modelName}_*.skin It will load all images inside
those skin files. It will set the material to the image contained in
{modelName}_default.skin. </li>
  <li> If no .skins files are there it will use shaderName specified in
the model to look for a texture file. </li>
  <li> If that does not exist it will look for a valid texture whose
filename matches {meshName}.* </li>
</ul>
<p></p>
<p>
When saving MD3 models it sets the shader name to the name of the texture that
is assigned to the group. Also note that Quake3 by default only loads
TGA and JPG files.</p>
<p>
A skin file should be of the form indicated below.
</p>
<p>
mesh_name,MD3_PATH/textureFilename
</p>
<p>
and example upper_default.skin:
</p>
<p>u_body,models/players/man/default_b.tga<br/>
u_cape,models/players/man/default_c.tga
</p>

<h3><a name="shaders"></a>Shaders</h3>
<p>
Currently MD3 filter will not load Quake3 .shader files.
These are files that could do complex OpenGL operations.
You can still use shader files with your model inside Quake3 by
creating the shader manually. Here is a example:
</p>
<p>Create a shader file in the scripts directory (at the top of the VFS next to models directory) called player-(your model).shader containing:</p>
<pre>// comment: Use MD3_PATH/textureFilename without extension.
models/players/man/default_b
{
	{
		map models/players/man/default_b.tga // with extension
		rgbGen wave sin 0.5 0.5 0 1.5 // make color be a sine wave
	}
}

models/players/man/default_c
{
	{
		map models/players/man/default_c.tga
		rgbGen identityLighting // full bright
	}
}</pre>
<p>Quake3 should see the shader and use it instead of just the texture.</p>

<h2><a name="md3limits"></a>MD3 Limits</h2>
<p>
The MD3 file format has several limits that you should consider when
making a model for this format. These are outlined below. If your model
has more that the MD3 limit, the file will not be saved correctly and
you should get a error message.
</p>
<ul>
  <li>Only faces and verticies in a group get saved.</li>
  <li>The MD3_PATH+file name cannot be longer than <span
 style="font-weight: bold;">63</span> characters.&nbsp; (Textures and
model names)<br>
  </li>
  <li>The group name and point name cannot be longer than <span
 style="font-weight: bold;">63</span> characters.</li>
</ul>

<h2><a name="quake3limits"></a>Quake3 Limits</h2>
<p>
Quake3 only supports a limit amount of geometry. These are outlined below.
Other games may have different limits. You should get a error message in
the Quake3 console if your model has more geometry than the Quake3 limit.
</p>
<ul>
  <li>Maximum of <span style="font-weight: bold;">1999</span>
Triangles per Group</li>
  <li>Maximum of <span style="font-weight: bold;">999</span>
Verticies per Group</li>
</ul>
<p>Vertexes in MM3D are shared between materials and texture coordinates.
Exporting to MD3 may have a greater number of vertexes. You cannot solely
go off of the vertex count displayed in the editor.</p>
<p>.skin files in Quake3 have a limited number of groups. More than that
will cause Quake3 to write memory out of bounds and may cause issues.</p>
<ul>
  <li>Maximum of <span style="font-weight: bold;">32</span> Groups</li>
</ul>