File: models.html

package info (click to toggle)
sauerbraten-data 0.0.20100728+repack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 525,044 kB
  • sloc: sh: 21; makefile: 2
file content (883 lines) | stat: -rw-r--r-- 32,637 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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Cube 2: Sauerbraten - Model Reference</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>

<body>

<h1>Cube 2: Sauerbraten - Model Reference</h1>

<div class="contents">
<ul class="contents">
<li>
<a href="#md2_format"><b>MD2 Format</b></a>
<ul class="contents2">
<li>
<a href="#md2anim"><tt>md2anim</tt></a>
</li>
</ul>
</li>
<li>
<a href="#md3_format"><b>MD3 Format</b></a>
<ul class="contents2">
<li>
<a href="#without_configuration">Without Configuration</a>
</li>
<li>
<a href="#with_configuration">With Configuration</a>
<ul class="contents3">
<li>
<a href="#md3load"><tt>md3load</tt></a>
</li>
<li>
<a href="#md3pitch"><tt>md3pitch</tt></a>
</li>
<li>
<a href="#md3skin"><tt>md3skin</tt></a>
</li>
<li>
<a href="#md3bumpmap"><tt>md3bumpmap</tt></a>
</li>
<li>
<a href="#md3spec"><tt>md3spec</tt></a>
</li>
<li>
<a href="#md3alphatest"><tt>md3alphatest</tt></a>
</li>
<li>
<a href="#md3alphablend"><tt>md3alphablend</tt></a>
</li>
<li>
<a href="#md3shader"><tt>md3shader</tt></a>
</li>
<li>
<a href="#md3ambient"><tt>md3ambient</tt></a>
</li>
<li>
<a href="#md3envmap"><tt>md3envmap</tt></a>
</li>
<li>
<a href="#md3glow"><tt>md3glow</tt></a>
</li>
<li>
<a href="#md3glare"><tt>md3glow</tt></a>
</li>
<li>
<a href="#md3fullbright"><tt>md3fullbright</tt></a>
</li>
<li>
<a href="#md3anim"><tt>md3anim</tt></a>
</li>
<li>
<a href="#md3link"><tt>md3link</tt></a>
</li>
</ul>
</li>
<li>
<a href="#sample_configuration">Sample Configuration</a>
</li>
</ul>
</li>

<li>
<a href="#obj_format"><b>OBJ Format</b></a>
</li>

<li>
<a href="#md5_format"><b>MD5 Format</b></a>
<ul class="contents2">
<li>
<a href="#md5load"><tt>md5load</tt></a>
</li>
<li>
<a href="#md5pitch"><tt>md5pitch</tt></a>
</li>
<li>
<a href="#md5skin"><tt>md5skin</tt></a>
</li>
<li>
<a href="#md5bumpmap"><tt>md5bumpmap</tt></a>
</li>
<li>
<a href="#md5spec"><tt>md5spec</tt></a>
</li>
<li>
<a href="#md5alphatest"><tt>md5alphatest</tt></a>
</li>
<li>
<a href="#md5alphablend"><tt>md5alphablend</tt></a>
</li>
<li>
<a href="#md5shader"><tt>md5shader</tt></a>
</li>
<li>
<a href="#md5ambient"><tt>md5ambient</tt></a>
</li>
<li>
<a href="#md5envmap"><tt>md5envmap</tt></a>
</li>
<li>
<a href="#md5glow"><tt>md5glow</tt></a>
</li>
<li>
<a href="#md5glare"><tt>md5glare</tt></a>
</li>
<li>
<a href="#md5fullbright"><tt>md5fullbright</tt></a>
</li>
<li>
<a href="#md5anim"><tt>md5anim</tt></a>
</li>
<li>
<a href="#md5animpart"><tt>md5animpart</tt></a>
</li>
<li>
<a href="#md5tag"><tt>md5tag</tt></a>
</li>
<li>
<a href="#md5link"><tt>md5link</tt></a>
</li>
<li>
<a href="#md5adjust"><tt>md5adjust</tt></a>
</li>
</ul>
</li>

<li>
<a href="#smd_format"><b>SMD Format</b></a>
</li>

<li>
<a href="#iqm_format"><b>IQM Format</b></a>
</li>

<li>
<a href="#common_commands"><b>Common Commands</b></a>
<ul class="contents2">
<li>
<a href="#mdlcollide"><tt>mdlcollide</tt></a>
</li>
<li>
<a href="#mdlellipsecollide"><tt>mdlellipsecollide</tt></a>
</li>
<li>
<a href="#mdlbb"><tt>mdlbb</tt></a>
</li>
<li>
<a href="#mdlcullface"><tt>mdlcullface</tt></a>
</li>
<li>
<a href="#mdlspec"><tt>mdlspec</tt></a>
</li>
<li>
<a href="#mdlalphatest"><tt>mdlalphatest</tt></a>
</li>
<li>
<a href="#mdlalphablend"><tt>mdlalphablend</tt></a>
</li>
<li>
<a href="#mdlglow"><tt>mdlglow</tt></a>
</li>
<li>
<a href="#mdlglare"><tt>mdlglare</tt></a>
</li>
<li>
<a href="#mdlshader"><tt>mdlshader</tt></a>
</li>
<li>
<a href="#mdlambient"><tt>mdlambient</tt></a>
</li>
<li>
<a href="#mdlscale"><tt>mdlscale</tt></a>
</li>
<li>
<a href="#mdltrans"><tt>mdltrans</tt></a>
</li>
<li>
<a href="#mdlyaw"><tt>mdlyaw</tt></a>
</li>
<li>
<a href="#mdlpitch"><tt>mdlpitch</tt></a>
</li>
<li>
<a href="#mdlspin"><tt>mdlspin</tt></a>
</li>
<li>
<a href="#mdlenvmap"><tt>mdlenvmap</tt></a>
</li>
<li>
<a href="#mdlfullbright"><tt>mdlfullbright</tt></a>
</li>
<li>
<a href="#mdlshadow"><tt>mdlshadow</tt></a>
</li>
</ul>
</li>

</ul>
</div>

<h2 id="md2_format">MD2 Format</h2>

<p>
MD2 files must be located in a directory in <i>packages/models/</i>, you must provide a skin
(either <i>skin.jpg</i> or <i>skin.png</i>) and the md2 itself (<i>tris.md2</i>).
Optionally you may provide a <i>masks.jpg</i> that holds a specmap in the R channel, a glowmap
in the G channel, and a chrome map in the B channel. The engine will apply it automatically.
</p>

<p>
If either of these files is not found, the engine will search the parent directory for them.
For example, if for the <i>flags/red</i> model, the tris.md2 is not found in
<i>packages/models/flags/red/</i>, then it will look for tris.md2 in <i>packages/models/flags/</i>.
This allows the sharing of skins and geometry.
</p>

<p>
It is expected that md2 format files use Quake-compatible scale and animations, unless you configure the model otherwise.
</p>

<p>
You may also supply a config file (<i>md2.cfg</i>) in your model directory, which allows you to
customize the model's animations. The following commands may be used in an <i>md2.cfg</i>:
</p>

<pre id="md2anim">md2anim N F M [S [P]]</pre>
<p>
N is the name of the animation to define. Any of the following names may be used:
</p>
<ul>
	<li>dying</li>
	<li>dead</li>
	<li>pain</li>
	<li>idle</li>
	<li>forward</li>
	<li>backward</li>
	<li>left</li>
	<li>right</li>
    <li>hold 1 ... hold 7</li>
    <li>attack 1 ... attack 7</li>
	<li>jump</li>
    <li>sink</li>
	<li>swim</li>
	<li>edit</li>
	<li>lag</li>
    <li>taunt</li>
    <li>win</li>
    <li>lose</li>
	<li>gun shoot</li>
	<li>gun idle</li>
    <li>vwep shoot</li>
    <li>vwep idle</li>
	<li>mapmodel</li>
	<li>trigger</li>
</ul>

<p>
F is the frame number the animation starts at. M is the number of frames in the
animation. S is the optional frames per second at which to run the anim. If none is specified,
10 FPS is the default. P specifies an optional priority for the animation (defaults to P=0).
</p>

<p>
For example, defining a "pain" animation starting at frame 50 with 6 frames and running at 30 frames per
second would look like: <i>md2anim "pain" 50 6 30</i>
</p>


<h2 id="md3_format">MD3 Format</h2>
<p>
MD3 file can be used in one of two ways.
</p>

<h3 id="without_configuration">Without Configuration</h3>

<p>
Go this way if your md3 has no animations (static) and takes only one texture, they must be
located in a directory in <i>packages/models/</i>, and provide a skin (either <i>skin.jpg</i>
or <i>skin.png</i>) and the md3 itself (<i>tris.md3</i>). Optionally you may provide a
<i>masks.jpg</i> that holds a specmap in the R channel, a glowmap in the G channel, and a
chrome map in the B channel. The engine will apply it automatically.
</p>

<p>
If either of these files is not found, the engine will search the parent directory for them.
For example, if for the <i>flags/red model</i>, the <i>tris.md3</i> is not found in
<i>packages/models/flags/red/</i>, then it will look for <i>tris.md3</i> in
<i>packages/models/flags/</i>. This allows the sharing of skins and geometry.
</p>

<h3 id="with_configuration">With Configuration</h3>

<p>
MD3 files with animations multiple skins, or if you want to make use of other configuration
possibilities, need to be set up this way. You must place a <i>md3.cfg</i> in a directory in
<i>packages/models/</i>. This file specifies which models should be loaded, linked, etc. The
following commands may be used in the <i>md3.cfg</i>:
</p>

<pre id="md3load">md3load P</pre>
<p>
This command loads the first part of your model. As an example, this could be the <i>head.md3</i>
of a playermodel. P is the path to the md3 file to load, its relative to the location of the
<i>md3.cfg</i>.
</p>

<pre id="md3pitch">md3pitch S O M N</pre>
<p>
This command controls how a model responds to the model's pitch. The pitch (in degrees) is scaled
by S, offset by O, and then clamped to the range M..N, i.e. clamp(pitch*S + O, M, N). By default, 
all model parts have S=1, O=0, M=-360, and N=360, such that the model part will pitch one-to-one.
</p>

<pre id="md3skin">md3skin H S M [E [F]]</pre>
<p>
This loads a texture and assigns it to a mesh of the last loaded model (md3load). H is the name
of the mesh you want to assign the texture to. S is the path to the texture, its recursive
to the location of the <i>md3.cfg</i>. The optional M sets a texture for spec (red channel)/glow
(green channel) maps as above. If E is non-zero, then the blue channel of the masks is
interpreted as a chrome map. E (maximum envmap intensity) and F (minimum envmap intensity, default: 0) are floating point 
values in the range of 0 to 1, and specify the range in which the envmapping intensity will vary based on a viewing angle
(a Fresnel term that is maximal at glancing angles, minimal when viewed dead-on). The intensity, 
after scaled into this range, is then multiplied by the chrome map.
</p>

<pre id="md3bumpmap">md3bumpmap H N [S]</pre>
<p>
This command enables bumpmapping for a given mesh in the last loaded model (md3load). H is the name
of the mesh you want to assign bumpmapping textures to. S is the path to a diffuse skin texture which is (if specified)
used instead of the skin supplied with the "md3skin" command only if the user's 3D card supports bumpmapping, 
otherwise the skin supplied with "md3skin" takes precedence and no bumpmapping is done. These
two diffuse skins may be the same. However a diffuse skin intended for bumpmapping should generally have
little to no directional shading baked into it, whereas flat diffuse skins (no bumpmapping) generally should,
and this command allows you to provide a separate skin for the bumpmapping case. N is a normal map texture which is 
used to shade the supplied diffuse skin texture.
</p>

<pre id="md3spec">md3spec MESH S</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S is the specular intensity (not given or 0 gives the default of 100, good for metal/plastics and anything shiny, use lower values like 50 for wood etc, -1 means off entirely).</p>

<pre id="md3alphatest">md3alphatest MESH T</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Controls the cut-off threshold, T, at which alpha-channel skins will discard pixels where alpha is less than T.
T is a floating point value in the range of 0 to 1 (Default: 0.9). 
</p>

<pre id="md3alphablend">md3alphablend MESH B</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Controls whether a model with an alpha-channel skin will alpha blend (Default: 1). 
</p>

<pre id="md3shader">md3shader MESH S</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S is the name of the shader to use for rendering the model (Default: "stdmodel"). 
</p>

<pre id="md3glow">md3glow MESH G</pre>
<p>
MESH specifies the name of the mesh this setting applies to. G is the glowmap scale (not given or 0 gives the default of 300, -1 means off entirely), such that
the glow is G percent of the diffuse skin color.
</p>

<pre id="md3glare">md3glare MESH S G</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S and G are floating point values that scale the amount of glare generated by specular light and glare, respectively (Default: 1 1).
</p>

<pre id="md3envmap">md3envmap MESH P</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Sets the environment map used for the model, where P is a pathname in the same syntax as the
"loadsky" command. If this is not specified, the mesh will use the closest "envmap" entity,
or skybox, if none is available (unless overridden by "mdlenvmap").
</p>

<pre id="md3ambient">md3ambient MESH A</pre>
<p>
MESH specifies the name of the mesh this setting applies to.  A is the percent of the ambient light that should be used for shading. Not given or 0 gives the
default of 30%, -1 means no ambient.
</p>

<pre id="md3fullbright">md3fullbright MESH N</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Uses a constant lighting level of N instead of the normal lighting. N is a floating-point value on a scale of 0 to 1.
</p>

<pre id="md3anim">md3anim A F N [S [P]]</pre>
<p>
This assigns a new animation to the last loaded model (md3load). A is the name of the animation
to define. Any of the following names may be used:
</p>
<ul>
	<li>dying</li>
	<li>dead</li>
	<li>pain</li>
	<li>idle</li>
	<li>forward</li>
	<li>backward</li>
	<li>left</li>
	<li>right</li>
    <li>hold 1 ... hold 7</li>
    <li>attack 1 ... attack 7</li>
	<li>jump</li>
    <li>sink</li>
	<li>swim</li>
	<li>edit</li>
	<li>lag</li>
    <li>taunt</li>
    <li>win</li>
    <li>lose</li>
	<li>gun shoot</li>
	<li>gun idle</li>
    <li>vwep shoot</li>
    <li>vwep idle</li>
	<li>mapmodel</li>
	<li>trigger</li>
</ul>

<p>
F is the frame number the animation starts at. N is the number of frames in the animation.
S is frames per second at which to run the anim. If none is specified or S=0, 10 FPS is the default.
P specifies an optional priority for the animation (defaults to P=0).
</p>

<p>
A character model will have up to 2 animations simultaneously playing - a primary animation
and a secondary animation. If a character model defines the primary animation, it will be used,
otherwise the secondary will be used if it is available. Primary animations are:
</p>
<ul>
	<li>dying</li>
	<li>dead</li>
	<li>pain</li>
    <li>hold 1 ... hold 7</li>
    <li>attack 1 ... attack 7</li>
	<li>edit</li>
	<li>lag</li>
    <li>taunt</li>
    <li>win</li>
    <li>lose</li>
</ul>

<p>
Secondary animations are:
</p>
<ul>
	<li>idle</li>
	<li>forward</li>
	<li>backward</li>
	<li>left</li>
	<li>right</li>
	<li>jump</li>
    <li>sink</li>
	<li>swim</li>
</ul>

<p>
This allows, for example, a torso part to "shoot" (a primary animation) while a leg part
simultaneously runs "forward" (a secondary animation). In the event that a secondary animation
other than "idle" is playing and there is no primary animation, then the secondary animation
will behave as if it were primary, and the secondary animation will effectively be "idle".
This allows parts that would not normally participate in a certain animation to do so in the
"idle" case, or otherwise simply be "idle" if this is not desired. However, if you want to override
which animation is primary for a specific part, you can set an explicit priority for that animation,
and the animation with the highest priority is chosen, regardless of which is primary and 
which is secondary. So, for example, you could give an animation a -1 priority so that all animations
with the default 0 priority are chosen first, or you could give an animation a 1 or greater priority
so that it is always chosen before animations with the default 0 priority.
</p>

<p>
For example, to define a "punch" animation starting at frame 131 with 6 frames and running at
15 frames per second: <i>md3anim "punch" 131 6 15</i>
</p>

<pre id="md3link">md3link P C T [X Y Z]</pre>
<p>
This links two models together. Every model you load with md3load has an ID. The first model
you load has the ID 0, the second has the ID 1, and so on, those ID's are now used to identify
the models and link them together. P the ID of the parent model. C to ID of the
child model. T name of the tag that specifies at which vertex the models should be linked. 
X, Y, and Z are optional translation for this link.
</p>

<p>
Hint: <i>Make sure you understand the difference between the parent and child model.
Rendering starts at model 0 (first loaded model) and then continues with model 0's children,
etc. Imagine a tree, model 0 is the root if it.</i>
</p>

<h3 id="sample_configuration">Sample Configuration</h3>
<pre>
md3load lower.md3 // model no. 0
md3skin l_lower ./default_l.png

md3anim dying           0   30  20
md3anim dead            30  1   25
md3anim "forward|backward|left|right|swim" 114 10  18
md3anim idle            164 30  30
md3anim "jump|lag|edit" 147	8	15

md3load upper.md3 // model no. 1
md3skin u_torso ./default.png

md3anim dying           0   30  20
md3anim dead            30  1   25
md3anim "lag|edit"      91  40  18
md3anim "attack *"      131 6   15
md3anim idle            152 1   15
md3anim pain            152 1   15


md3load head.md3 // model no. 2
md3skin h_head ./default_h.png


md3link 0 1 tag_torso
md3link 1 2 tag_head

mdlspec 50
mdlscale 20         // 20 percent of the original size
mdltrans 0 0 -1.5   // lower the model a bit
</pre>

<h2 id="obj_format">OBJ Format</h2>
<p>
The Wavefront OBJ format is configured almost identically to how MD3s are used. The only differences are that OBJ specific commands are prefixed with "obj" instead of "md3" (i.e. "objskin" instead of "md3skin") which are specified in "obj.cfg" instead of "md3.cfg", it looks for "tris.obj" instead of "tris.md3" by default, and there is no support for animation ("objanim") or linking ("objlink"). Group names are used to identify meshes within the model.
</p>

<h2 id="md5_format">MD5 Format</h2>
<p>
MD5 models require a proper configuration to function; make sure your exporter properly exports mesh names in the MD5 file so that these can be referenced in the configuration file (the Blender exporter does not export these, but a fixed  Blender MD5 exporter can be gotten from the Cube wiki).
</p>

<p>
Make sure no more than 4 blend weights are used per vertex, any extra blend weights will be dropped silently. The skeleton should use no more than 256 bones, and less than 70 or so bones should be used if you wish the model to be skeletally animated on the GPU. To optimize animation of the model on both CPU and GPU, keep the number of blend weights per vertex to a minimum. Also, similar combinations of blend weights are cached while animating, especially on the CPU, such that if two or more vertices use the same blend weights, blending calculations only have to be done once for all the vertices - so try and minimize the number of distinct combinations of blend weights if possible. 
</p>

<p>
When animating skeletal models, you should model the animations as a single piece for the entire body (unlike for MD3 which requires splitting the mesh). In the configuration file, you can choose a bone at which to split the model into an upper and lower part (via "md5animpart"), which allows, for example, the upper body movement of one animation to be combined with the lower body movement of another animation automatically. The bone at which you split the animation up should ideally be a root bone, of which the upper body and lower body are separate sub-trees. Rigging the model in this way also allows for pitch animation (which also requires selecting a bone to pitch at) to take place such as bending at the waist, which similarly requires the upper body to be a sub-tree of the bone at which the pitch animation will occur.
</p>

<p>
The included MD5 support allows for two methods of attaching models to another: via tags (by assigning a tag name to a bone with "md5tag"), or by animating multiple models against a common, named skeleton that will be shared among all of them (useful for modeling clothing attachments and similar items). To use a shared skeleton, you simply export all the models with the same skeleton. Animations only need to be specified for the base model. A name for the skeleton is specified via the "md5load" command, for both the model exporting the skeleton and the models using it. When one of the models is attached to the one supplying the skeleton internally, the tag setup is instead ignored and the skeleton/animations of the base model are used to animate the attachment as if it were a sub-mesh of the base model itself.
</p>

<p>
You must place a <i>md5.cfg</i> in a directory in <i>packages/models/</i>.
The following commands may be used in the <i>md5.cfg</i>:
</p>

<pre id="md5load">md5load P [S]</pre>
<p>
This command loads the fa part of your model. As an example, this could be the <i>head.md5mesh</i>
of a playermodel. P is the path to the md5mesh file to load, its relative to the location of the
<i>md5.cfg</i>. S is an optional name that can be assigned to the skeleton specified in the md5mesh
for skeleton sharing, but need not be specified if you do not wish to share the skeleton. This skeleton 
name must be specified for both the model supplying a skeleton and an attached model intending to use the skeleton.
</p>

<pre id="md5pitch">md5pitch B S O M N</pre>
<p>
This command controls how a model responds to the model's pitch. B is the name of the bone which
the pitch animation is applied to, as well as all bones in the sub-tree below it. The pitch (in degrees) 
is scaled by S, offset by O, and then clamped to the range M..N, i.e. clamp(pitch*S + O, M, N). By default,
all model parts have S=1, O=0, M=-360, and N=360, such that the model part will pitch one-to-one.
</p>

<pre id="md5skin">md5skin H S M [E [F]]</pre>
<p>
This loads a texture and assigns it to a mesh of the last loaded model (md5load). H is the name
of the mesh you want to assign the texture to. S is the path to the texture, its recursive
to the location of the <i>md5.cfg</i>. The optional M sets a texture for spec (red channel)/glow
(green channel) maps as above. If E is non-zero, then the blue channel of the masks is
interpreted as a chrome map. E (maximum envmap intensity) and F (minimum envmap intensity, default: 0) are floating point
values in the range of 0 to 1, and specify the range in which the envmapping intensity will vary based on a viewing angle
(a Fresnel term that is maximal at glancing angles, minimal when viewed dead-on). The intensity,
after scaled into this range, is then multiplied by the chrome map.
</p>

<pre id="md5bumpmap">md5bumpmap H N [S]</pre>
<p>
This command enables bumpmapping for a given mesh in the last loaded model (md5load). H is the name
of the mesh you want to assign bumpmapping textures to. S is the path to a diffuse skin texture which is
used (if specified) instead of the skin supplied with the "md5skin" command only if the user's 3D card supports bumpmapping,
otherwise the skin supplied with "md5skin" takes precedence and no bumpmapping is done. These
two diffuse skins may be the same. However a diffuse skin intended for bumpmapping should generally have
little to no directional shading baked into it, whereas flat diffuse skins (no bumpmapping) generally should,
and this command allows you to provide a separate skin for the bumpmapping case. N is a normal map texture which is
used to shade the supplied diffuse skin texture.
</p>

<pre id="md5spec">md5spec MESH S</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S is the specular intensity (not given or 0 gives the default of 100, good for metal/plastics and anything shiny, use lower values like 50 for wood etc, -1 means off entirely).</p>

<pre id="md5alphatest">md5alphatest MESH T</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Controls the cut-off threshold, T, at which alpha-channel skins will discard pixels where alpha is less than T.
T is a floating point value in the range of 0 to 1 (Default: 0.9).
</p>

<pre id="md5alphablend">md5alphablend MESH B</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Controls whether a model with an alpha-channel skin will alpha blend (Default: 1).
</p>

<pre id="md5shader">md5shader MESH S</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S is the name of the shader to use for rendering the model (Default: "stdmodel").
</p>

<pre id="md5glow">md5glow MESH G</pre>
<p>
MESH specifies the name of the mesh this setting applies to. G is the glowmap scale (not given or 0 gives the default of 300, -1 means off entirely), such that
the glow is G percent of the diffuse skin color.
</p>

<pre id="md5glare">md5glare MESH S G</pre>
<p>
MESH specifies the name of the mesh this setting applies to. S and G are floating point values that scale the amount of glare generated by specular light and glare, respectively (Default: 1 1).
</p>

<pre id="md5envmap">md5envmap MESH P</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Sets the environment map used for the model, where P is a pathname in the same syntax as the
"loadsky" command. If this is not specified, the mesh will use the closest "envmap" entity,
or skybox, if none is available (unless overridden by "mdlenvmap").
</p>

<pre id="md5ambient">md5ambient MESH A</pre>
<p>
MESH specifies the name of the mesh this setting applies to.  A is the percent of the ambient light that should be used for shading. Not given or 0 gives the
default of 30%, -1 means no ambient.
</p>

<pre id="md5fullbright">md5fullbright MESH N</pre>
<p>
MESH specifies the name of the mesh this setting applies to. Uses a constant lighting level of N instead of the normal lighting. N is a floating-point value on a scale of 0 to 1.
</p>

<pre id="md5anim">md5anim A F [S [P]]</pre>
<p>
This assigns a new animation to the current animation part of the last loaded model (md5load). A is the name of the animation
to define. Any of the following names may be used:
</p>
<ul>
    <li>dying</li>
    <li>dead</li>
    <li>pain</li>
    <li>idle</li>
    <li>forward</li>
    <li>backward</li>
    <li>left</li>
    <li>right</li>
    <li>hold 1 ... hold 7</li>
    <li>attack 1 ... attack 7</li>
    <li>jump</li>
    <li>sink</li>
    <li>swim</li>
    <li>edit</li>
    <li>lag</li>
    <li>taunt</li>
    <li>win</li>
    <li>lose</li>
    <li>gun shoot</li>
    <li>gun idle</li>
    <li>vwep shoot</li>
    <li>vwep idle</li>
    <li>mapmodel</li>
    <li>trigger</li>
</ul>

<p>
F is the file name of an md5 animation file. S is frames per second at which to run the anim. If none is specified or S=0, 10 FPS is the default. P specifies an optional priority for the animation (defaults to P=0).
</p>

<p>
A character model will have up to 2 animations simultaneously playing - a primary animation
and a secondary animation. If a character model defines the primary animation, it will be used,
otherwise the secondary will be used if it is available. Primary animations are:
</p>
<ul>
    <li>dying</li>
    <li>dead</li>
    <li>pain</li>
    <li>hold 1 ... hold 7</li>
    <li>attack 1 ... attack 7</li>
    <li>edit</li>
    <li>lag</li>
    <li>taunt</li>
    <li>win</li>
    <li>lose</li>
</ul>

<p>
Secondary animations are:
</p>
<ul>
    <li>idle</li>
    <li>forward</li>
    <li>backward</li>
    <li>left</li>
    <li>right</li>
    <li>jump</li>
    <li>sink</li>
    <li>swim</li>
</ul>

<pre id="md5animpart">md5animpart B</pre>
<p>
Starts a new animation part that will include bone B and all its sub-bones. This effectively splits animations up at the bone B, such that each animation part animates as if it were a separate model. Note that a new animation part has no animations (does not inherit any from the previous animation part). After an "md5load", an implicit animation part is started that involves all bones not used by other animation parts. Each model currently may only have 2 animation parts, including the implicit default part, so this command may only be used once and only once per md5mesh loaded. However, you do not need to specify any animation parts explicitly and can just use the default part for all animations, if you do not wish the animations to be split up/blended together.
</p>

<pre id="md5tag">md5tag B T</pre>
<p>
Assigns the tag name T to the bone B, for either use with "md5link" or attachment of other models via tags.
</p>

<pre id="md5link">md5link P C T [X Y Z]</pre>
<p>
This links two models together. Every model you load with md5load has an ID. The first model
you load has the ID 0, the second has the ID 1, and so on, those ID's are now used to identify
the models and link them together. P the ID of the parent model. C to ID of the
child model. T name of the tag that specifies at which vertex the models should be linked.
X, Y, and Z are an optional translation for this link.
</p>

<pre id="md5adjust">md5adjust BONE YAW [PITCH] [ROLL]</pre>
<p>
Adjusts bone BONE with the specified rotations, in degrees, on any animations loaded after this command is specified.
</p>

<h2 id="smd_format">SMD Format</h2>
<p>
The Half-Life SMD format is configured almost identically to how MD5s are used. The only differences are that SMD specific commands are prefixed with "smd" instead of "md5" (i.e. "smdskin" instead of "md5skin") which are specified in "smd.cfg" instead of "md5.cfg".
</p>

<h2 id="iqm_format">IQM Format</h2>
<p>
The Inter-Quake Model (IQM) format is configured almost identically to how MD5s are used. The only differences are that IQM specific commands are prefixed with "iqm" instead of "md5" (i.e. "iqmskin" instead of "md5skin") which are specified in "iqm.cfg" instead of "md5.cfg".
</p>
 
<h2 id="common_commands">Common Commands</h2>
<pre id="mdlcollide">mdlcollide N</pre>
<p>
If N is 0, collisions with the model are disabled (Default: 1).
</p>

<pre id="mdlellipsecollide">mdlellipsecollide N</pre>
<p>
If N is 1, the model uses an elliptical collision volume instead of a box (Default: 0). This setting is good for barrels, trees, etc.
</p>

<pre id="mdlbb">mdlbb R H [E]</pre>
<p>
Sets the model's bounding box to radius R and height H. If this is not set, or R and H are 0, 
a bounding box is automatically generated from the model's geometry. E is fraction of the
model's height to be used as the eyeheight (Default: 0.9).
</p>

<pre id="mdlcullface">mdlcullface N</pre>
<p>
If N is 0, backface culling is disabled for this model. Otherwise, backface culling is enabled
(Default: 1).
</p>

<pre id="mdlspec">mdlspec S</pre>
<p>
S is the specular intensity (not given or 0 gives the default of 100, good for metal/plastics
and anything shiny, use lower values like 50 for wood etc, -1 means off entirely).
</p>

<pre id="mdlalphatest">mdlalphatest T</pre>
<p>
Controls the cut-off threshold, T, at which alpha-channel skins will discard pixels where alpha is less than T.
T is a floating point value in the range of 0 to 1 (Default: 0.9).
</p>

<pre id="mdlalphablend">mdlalphablend B</pre>
<p>
Controls whether a model with an alpha-channel skin will alpha blend (Default: 1).
</p>

<pre id="mdlglow">mdlglow G</pre>
<p>
G is the glowmap scale (not given or 0 gives the default of 300, -1 means off entirely), such that 
the glow is G percent of the diffuse skin color.
</p>

<pre id="mdlglare">mdlglare S G</pre>
<p>
S and G are floating point values that scale the amount of glare generated by specular light and glare, respectively (Default: 1 1).
</p>

<pre id="mdlshader">mdlshader S</pre>
<p>
S is the name of the shader to use for rendering the model (Default: "stdmodel").
</p>

<pre id="mdlambient">mdlambient A</pre>
<p>
A is the percent of the ambient light that should be used for shading. Not given or 0 gives the
default of 30%, -1 means no ambient.
</p>

<pre id="mdlscale">mdlscale S</pre>
<p>
Scale the model's size to be S percent of its default size.
</p>

<pre id="mdltrans">mdltrans X Y Z</pre>
<p>
Translate the model's center by (X, Y, Z), where X/Y/Z are in model units (may use floating
point).
</p>

<pre id="mdlyaw">mdlyaw Y</pre>
<p>
Offsets the model's yaw by Y degrees.
point).
</p>

<pre id="mdlpitch">mdlpitch P</pre>
<p>
Offsets the model's pitch by P degrees.
</p>

<pre id="mdlspin">mdlspin Y</pre>
<p>
Simple spin animation that yaws the model by Y degrees per second.
</p>

<pre id="mdlenvmap">mdlenvmap E F [P]</pre>
<p>
Sets the environment map used for the model, where P is a pathname in the same syntax as the
"loadsky" command. If this is not specified, the model will use the closest "envmap" entity,
or skybox, if none is available. If E is non-zero, then the blue channel of the masks is
interpreted as a chrome map. E (maximum envmap intensity) and F (minimum envmap intensity, default: 0) are floating point
values in the range of 0 to 1, and specify the range in which the envmapping intensity will vary based on a viewing angle
(a Fresnel term that is maximal at glancing angles, minimal when viewed dead-on). The intensity,
after scaled into this range, is then multiplied by the chrome map.
</p>

<pre id="mdlfullbright">mdlfullbright N</pre>
<p>
Uses a constant lighting level of N instead of the normal lighting. N is a floating-point value on a scale of 0 to 1.
</p>

<pre id="mdlshadow">mdlshadow B</pre>
<p>
Controls whether a mapmodel will cast shadows (Default: 1).
</p>

</body>
</html>