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:
V_3aFLDmFj0
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.
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:
V_3aFLDmFj0
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.