Adding weapon bones to player models?
Has anyone ever successfully added the weapons bones needed for DoD:S
player models to player models from CS:S or HL2?
The bones are ValveBiped.weapon_bone and ValveBiped.weapon_bone_left.
It would look alot nicer when setting a "fun" player model without the weapon sticking out in strange places :eek:
BERSERK3R
08-19-2007, 06:22 AM
Has anyone ever successfully added the weapons bones needed for DoD:S
player models to player models from CS:S or HL2?
The bones are ValveBiped.weapon_bone and ValveBiped.weapon_bone_left.
It would look alot nicer when setting a "fun" player model without the weapon sticking out in strange places :eek:
It might just be me, but could you explain abit clearer?
Do you mean weapons stay on the player model?
If you recompile a player model from another mod, like CSS or HL2 for DODS, they don't have those bones I listed, which must be merged upon compiling.
The recompiled model could be used in DODS without the weapon bones, and you can fire the weapon just fine, but it will not be in your hand in the world view. It will most likely be sticking thru the mid torso area.
I'm thinking that if I could add these bones, then that would solve the weapon placement issue.
Jed gave me some tips on how this might work. Here's what he had to say:
"Yeah it's possible although I'm not 100% sure how you would do it in XSI.
The DoD player models use the same standard HL2 skeleton as the other male
human models in HL2. The only difference is that the DoD player models don't
use the procedural bones. It doesn't matter if you're models do.
As long as you're using the standard skeleton you just need to create the two
weapon bones and link/parent them to the right/left hand bones as needed.
The only problem will be getting the bones aligned properly.
I use 3DS Max and the way I would get the bones in is to import the reference
SMD for my new character model. Next, I would then import the reference SMD
from one of the DoD character models but choose only to import the skeleton.
Doing this wont replace any bones with the same name, but will add any new
ones from the DoD player model skeleton.
You should then find you have a character model with the additional DoD weapon bones.
You'll need to add $bonemerge commands to your QC file to tell the model that
the new weapon bones are to be bone merged against.
That's about as simple as it gets, I'm afraid."
I installed the XSI ModTool last night and just now experimented with it. I was able to add
the bones in a similar fashion to what Jed described - however, the placement
of the bones is a bit off (5 feet behind the hands). I'll see if I can manually tweak them into position.
Haven't spent alot of time with the bone tweaking, other than being able to place it in
different translations and rotations in XSI Mod Tool, but I did get the animations to work.
The eyes look like she's had one too many!
Maybe another animation missing?
Guyver
08-23-2007, 11:12 PM
Hmmm... could this be used so you could take animations from CS:S, so we can have it where the DoD:S player models actually take out a magazine ect, and put in a new one like in CS:S? (Third-person view)
That has been one of my pet peeves ever since DoD:S was released, it looks so silly to see them grabbing "air".
Trp. Jed
08-24-2007, 12:31 AM
I had five minutes spare the other day and played around with the weapon bones. It's do-able but it's not easy to explain how in simple English :|
Guyver
08-24-2007, 01:50 PM
I had five minutes spare the other day and played around with the weapon bones. It's do-able but it's not easy to explain how in simple English :|
Was what I said possible, or were you referring to what f64 said?:)
Trp. Jed
08-24-2007, 02:35 PM
I dunno. I did it my own usual kack-handed way.
Before I try to set the weapon placement again, I would like to fix the eye movement first. I noticed in HLMV that the eyes will move around in their sockets and try to follow you around, wheres the DODS models have no eyeball attachments or movement at all.
So I tried removing the flexfile data in the qc, but they still move around in HLMV. Haven't tried it ingame yet.
Each eyeball in addition to "eyes" are listed as attachments. I'm assuming they can be fixed rigid somehow, looking straight ahead.
Any ideas?
Trp. Jed
08-24-2007, 07:02 PM
If you look at the example human model in the SDK the QC that comes with it tells you how to set-up the eyes to look in the right direction.
I think the very basic you need for eyes is something like the following:
$model female_06 "female_06_reference.smd"{
eyeball righteye "ValveBiped.Bip01_Head1" -1.2783 -3.6165 65.0663 "eyeball_r" 1 4 "pupil_r" 0.63
eyeball lefteye "ValveBiped.Bip01_Head1" 1.2823 -3.6165 65.0642 "eyeball_l" 1 -4 "pupil_l" 0.63
}
The syntax is:
eyeball (name) (bone name) (X) (Y) (Z) (material name) (diameter) (angle) (iris material) (pupil scale)
name is the name of the eye which is used to match eyelid rules.
bone name is the bone that the eyes are linked to (usually the head)
X, Y, Z relates to the centre of the eyeball, not on the surface but as a sphere inside the skull. You'll either have to guess at this or, do what I do and make 2 spheres in you're 3D app and place them where they look mode correct for eyes. Make a note of their co-ordinates and use them here.
material name refers to the name of the VMT texture the represents the white of the eye. Theres usually one for each eye.
diameter is the diameter of the eye. If you used the spheres in the 3D app trick for the origins you can use the same to get the diameter.
angle dictates "wall eye" and basically says how many degrees of straigh ahead the eye looks normally. Peoples eyes don't look straight ahead, they usually both look inwards at a point infront of the person. Get this angle wrong and models look crosseyed.
iris is the VMT material that loads the iris texture for the eye.
scale is the scale (how big) the iris is.
The fact you have the actual eyes rendering shows you're part way there.
Trp. Jed
08-25-2007, 12:55 AM
Ok. Here you go. Heres how to add the weapon bones. I used the human player model from the SDK as a test.
It's found in sourcesdk_content\hl2mp\modelsrc\humans_sdk\Male\G roup03\
Basically, what you need to do is add a couple of bonedefines, some attachment, bonemerges and tell it to use the DoD animations. QC is as follows:
/*
================================================== ============================
male05, Group03
================================================== ============================
*/
$modelname player\american_rifleman.mdl
$cdmaterials models\Humans\Male\Group03 models\Humans\Male
//start eye/face data
$eyeposition 0 0 70
// head controllers
$attachment "eyes" "ValveBiped.Bip01_Head1" -0.0454 -3.2682 67.3843 absolute
$attachment "mouth" "ValveBiped.Bip01_Head1" 0.80 -5.50 0.10 rotate 0 -80 -90
$attachment "chest" "ValveBiped.Bip01_Spine2" 5.00 4.00 0.00 rotate 0 90 90
$model male_05 "male_05_reference.smd"{
eyeball righteye "ValveBiped.Bip01_Head1" -1.2562 -3.2682 67.382 "eyeball_r" 1 4 "pupil_r" 0.63
eyeball lefteye "ValveBiped.Bip01_Head1" 1.1654 -3.2682 67.3866 "eyeball_l" 1 -4 "pupil_l" 0.63
eyelid upper_right "male_05_expressions" lowerer 1 -0.1353 neutral 0 0.1096 raiser 2 0.1912 split 0.1 eyeball righteye
eyelid lower_right "male_05_expressions" lowerer 3 -0.2482 neutral 0 -0.1349 raiser 4 -0.0396 split 0.1 eyeball righteye
eyelid upper_left "male_05_expressions" lowerer 1 -0.1353 neutral 0 0.1096 raiser 2 0.1912 split -0.1 eyeball lefteye
eyelid lower_left "male_05_expressions" lowerer 3 -0.2482 neutral 0 -0.1349 raiser 4 -0.0396 split -0.1 eyeball lefteye
mouth 0 "mouth" "ValveBiped.Bip01_Head1" 0 1 0 // mouth illumination
flexfile "Male_05_expressions" {
$include "../../standardflex_xsi.qci"
}
$include "../../facerules_xsi.qci"
$include "../../bodyrules_xsi.qci"
}
//end eye/face data
$surfaceprop "flesh"
$bbox -13 -13 0 13 13 72
$mostlyopaque
$include "../../standardhierarchy.qci"
$include "../../standardikchains.qci"
$alwayscollapse "Male_01"
$alwayscollapse "XSISceneRoot"
$proceduralbones "../../male.vrd"
$include "../commonbones.qci"
// *** ADD THESE FOR DOD ***
$definebone "ValveBiped.weapon_bone" "ValveBiped.Bip01_R_Hand" 8.386830 -2.717052 47.380913 -39.868694 176.232544 -89.737396 0.000000 0.000000 -0.000000 0.000000 0.000001 -0.000001
$definebone "ValveBiped.weapon_bone_left" "ValveBiped.Bip01_L_Hand" 8.370580 -3.107144 -47.359760 -39.878437 -3.372029 89.647211 0.000000 -0.000000 0.000000 0.000000 -0.000002 0.000000
$attachment "weapon_bone" "ValveBiped.weapon_bone" 0.00 0.00 0.00 rotate 0.00 -0.00 -0.00
$attachment "weapon_bone_left" "ValveBiped.weapon_bone_left" -0.00 0.00 0.00 rotate -0.00 0.00 -0.00
$attachment "2" "ValveBiped.Bip01_Head1" -0.00 0.00 0.00 rotate -0.00 0.00 0.00
$attachment "head" "ValveBiped.Bip01_Head1" -0.00 0.00 0.00 rotate -0.00 0.00 0.00
$bonemerge "ValveBiped.weapon_bone"
$bonemerge "ValveBiped.weapon_bone_left"
$includemodel "player/dod_player_shared.mdl"
// **************************
$lod 7
{
replacemodel "Male_05_reference" "Male_05_LOD_1"
}
$lod 14
{
replacemodel "Male_05_reference" "Male_05_LOD_2"
}
$lod 24
{
replacemodel "Male_05_reference" "Male_05_LOD_3"
$include "../../removehands.qci"
replacematerial "eyeball_r" "art_facemap"
replacematerial "eyeball_l" "art_facemap"
replacematerial "mouth" "art_facemap"
nofacial
}
$lod 35
{
replacemodel "Male_05_reference" "Male_05_LOD_4"
$include "../../lowesthumanskeleton.qci"
$include "../../lowesthumannohelpers.qci"
replacematerial "eyeball_r" "art_facemap"
replacematerial "eyeball_l" "art_facemap"
replacematerial "mouth" "art_facemap"
nofacial
}
$lod 60
{
replacemodel "Male_05_reference" "Male_05_LOD_5"
$include "../../lowesthumanskeleton.qci"
$include "../../lowesthumannohelpers.qci"
replacematerial "eyeball_r" "art_facemap"
replacematerial "eyeball_l" "art_facemap"
replacematerial "mouth" "art_facemap"
nofacial
}
$shadowlod
{
replacemodel "Male_05_reference" "Male_05_LOD_4"
$include "../../lowesthumanskeleton.qci"
$include "../../lowesthumannohelpers.qci"
replacematerial "eyeball_r" "art_facemap"
replacematerial "eyeball_l" "art_facemap"
replacematerial "mouth" "art_facemap"
removemesh "models/humans/male/eyeball_r"
removemesh "models/humans/male/eyeball_l"
removemesh "models/humans/male/mouth"
nofacial
}
$pushd "../"
$include "../hitbox.qci"
$include "../ragdoll.qci"
$popd
If $definebones doesn't work (although it should) you can add the bones by taking the DoD:S player reference SMD, renaming all the textures in it to "null.bmp" and then added it to your QC via a $model command, i.e.:
$model dod_skel "american_assault_reference.smd"
What this will do is include that SMD, but because all the textures are null, the compiler will remove all the faces leaving just the skeleton. The bones from the SMD will be merged with the bones from the other SMD files in your QC. This assumes that you're player model is using the default HL2 rig.
With the above technique, you still have to add the extra $attachments and $bonemerge commands but can remove the $definebones.
I had defined the bones previously just as you have shown, but always got the error "Imported bone ValveBiped.weapon_bone tried to access parent bone ValveBiped.Bip01_R_Hand and failed!" - as well as the other weapon bone. What finally got it set right was including the common bones.
The only issue I have left is the eyes are still rolling in the socket on the z axis as the model is zoomed in and out in the model viewer, although I have now stopped the rotation on the x axis with the absolute value in the eyeball line. They continue to roll up all the way into the head and will look down at a very close range. Any way to fix this?
http://img265.imageshack.us/img265/5467/eyes1nf5.jpghttp://img130.imageshack.us/img130/9237/eys2gt1.jpg
Trp. Jed
08-28-2007, 04:15 PM
Have you included the bodyrules file? That defines a controller which controls the verticle alignment of the eyes.
I tried adding the bodyrules file. No change :( . The model seems to compile and look the same even if I delete the flex data, forward attachment and various other things as I try to coax this puppy into submission. Oh, I didn't entirely eliminate the x axis movement either and I meant to say earlier that I added absolute to the $attachment "eyes" line.
I'm about ready to pluck those eyeballs out, except I know that then I will be faced with having to texture the mesh. Not being a modeler, that looks like a daunting task to me. If you want to play around with the models I am using, they are the korin (http://www.fpsbanana.com/skins/8904) models which can be found at FPSB.
These particular models weren't exactly what I intend to use, I was just experimenting with them, so perfecting then for game play isn't my goal. Custom models that we would use for fun are things I will have to learn how to do with XSI and I didn't expect to learn overnight what I will need to know in order to do that.
But I am curious about the eyes. Do eyeballs enhance the appearance of the eyes or is it more of a case that they are needed for NPC characters which have the eyes moving around? The korin models were modeled to replace css hostages and I don't know if their eyes move around or not.
In dods, they still try to follow a "magnetic north/south" in the world.
Trp. Jed
08-31-2007, 10:56 AM
Have you got a "forward" bone and attachment in your model/QC? I belive its what the engine uses as a reference for, suprisingly, forward is. As the default DoD models dont have moving eyes it may be missing that bone (I can't recall of the top of my head).
I had tried previously without the forward attachment as I had read (http://developer.valvesoftware.com/wiki/Eye_Position_Setup) about it on the wiki. No change. :confused:
Day of Defeat Forum Archive created by
Neil Jedrzejewski.
This in an partial archive of the old Day of Defeat forums orignally hosted by
Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.