Procedural Bones – the Source animators friendWed, March 7th, 2007 @ 18:32
I was looking through some code in the Source SDK and found this little gem last night. I can’t believe I hadn’t spotted it before and theres little or no documention about it over at the Valve Wiki.
Ever looked at the skeleton for a Valve character model and wondered what all those extra bones are around the joints? I’m talking about the wrist, elbow, knee, ankle, etc. bones. If like me you started modding with Half-Life 1, your used to the more common bones with he Valve Biped rig and these extra ones seem a bit superfluous.
Truth is, their and incredible help to animating if you set them up as procedural bones, that is, bones who animation is not created by you but internally by the Source engine itself. Used correctly they’ll pretty much erradicate those annoying twists you get around joints like the wrist.
So how does it work? Well to be honest, with no documention I’m not 100% sure but I’ve got a fairly good idea from looking the Source code.
The basic principle is that for a procedural bone, you assign a parent and child bone which are used to determine its movement. There are then a set of axis constraints and triggers which define when the procedural bone should be animated and by how much.
A good example of this would be the wrist bone. In a view model animation, if the hand rotates at too extreme an angle relative to the forearm all the mesh vertices at the joint twist up badly. If you have these wrist vertices weighted to the wrist bone you can compensate by rotating the bone accordingly to dampen out the twisting. However, you’ve probably done this manually in your animation program which is fine, but it can be incredibly laborious and time consuming to sort out all the compensatory rotations.
With procedural bones, you just animate the rotation of the hand as normal and let the Source engine handle the rotation of the wrist bone to compensate automatically.
This is probably best explained visually. This animation is just the hand bone being rotated in two axis. Nothing else in the skeleton rig is moved at all:
In the first part of the clip, procedural bones aren’t been used the as the hand rotates you get the nasty twisting of the wrist vertices. In the second part, the wrist bone is defined as procedural and as the hand rotates you can see the engine animating the bone to compensate for it.
So how do you use this yourself with your Source models? It’s actually pretty simple.
Unfortunately I haven’t yet managed to fully figure out the exact format of the VRD files used or the syntax of embedding the parameters in-line in the QC. However, if your using the Valve Biped for a character or view model animation, you can use the files included in the Source SDK.
First of all, go to the sourcesdk_contenthl2mpmodelsrchumans_sdk folder in your Source SDK installation. In there you’ll find three .VRD files. Pick the one most relevant to the model your making (Male, Female or the “default” Valve Biped) and copy it somewhere your QC file can find it. Next, somewhere in your QC file (after the $seqence defines works well) add the comand $proceduralbones “yourfile.vrd”. Obviously change yourfile.vrd to the file you chose.
And thats it! Compile the model as normal and check it out in HLMV!
As I say, I find this particulary useful for view models where wrist twisting (try saying that fast when your drunk) tends to be a problem. It leaves you free just to animate the main bones and let the Source engine do the rest.
Theres some other tricks you can do with procedural bones such as orientating one bone to always look at another but we’ll cover that another time…
Responses to “Procedural Bones – the Source animators friend”
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.