Weapon Export Guide by pants for RtCW

Everything written here is based upon my experience, i am positive there are different ways to do them, but hey, they aren't documented ;) this is not a tut on modeling, animating, texturing, it's simply a guide to exporting your model for use in RtCW.


Tools/Files Used:
3d studio max 4.2
Tical's modified md3 exporter - ExportMD3.zip (41.9 k)
Chris Cooksons's mdc importer - ImportMDC.zip (29.4 k)


Basics
Since i don't know where else to put this, let me say right now, i will refer to .mdc and .md3 as md3 as .mdc is nothing more than a compressed .md3 and its far easier to use one interchangeable word than two and confuse someone. That said, let me begin.

Weapons consist of several components. You can look into a rtcw folder and find upwards of 14+ md3 files and then look in another and only see a few. The reason for this is the complexity of the model. The flamethrower for instance is a cylinder with no moving parts thus it has relatively few objects. The mauser however has a lot of moving parts thus it has a lot of files.

A weapon model's geometry consists of 2 main components, 3rd person models and 1st person models (all are md3 files).

3rd person models
[weaponName], [weaponName]_1, and [weaponName]_2
ss_[weaponName], ss_[weaponName]_1, and ss_[weaponName]_2
[weaponName]_flash

1st person models
v_[weaponName]
v_[weaponName]_barrel
v_[weaponName]_barrel[###]
v_[weaponName]_barrel[lastNumber], v_[weaponName]_flash
v_[weaponName]_hand

The animation system works by taking individual non-animated objects and moving them via the animated tags in v_[weaponName]_hand. Think in terms of paper cutouts, the paper itself is not animated, merely where the paper goes is.


Tags
For those of you not familiar with tags, they are small right triangles that guide how/where the model rotates around. They are labeled tag_[description] and are very important.

If your units are setup for US Standard, to create a tag, simply create a box, center, convert to edit mesh, delete all vertices, create a triangle with the vertices of:
[x= 0'0", y= 0'0", z= 0'0"]
[x= -0'1", y= 0'0", z= 0'0"]
[x= 0'0", y= -0'2", z= 0'0"]
Make sure the normal is facing up.
For visual reference...



3rd person models
[weaponName]_# and ss_[weaponName]_# are in fact the same files and they are by far the easiest files to setup. After you have modeled and textured your weapon, create or import a tag and label it tag_flash. Position tag_flash where you want the flash to show (hint: usually this is at the end of the barrel) and link it to the gun. Move the gun so that the handle is at the origin. Select the gun and tag_flash and go to
File -> Export Selected... -> Choose Quake III (*.MD3), pick a location, and save it as the proper filename.
For visual reference...


To export the [weaponName]_flash, create a tag labeled tag_weapon and place it at the origin where the handle of the weapon is. Select your flash model, tag_flash and tag_weapon and go to
File -> Export Selected... -> Choose Quake III (*.MD3), pick a location, and save it as [weaponName]_flash


1st person models
1st person models are the part of the process that is most fun but also is the most annoying and time consuming. OH BOY! Make sure that you have your model completely finalized both uv-wise and mesh-wise before you begin detaching parts of your model and animating it. It's not fun to redo it all.

Start off by creating a camera, and placing it at the origin and in the top view place the target to the right of the origin, [15'0", 0'0", 0'0"] should do just fine. Go into the camera properties and change its field of view to 90 degrees. When you animate the model, you should be constantly checking this camera's view because it is the closest thing you have to watching it with the appearance of being in-game.
Create a tag labeled tag_weapon and place it at the origin.
Take your model and move it so it's in place. Check this in your camera, this is your lifeline to the game's view.
For visual reference...

Detach parts of your model into all the parts that are going to move independently. If you have a gun with a clip that gets pulled out and put back in during the reload, you would need to detach the clip from the gun. If you have an aiming device that pops up similar to the panzerfaust, you would need to detach that object from the model.
For every object that you detach, you will need to create a tag which should be labeled sequentially tag_barrel, tag_barrel2, tag_barrel3, tag_barrel#, etc. Since i have had to go back and change geometry after i've animated, i quickly learned to animate the tags instead of the geometry. For this reason, i recommend placing the tags at the pivot points of the detached geometry. The object exported with tag_barrel as v_[weaponName]_barrel, as mentioned before, disappears during animation. God only knows why. Well, God or possibly iD, GMI, Nerve, SD, Mad Doc or Activision (who are, as far as i know, not associated with God in any manner implied or expressed). Anyway, back to the point. This quirk just happens, deal. An easy fix to this "problem" is to detach the end faces of the barrel and have tag_barrel be associated with that. Unless your character flips the gun around, you'll never see it. If indeed your character flips the gun around, find another spot.
The other tag you could possibly need is tag_flash which would be located at the base of your flash model.
For visual reference...

near b_barrel is also tag_barrel and tag_flash though i did not indicate it on the image


b_barrel2 and b_barrel3 are not placed at the pivot point bc their primary animation is done with grouping which i explain next
b_barrel4 is at the pivot point of b_lefthand

After i have detached the model parts, i group all the tags and geometry so i can animate just that group to get all of the objects to move in relation to each other. Also, it helps when exporting as i will get into later. After you have grouped your objects, go to Group -> Open so that you can animate independently of the group if need be.
Animate your objects keeping in mind weapon.cfg. All the weapons i have created/animated have not been machinegun style weapons so their attacks are nearly 40 frames long. Looking at the mp40's weapon.cfg, the attack is 3 frames. Drops and Raises should be fairly short (5-15 frames). If you go over in time, the model will cut from the animation to the default pose. I haven't had to do reloads either, so time those as you see fit. The majority of this is playing around with what looks good. You can do an animation and constantly tweak it in the weapon.cfg. i really recommend animating only the tags and the Grouping box. That way, if you need to, you can alter the other md3's and not screw up your animation. As this isn't an animation tutorial, this is as in depth as i am going to go.


Exporting 1st person models
After you have animated, the fun of exporting begins. fun = tedious

Select all of the tags and go to
File -> Export Selected... -> Choose Quake III (*.MD3), pick a location, and save it as v_[weaponName]
When the export options come up, export only frame 0 or any other frame that contains the resting pose of your animations.

Select the Group's box, link it to tag_barrel. Move tag_barrel to the origin. Select all the tags and the object that you want to export (b_barrel, b_lefthand, etc.) and go to
File -> Export Selected... -> Choose Quake III (*.MD3), pick a location, and save it as v_[weaponName]_barrel
When the export options come up, export only frame 0 or any other frame that contains the resting pose of your animations.
Undo all of the moving/linking so you can link the Group's box to tag_barrel2 and repeat, changing the filename as necessary, then repeat until you have exported all of the objects.
v_[weaponName]_[LastNumber] and v_[weaponName]_flash are the same model and they are with tag_flash at the origin.

Select all of the tags and go to
File -> Export Selected... -> Choose Quake III (*.MD3), pick a location, and save it as v_[weaponName]_hand
When the export options come up, export the entire frame range of your animation.
This is the only file with animation.


Final preparations and wrapup
Open an existing weapon.cfg and modify the values to reflect your framerates and framecounts. If you are animating a machinegun or a handgun, choose something like the mp40 which behaves in a similar manner as your reference. If you are animating a bazooka, choose the panzerfaust and work from there.

Whilst on the subject of the panzerfaust, there are certain files that require a very oddly rotated model in models/multiplayer/[weaponName]. i replaced the panzerfaust and i had to create a model for it here. The smoke grenade has this file as well. i don't know why though. Use Chris Cookson's .mdc importer and view the files to match your files to theirs if you need to create one of these files.

i think that's all. i wrote this guide kind of in a rush and not too orgranized from the beginning, so if anything is missing that is crucial, please don't hesitate to contact me.


Credits, thanks and more stuff
This guide is very clearly based off of IanW's Exporting From Max to MD3 with q3data available on polycount.com
This guide is also very clearly based off of pants' (oh that's me) mds Export Guide available on mothermushroom.com
Thanks to Chris Cookson for his excellent work on the mdc/md3/mds importers for gMax and 3ds.
Thanks to TiCaL for recompiling the .md3 plugin for Max 4.
Thanks to The Noiseless, MDS Exporter, The MDC File for posting everything they have.
Thanks to the GNU General Public License.

Again, this is meant to help you, if it has, wonderful! If not... :( Start a thread on the Wolf Tactics Forum (you don't even need to register), seek me out on irc (gamesnet - #wolftactics), or e-mail me and i will do my best to help you.
If you or your computer blow up, it's not my responsibility. :o

Check out Wolf Tactics to see this stuff in use.