V_Model animators - solution to wrist twist!

Trp. Jed
03-07-2007, 09:57 AM
I was looking at some SDK code last night and discovered this little gem. I can't believe it hasn't been spotted sooner or at least discussed (I did Google but didn't find any discussion on it). Even the Valve Wiki has no documentation on it.

Scenario 1: You decompile a DoD:S v_model but when you import animations to work on them the wrists twist up as the hand rotates.
Scenario 2: Your making a new reload animation but when you rotate the hand bone the wrists all twist up. You fix it by animating the wrist bone as well but its laborious and a pain in the backside.

Help is at hand!

Source features something called "procedural bones" - these are bones that are not animated in the SMD but are in face animated by the engine itself based on rules defined during compile time.

If you've ever edited a HL2 player model you've probably seen these bones - their the "in-between" bones you see attached to joints such as the wrist, elbow, knee and ankle bones.

From what I've figured by looking at the code, you define a parent and child bone. When the animation plays, it looks at the rotation difference the parent and child and if it has reached the trigger limits it then rotates the prodecural bone accordingly to compensate. Assuming your have vertices in your model weighted to these procedural bones, they'll get moved as it moves.

The DoD:S v_model meshes are rigged this way so these technique works well with them.

It's probably best if I explain visually:


The animation is nothing more than the hand bone being rotated. Nothing else is animated at all.

In the first part procedural bones aren't used and you can see how the wrist vertices get all ganked up by the extremes on the hand movement. In the second part procedural bones are used and the wrist bone rotates based on its rules to compensate for the hand movement. This results in the vertices of the wrist being twisted to compensate.

Cool huh? ;)

So how do you use it? Piece of cake. Go into you Source SDK folder and grab the file: \sourcesdk_content\hl2mp\modelsrc\humans_sdk\male. vrd and copy it to the folder where your v_models QC is. Next, in your QC after the $sequence defines, put the line:

$proceduralbones "male.vrd"

Thats it! :D Just compile the QC as normal and check it out in HLMV.

I believe this is what they did with the original v_models in DoD:S but CannonFodders decompiler doesn't detect this so it gets lost.

Again, all you'll need to do now is animate the major bones, you can leave the wrist and elbow bones alone and let Source sort it all our for you.

03-19-2007, 12:10 AM
but when I use allies weapons, I see the axis sleeves instead of allied sleeves,how can I fix that?

03-19-2007, 12:39 AM
but when I use allies weapons, I see the axis sleeves instead of allied sleeves,how can I fix that?

Post in this topic:

Mike- knows how to fix it. I'm not saying Jed doesn't know to fix it though, he probably does. :D

03-26-2007, 09:25 AM
Does this work for player models too?

I have an "Performance warning: Mark bone 'ValveBiped.weapon_bone' in model 'player\SAS_ZombieMod\zombie\german_sniper.mdl' as being used by bone merge in the .qc!" error in my player model that may be related to this

Trp. Jed
03-26-2007, 11:24 AM
Yes, this works for player models, in fact it should work for ANY model assuming you set-up the correct procedural bone file.

I don't think your error is related to this but the number of bones in the w_model.

03-26-2007, 12:19 PM
Hmm didnt touch that one tho, basically just decompiled the standard axis sniper model, changed its path and also the one to the vmt (to point to the zombie skin) and recompiled it.

I did have errors regarding too many shadowlod/lods and found a thread that said to delete them so dunno if thats where it went haywire

04-12-2007, 04:23 PM
Hm strange, for some reason I doesn't fix it.

I am recompiling a default v_model.
Put $proceduralbones "male.vrd" at the very bottom and placed that male.vrd where that .QC file is.

Only think I did was hack the weapon.

Then compiled.

Any ideas?

Trp. Jed
04-12-2007, 05:18 PM
Well as long as you didn't alter the bones or the vertices assigned to them it should work fine.

have you tried putting the $proceduralbones command in different places in the QC?

04-12-2007, 07:08 PM
i love you so hard jed

05-14-2007, 05:31 AM
I reckon this is probably worthy of a sticky, eh?

Was a bit tricky to find with just a manual search.

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.