Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
Last visit was: Mon Dec 07, 2009 12:27 am It is currently Mon Dec 07, 2009 12:27 am

All times are UTC




 [ 4 posts ] 
Author Message
 Post subject: Weapon/item models
PostPosted: Mon Jul 05, 2004 12:43 am 
Offline
In trouble with the feds
User avatar

Joined: Sun Jan 18, 2004 9:41 pm
Posts: 2649
This info pre-dates Doom 3 and is obsolete. Read it if you're bored. ;) - G

Most of the weapons are missing their corresponding models when you place them in your map as something that can be picked up by the player. For example, placing the shotgun in your map usually results in a fist protruding from the floor... although when you touch it, you do indeed pick up a shotgun and it functions normally. This is because the weapon_shotgun entity is just using the idle mesh used when you have the shotgun weapon equipped. This mesh also includes the fists and a spare shotgun shell.. all of the elements needed for the other shotgun animations, like reloading, firing, etc., and that's why you see a fist protruding from the floor.

Anyhoo, if you have Maya or you otherwise know how to convert an obj to a md5mesh, you can fix this.

The first thing you will need is to convert the weapon's idle md5mesh file into an obj file. Use bozo's md5mesh2obj utility to do this:

http://www.untergrund.ch/md5mesh2obj.zip

I'll walk you through the process for the machine gun.

Run the converter on the models/weapons/machinegun/cycles/idle1.md5mesh file in order to get an idle1.obj file and an idle1.mtr file. Move the obj and mtr files here:

models/weapons/machinegun

Now open the .obj in your particular 3D program. I'm using Maya, but the basic steps are the same.

Basically, we need to remove the extra items... the fists, muzzleflash plane, extra ammo, etc. so all you have left is the weapon. Rotate it appropriately.

Now, because the md5 converter doesn't save the path information to the materials properly, we need to re-apply them. If you don't know how to do this and you're not using Maya or Lightwave, hopefully someome else here can help you, as I'm only familiar with these two 3D packages. However, since you can't use Lightwave (as far as I know) to create md5 files, Maya will have to do.

In Maya, open the hypershade and create a shading map. Next, click "Shading Map Color", choose file, "as projection" and use "cubic" as the projection type. For the image file to use, browse to the color map of the machinegun weapon (this is already provided in D3 and is usually in top level of each weapon's folder... i.e. "machinegun.tga" in models/weapons/machinegun). Now close the material and reopen it. For the "Shader", use a phong material when you're prompted. On the phong, click the "Diffuse" inputs icon, and again apply a file, "as projection", use "cubic" for proj. type, and again use the "machinegun.tga" file.

Keeping the hypershade open, select the weapon in the perspective view. Now right-click the material you just created and choose "Apply Material to Selection".

If you have any problems with this or need extra info, check out my tutorial found here:

http://www.doom3world.org/phpbb2/viewtopic.php?t=2487

and just hop to the Hypershade section.

Note that when you apply the material, it won't look right in the 3D program. That's okay... all we want is to be able to have D3 know where to look for the materials... it'll look fine in the game.

And now the last step... in order to be able to export the weapon back into the md5mesh format, you need to create at least one joint and then skin->bind skin->smooth bind it to the model. Save the file.

Once this is done, we need to make some changes to the weapons.def file.

You'll need to make 2 changes for each weapon:

One is the export line so we get our new md5mesh, the other is making sure to reference the model in the "model" key of the weapon's entity definition.

So, again using the machinegun as an example, here's the export line:

Code:
export {

   // in-game weapon models
   mesh   models/weapons/machinegun/machinegun.mb
   // END OF CHANGES

   // Begin rest of weapons.def file...

   // shotgun
   -options blah blah blah blah blah
...
}



Note that this line must appear ABOVE the // shotgun... -options etc. line... if you put it below, D3 will try to re-parent the fists, muzzleflash plane and the other things we removed earlier from the model, and the export will fail.

Now for the entityDef:

Code:
entityDef weapon_machinegun {
   "editor_color"         ".3 .3 1"
   "editor_mins"         "-16 -16 0"
   "editor_maxs"         "16 16 32"

   "editor_usage"         ""

   "spawnclass"         "idItem"
   "size"               "32 32 32"
   // THIS IS THE LINE TO CHANGE
   "model"             "models/weapons/machinegun/machinegun.md5mesh"
   // END OF CHANGES
   "viewmodel"          "models/weapons/machinegun/cycles/idle1.md5mesh"


The "model" is the in-game/weapon-as-item model. The "viewmodel" is what you see when you're holding/using the weapon.

I think that's it. Let me know if you have any questions or problems.

Goliath


Last edited by goliathvt on Mon Jan 10, 2005 9:01 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 6:21 am 
Offline
Site Admin
User avatar

Joined: Tue May 28, 2002 5:17 pm
Posts: 9993
Location: Munich / Germany
Thanks goliath - quite informative!

Never bothered with this topic, just accepted absence of weapon models.

_________________
Image Staff - The world is yours, soon in 6 degrees of freedom!
Visit ModWiki


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 9:02 am 
Offline
Plasma Spammer
User avatar

Joined: Fri Jun 27, 2003 10:24 pm
Posts: 2701
Location: Munich, Germany
Thankyouthankyouthankyou Goliath... once for doing this tutorial, and twice for giving this another reason to exist:
http://www.doom3world.org/phpbb2/viewtopic.php?t=1309
I once wrote a converter from ASE and OBJ to MD5Mesh. Ofcourse it's pretty useless for anything that moves, because it won't generate a skeleton (since there is none in an ase or obj to begin with), but for static weapon models it sure is ok. And so much cheaper than Maya. :D
So the work could be done with Bozo's md5->obj converter, any 3d editor that reads and writes obj (Blender, Wings3D), and then the ase/obj->md5 converter.
BTW, I think it should also be possible to use an ASE model for these static weapon models.

_________________
Image Staff
Modelviewer | 3DSMax<->MD5 | Blender<->MD5


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 1:25 pm 
Offline
In trouble with the feds
User avatar

Joined: Sun Jan 18, 2004 9:41 pm
Posts: 2649
Yes, ASE's do work for static weapon models... that's what the chaingun currently is... I think it's "vulkan.ase" or something like that. In fact, when I was first testing things and toying with the idea of fixing the pickup-weapon models, I got the machine gun to show up by using the chaingun's vulkan.ase model. Worked like a charm.

Goliath


Top
 Profile  
 
Display posts from previous:  Sort by  
 [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group