Ok guys, let's do this! I'm gonna explain what I did.
If you open up the default Doom 3 shotgun's mesh file (viewshotgun.md5mesh) in a text editor (I use notepad++) and also the alpha shotgun's mesh file (idle.md5mesh) and compare them, you'll see that the skeleton structure is pretty different, but the meshes are kind of similar. What I'm doing here is taking just the mesh of the alpha shotgun, and weighting it (by hand) to the final shotgun's skeleton, also using the final shotgun's hands, muzzle flash, etc.
The Doom 3's shotgun's mesh data starts at line 3210 with:mesh {
// meshes: shotgun2loadermesh, shotgun2hatchmesh, shotgun2triggermesh, shotgun2bodymesh, shotgun2thingymesh
shader "models/weapons/shotgun/shotgun2"
numverts 521
vert 0 ( 0.1032430008 0.4571369886 ) 0 1
vert 1 ( 0.0898780003 0.4742140174 ) 1 1
vert 2 ( 0.2645879984 0.4747689962 ) 2 1
vert 3 ( 0.3052049875 0.4593909979 ) 3 1
.....................
The alpha shotty's mesh data starts at line 3495 with:mesh 3 {
shader "P:/Doom/base/models/weapons/shotgun/shotgun.tga"
numverts 525
vert 0 0.419237 0.994942 0 1
vert 1 0.403058 0.945494 1 1
vert 2 0.376357 0.951637 2 1
vert 3 0.445938 0.988799 3 1
......................
First we have some data about the textures used, which in the final shotgun have a "2" added to the name. I just wanna use the original alpha shotty textures without editing them at all, so let's start by making a copy of the final shotty's viewmodel.md5mesh and edit shader "models/weapons/shotgun/shotgun2" to shader "models/weapons/shotgun/shotgun"
We then have data about the verticles of the mesh, and the structure as you can see is pretty similar, it's just that in MD5 version 10 you have some brackets, which are easy enough to add. So we copy the vert data into our new file, adding brackets, as such:
mesh {
// meshes: shotgun2loadermesh, shotgun2hatchmesh, shotgun2triggermesh, shotgun2bodymesh, shotgun2thingymesh
shader "models/weapons/shotgun/shotgun"
numverts 525
vert 0 ( 0.419237 0.994942 ) 0 1
vert 1 ( 0.403058 0.945494 ) 1 1
vert 2 ( 0.376357 0.951637 ) 2 1
vert 3 ( 0.445938 0.988799 ) 3 1
....................
Repeat this for all 524 verts.
Now we have some data about the triangles formed by those vertices. The structure is unchanged between md5 ver 6 and md5 ver 10, so we just copy them as they are:
mesh {
numtris 726
tri 0 2 1 0
tri 1 1 3 0
tri 2 5 4 2
tri 3 4 1 2
.............
Now this is the hard part. The final thing we need to do is convert the weights. The final shotty's weight structure is as such:
numweights 460
weight 0 45 1 ( -1.1618540287 1.8253916502 -2.5651056767 )
weight 1 45 1 ( -1.3241766691 1.4282286167 -2.8228754997 )
weight 2 45 1 ( -1.3562994003 1.4366424084 0.5623182654 )
weight 3 45 1 ( -1.538304925 1.7790647745 1.3458048105 )
.......................
The number, in this case 45, after the weight number, points to the bone of the skeleton this weight is weighted to. In the alpha shotty's file we have:
numweights 387
weight 0 7 1.000000 -0.161570 0.152631 -0.575566
weight 1 7 1.000000 0.161570 -0.361041 0.002314
weight 2 7 1.000000 -0.161570 -0.361041 0.002314
weight 3 7 1.000000 0.161570 0.152631 -0.575566
.................................
The structure is again similar, we need to change that 1.000000 to a integer 1, and put some brackets, as such:
numweights 387
weight 0 46 1 ( -0.161570 0.152631 -0.575566 )
weight 1 46 1 ( 0.161570 -0.361041 0.002314 )
weight 2 46 1 ( -0.161570 -0.361041 0.002314 )
weight 3 46 1 ( 0.161570 0.152631 -0.575566 )
..........................
The hard part is in finding which bone number to add. There is skeleton information with bone numbers in the top area of the file, so we have to cross-reference the 2 files, and do a bit of guessing. In this case, bone number 7 of the alpha shotty refers to the trigger bone. In the alpha shotty it's pretty clearly defined as:
bone 7 {
name "trigger"
bindpos 3.766150 10.143418 -8.745363
bindmat 0.990420 -0.120908 -0.066710 0.071636 0.036860 0.996750 -0.118056 -0.991979 0.045168
parent "body"
}
In the final shotty's file it's a bit more of a mess though. Here's what we have:joints {
"origin" -1 ( 0 0 0 ) ( 0 0 0 ) //
"Luparm" 0 ( 0.4833493233 5.7511296272 -9.0378808975 ) ( 0.9081454873 0.3498200774 -0.144503355 ) // origin
"Lloarm" 1 ( 7.2806649208 1.6676592827 -12.973526001 ) ( -0.0590322353 0.2909387052 0.8984508514 ) // Luparm
"Lhand" 2 ( 12.3728561401 -3.0698595047 -8.4780578613 ) ( 0.0763709918 0.478425324 0.581056416 ) // Lloarm
"Lindex_base" 3 ( 16.150226593 -4.7425680161 -9.0065507889 ) ( -0.5856987238 -0.4627053142 0.6216347814 ) // Lhand
"Linkdex_mid" 4 ( 17.047876358 -5.2961034775 -8.6948957443 ) ( -0.6909412146 -0.274851203 0.5410302281 ) // Lindex_base
"Lindex_tip" 5 ( 17.6754875183 -5.683578968 -7.8493061066 ) ( 0.5153698921 0.425893575 0.7064723372 ) // Linkdex_mid
"LI" 6 ( 17.9837760925 -5.9791502953 -7.0266103745 ) ( -0.0160105079 0.6416182518 -0.3646076024 ) // Lindex_tip
"Llothumb" 3 ( 13.7150249481 -2.5654306412 -7.7432045937 ) ( -0.50970608 -0.6824348569 0.3554845154 ) // Lhand
"Lthumb_base" 8 ( 14.8900489807 -2.9082701206 -7.1972894669 ) ( -0.6056233048 -0.689471066 0.3253226578 ) // Llothumb
"Lthumb_tip" 9 ( 15.9811010361 -3.1785695553 -6.665561676 ) ( 0.2044269741 0.2934559882 0.6186554432 ) // Lthumb_base
"LT" 10 ( 17.0730247498 -3.5310857296 -6.1192808151 ) ( -0.0760235563 -0.4030703902 0.8790169358 ) // Lthumb_tip
"Lmiddle_base" 3 ( 15.4484920502 -5.2113866806 -9.1504154205 ) ( -0.6302651167 -0.4068917334 0.6281057596 ) // Lhand
"Lmiddle_mid" 12 ( 16.6324157715 -6.1513743401 -8.744884491 ) ( -0.7275019288 -0.173170954 0.5364482999 ) // Lmiddle_base
"Lmiddle_tip" 13 ( 17.0850162506 -6.7068061829 -7.8768839836 ) ( 0.5479424 0.4130866528 0.7188144326 ) // Lmiddle_mid
"LM" 14 ( 17.4486026764 -7.125038147 -6.7791156769 ) ( 0.102818042 0.6394601464 -0.3245222867 ) // Lmiddle_tip
"Lpinky_base" 3 ( 14.4077243805 -6.7647986412 -8.8468084335 ) ( -0.6241989136 -0.3901802301 0.6318556666 ) // Lhand
"Lpinky_mid" 16 ( 14.8070068359 -7.3026685715 -8.6946725845 ) ( -0.645483613 -0.2603185773 0.7071897984 ) // Lpinky_base
"Lpinky_tip" 17 ( 15.0376338959 -7.7435803413 -8.1241779327 ) ( 0.7199357152 0.1250852197 0.6336508393 ) // Lpinky_mid
"LP" 18 ( 15.3646745682 -8.1007432938 -7.4334173203 ) ( 0.2610396743 0.5585240722 -0.5533664823 ) // Lpinky_tip
"Lring_base" 3 ( 14.9045257568 -5.8860750198 -9.3074493408 ) ( -0.6394466758 -0.3763082027 0.6468923688 ) // Lhand
"Lring_mid" 20 ( 15.7196474075 -6.8555617332 -8.9111881256 ) ( -0.7254487872 -0.1432763487 0.5647428036 ) // Lring_base
"Lring_tiip" 21 ( 16.2235984802 -7.3526673317 -8.1220016479 ) ( 0.5645759106 0.3668998778 0.7252514958 ) // Lring_mid
"LR" 22 ( 16.5637626648 -7.7952003479 -7.1330022812 ) ( 0.0645155534 0.6355726719 -0.2869772315 ) // Lring_tiip
"shell" 3 ( -6.2707862854 -3.9127318859 -17.100025177 ) ( -0.4763432145 0.4775516987 0.5630401969 ) // Lhand
"Rloarm" 0 ( -7.5900211334 -6.6589999199 -6.7884960175 ) ( 0.5247763991 0.5635455251 0.3549961448 ) // origin
"Rhand" 25 ( -0.4985799789 -5.145304203 -7.5785927773 ) ( -0.6043027639 -0.5303581953 0.2742325664 ) // Rloarm
"Rfings1" 26 ( 1.8496937752 -5.1396722794 -7.3755803108 ) ( -0.0094320262 0.6949309707 0.1434427649 ) // Rhand
"Rfings2" 27 ( 2.1104314327 -3.8172588348 -7.0822367668 ) ( -0.2022499889 0.6862661839 -0.1676591784 ) // Rfings1
"Rfings3" 28 ( 1.6958292723 -3.1096203327 -7.0459222794 ) ( -0.4484608471 0.5684294701 -0.4241105318 ) // Rfings2
"Rfings4" 29 ( 0.5986104012 -3.0831234455 -7.0436177254 ) ( -0.3770252466 -0.6146700382 0.3456977606 ) // Rfings3
"Rindex" 26 ( 2.1099567413 -5.007291317 -5.8850240707 ) ( 0.2899479568 0.578058064 0.4233001173 ) // Rhand
"Rindex1" 31 ( 3.3214888573 -4.4572753906 -5.7586479187 ) ( -0.2634427547 -0.6802030206 0.1538700908 ) // Rindex
"Rindex2" 32 ( 3.6566333771 -3.7334990501 -5.6334171295 ) ( -0.1940689534 0.7109459043 -0.0916132778 ) // Rindex1
"Rindex3" 33 ( 3.344804287 -2.9328768253 -5.535378933 ) ( -0.5668188334 -0.4192173183 -0.5053073168 ) // Rindex2
"Rthumb1" 26 ( -0.3717519045 -4.487651825 -6.2595863342 ) ( -0.1106308028 -0.3452607095 0.1986611933 ) // Rhand
"Rthumb2" 35 ( -0.2627551556 -3.2765741348 -5.5833754539 ) ( 0.3737838566 0.8790434003 0.2297670096 ) // Rthumb1
"Rthumb3" 36 ( 0.6325426102 -2.8694131374 -5.5655493736 ) ( -0.3976115882 -0.1093833297 0.4031422436 ) // Rthumb2
"Rthumb4" 37 ( 1.4502311945 -2.9615726471 -5.6329612732 ) ( -0.4975103438 -0.0576442443 0.4137215316 ) // Rthumb3
"body" 26 ( 1.1294283867 -3.5466656685 -6.2687735558 ) ( -0.4847298861 0.4595376551 0.5807026029 ) // Rhand
"barrel" 39 ( 24.3521671295 -5.8415298462 -5.6125850677 ) ( -0.7328779697 -0.0302119888 0.0089676399 ) // body
"bottomhatch" 39 ( 7.2126793861 -4.1016025543 -6.775352478 ) ( -0.4847298861 0.4595376551 0.5807026029 ) // body
"eject" 39 ( 8.8610668182 -3.1246507168 -4.5294680595 ) ( -0.0437424332 -0.7325106263 -0.0071747582 ) // body
"flash" 39 ( 27.2414665222 -1.9965937138 -2.5861241817 ) ( -0.7328779697 -0.0302120335 0.0089676017 ) // body
"thingy" 39 ( 7.5711240768 -2.9426212311 -4.5114688873 ) ( -0.7328779697 -0.0302120335 0.0089676017 ) // body
"toob" 39 ( 16.3328342438 -4.9797677994 -6.6996021271 ) ( -0.4847298861 0.4595376551 0.5807026029 ) // body
"trigger" 39 ( 3.6178686619 -3.9214844704 -5.3162083626 ) ( -0.4847298861 0.4595376551 0.5807026029 ) // body
}
There are some numbers after the bones that you might first guess are the bone numbers, but they're not. They're not actually shown anywhere, you have to manually count all the bones, starting with 0 for the origin bone. Doing so, the trigger, which is the last bone in the final skeleton, is number 46. So I replaced the "7" with "46" as you just saw above.
This is how I did the conversion. And now that I explained it, you should be able to do it too. The problem with the empty shell release door thingy is that I can't find an equivalent bone in the final mesh's skeleton to attach it to. I tried attaching it to a few that I thought it would work, including the body's bone, but the result was, as you saw, them sticking out on the side in an ugly fashion. I hope you'll be able to find a way around that. I just removed them altogether.