Adding Facial Expressions to a model?

Again, no one seems to be answering/viewing the “mega thread”, so I’m making a new thread for this.

Are there any tutorials out there to add facial expressions to a custom model (that has none to start with)? I haven’t found any so far.

I’m using Blender if it matters, although I can use XSI if I absolutely must.

Under the mesh tab, there should be a shape keys section. Add a shape key, it should automatically be named basis, then add/edit shape keys after that. The shape key selected is where your changes in edit mode will now go. Edits to the basis are inherited by every other shape key, but the other shape keys don’t affect each other.

Are you adding facial expressions just to be edited from the sliders, or for a player/npc with working lip-syncing?

Well it depends if there’s a VTA exporter for Blender or not. I know there’s one for XSI though.

Do you want to make an HL2 compliant fully flexed model, or just a couple of flexes for taking pictures? If it’s the latter, you can simply use VTA create and save yourself a lot of time. If you’re going with the former, I suggest you use 3DS max, because that is simply the best way to do it.

I also forgot to mention, I uploaded a blend file in the Blender 2.5 thread with shape keys. The face is Zoey from L4D2 with my recreation of her facial expressions.

Here: https://rapidshare.com/files/2957462447/zoey_edit2.blend

As Arby26 said.
It’s incredibly easy to do, but make sure you’re using Blender 2.58 or 2.58a and the latest version of the SMD Tools. It doesn’t work too well on earlier versions.

Thanks for the help. I’m using it for a replacement for a survivor in L4D2, and will be lip syncing to custom lines.

[editline]17th July 2011[/editline]

Okay now I have all the shape keys/flex sliders done. What about compiling it?

Here is my QC File (note that it compiles, but the facial expression don’t work).


$cd "C:\DevDocs\etc\huntress\input_survivor"
$modelname "survivors/survivor_mechanic.mdl"
$model "Mechanic" "hunter" {
//-doesn't work     eyeball righteye ValveBiped.Bip01_Head1 -1.152 -1.027 69.740 eyeball_r 1.000  4.000 mechanic_head_color 0.500
//-doesn't work     eyeball lefteye ValveBiped.Bip01_Head1 1.152 -1.027 69.740 eyeball_l 1.000  -4.000 mechanic_head_color 0.500
     mouth 0 "mouth"  ValveBiped.Bip01_Head1 0.000 1.000 0.000
	 flexfile "expressions.vta"
	 $include "standardflex.qci"
}

#include "facerules.qci"
#include "bodyrules.qci"

$poseparameter body_pitch -90.00 90.00 360.00
$poseparameter body_yaw -90.00 90.00 360.00
$poseparameter head_pitch -90.00 90.00 360.00
$poseparameter head_yaw -90.00 90.00 360.00
$cdmaterials "models\survivors\huntress\"
$cdmaterials "models\survivors\"
$attachment "eyes" "ValveBiped.Bip01_Head1" 2.32 -2.55 0.06 rotate 0.00 -89.37 -90.00
$attachment "mouth" "ValveBiped.Bip01_Head1" 0.76 -5.54 -0.14 rotate -0.00 -80.00 -90.00
$attachment "survivor_light" "ValveBiped.Bip01_Spine2" 5.73 22.92 -0.00 rotate -0.00 -0.00 -0.00
$attachment "forward" "ValveBiped.forward" -0.00 0.00 0.00 rotate 0.00 -0.00 0.00
$attachment "pistol" "ValveBiped.Bip01_R_Thigh" -3.16 1.95 -5.18 rotate -3.66 -0.47 88.48
$attachment "weapon_bone" "ValveBiped.weapon_bone" 0.00 0.00 0.00 rotate 0.00 0.00 -0.00
$attachment "medkit" "ValveBiped.Bip01_Spine4" -1.22 -5.31 -1.25 rotate 5.03 77.16 0.00
$attachment "primary" "ValveBiped.Bip01_Spine4" 2.92 -4.69 -2.50 rotate -13.70 170.19 174.29
$attachment "attach_R_shoulderBladeAim" "ValveBiped.Bip01_Spine4" -10.07 -1.33 -4.85 rotate -90.00 -102.85 0.00
$attachment "attach_L_shoulderBladeAim" "ValveBiped.Bip01_Spine4" -10.07 -1.33 3.36 rotate -90.00 -102.85 0.00
$attachment "melee" "ValveBiped.Bip01_Spine4" 2.61 -5.06 4.98 rotate 24.08 175.37 97.14
$attachment "molotov" "ValveBiped.Bip01_Spine" -3.43 -2.62 7.54 rotate -63.44 -74.67 -101.41
$attachment "grenade" "ValveBiped.Bip01_Spine" -0.73 1.26 8.48 rotate -90.00 -175.23 0.00
$attachment "pills" "ValveBiped.Bip01_Spine" -4.48 3.86 -7.36 rotate -39.75 -103.16 -81.96
$attachment "lfoot" "ValveBiped.Bip01_L_Foot" 0.00 4.78 -0.00 rotate -0.00 -0.00 -0.00
$attachment "rfoot" "ValveBiped.Bip01_R_Foot" 0.00 4.77 0.00 rotate -0.00 0.00 -0.00
$attachment "muzzle_flash" "ValveBiped.Bip01_L_Hand" 0.00 0.00 0.00 rotate 0.00 0.00 -0.00
$attachment "survivor_neck" "ValveBiped.Bip01_Neck1" -0.00 0.00 -0.00 rotate -0.00 0.00 -0.00
$attachment "forward" "ValveBiped.forward" -0.00 0.00 0.00 rotate 0.00 -0.00 0.00
$attachment "bleedout" "ValveBiped.Bip01_Pelvis" 9.07 9.55 4.78 rotate -0.00 0.00 0.00
$attachment "survivor_light" "ValveBiped.Bip01_Spine2" 5.73 22.92 -0.00 rotate -0.00 -0.00 -0.00
$attachment "legL_B" "ValveBiped.attachment_bandage_legL" 0.00 0.00 0.00 rotate -90.00 -90.00 0.00
$attachment "armL_B" "ValveBiped.attachment_bandage_armL" 0.00 0.00 0.00 rotate -90.00 -90.00 0.00
$attachment "armL_T" "ValveBiped.attachment_armL_T" 0.00 0.00 0.00 rotate -90.00 -90.00 0.00
$attachment "armR_T" "ValveBiped.attachment_armR_T" -0.00 0.00 0.00 rotate -90.00 -90.00 0.00
$attachment "armL" "ValveBiped.Bip01_L_Forearm" 0.00 0.00 0.00 rotate -0.00 0.00 0.00
$attachment "legL" "ValveBiped.Bip01_L_Calf" 0.00 0.00 0.00 rotate -0.00 -0.00 -0.00
$attachment "thighL" "ValveBiped.Bip01_L_Thigh" 0.00 0.00 0.00 rotate -0.00 -0.00 -0.00
$attachment "spine" "ValveBiped.Bip01_Spine" 0.00 0.00 0.00 rotate -90.00 -90.00 0.00
$includemodel "survivors/anim_mechanic.mdl"
$includemodel "survivors/anim_gestures.mdl"

$surfaceprop "flesh"
$eyeposition -0.000 0.000 70.000
$illumposition -0.315 -1.427 34.650
$sequence mechanic "mechanic" fps 30.00
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$ikchain rhand ValveBiped.Bip01_R_Hand knee  0.707 0.707 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee  0.707 0.707 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee  0.707 -0.707 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee  0.707 -0.707 0.000
$ikchain ikclip ValveBiped.weapon_bone_Clip knee  0.707 -0.707 0.000
$collisionjoints "phymodel.smd" {

	$mass 100.0
	$inertia 10.00
	$damping 0.05
	$rotdamping 5.00
	$rootbone "valvebiped.bip01_pelvis"
	$jointrotdamping "valvebiped.bip01_pelvis" 3.00

	$jointmassbias "valvebiped.bip01_spine1" 8.00
	$jointconstrain "valvebiped.bip01_spine1" x limit -10.00 10.00 0.00
	$jointconstrain "valvebiped.bip01_spine1" y limit -16.00 16.00 0.00
	$jointconstrain "valvebiped.bip01_spine1" z limit -20.00 30.00 0.00

	$jointmassbias "valvebiped.bip01_spine2" 9.00
	$jointconstrain "valvebiped.bip01_spine2" x limit -10.00 10.00 0.00
	$jointconstrain "valvebiped.bip01_spine2" y limit -10.00 10.00 0.00
	$jointconstrain "valvebiped.bip01_spine2" z limit -20.00 20.00 0.00

	$jointmassbias "valvebiped.bip01_r_clavicle" 4.00
	$jointrotdamping "valvebiped.bip01_r_clavicle" 6.00
	$jointconstrain "valvebiped.bip01_r_clavicle" x limit -15.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_r_clavicle" y limit -10.00 10.00 0.00
	$jointconstrain "valvebiped.bip01_r_clavicle" z limit -0.00 45.00 0.00

	$jointmassbias "valvebiped.bip01_l_clavicle" 4.00
	$jointrotdamping "valvebiped.bip01_l_clavicle" 6.00
	$jointconstrain "valvebiped.bip01_l_clavicle" x limit -15.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_l_clavicle" y limit -10.00 10.00 0.00
	$jointconstrain "valvebiped.bip01_l_clavicle" z limit -0.00 45.00 0.00

	$jointmassbias "valvebiped.bip01_l_upperarm" 5.00
	$jointrotdamping "valvebiped.bip01_l_upperarm" 2.00
	$jointconstrain "valvebiped.bip01_l_upperarm" x limit -15.00 20.00 0.00
	$jointconstrain "valvebiped.bip01_l_upperarm" y limit -40.00 32.00 0.00
	$jointconstrain "valvebiped.bip01_l_upperarm" z limit -80.00 25.00 0.00

	$jointmassbias "valvebiped.bip01_l_forearm" 4.00
	$jointrotdamping "valvebiped.bip01_l_forearm" 4.00
	$jointconstrain "valvebiped.bip01_l_forearm" x limit -40.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_l_forearm" y limit 0.00 0.00 0.00
	$jointconstrain "valvebiped.bip01_l_forearm" z limit -120.00 10.00 0.00

	$jointrotdamping "valvebiped.bip01_l_hand" 1.00
	$jointconstrain "valvebiped.bip01_l_hand" x limit -25.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_l_hand" y limit -35.00 35.00 0.00
	$jointconstrain "valvebiped.bip01_l_hand" z limit -50.00 50.00 0.00

	$jointmassbias "valvebiped.bip01_r_upperarm" 5.00
	$jointrotdamping "valvebiped.bip01_r_upperarm" 2.00
	$jointconstrain "valvebiped.bip01_r_upperarm" x limit -15.00 20.00 0.00
	$jointconstrain "valvebiped.bip01_r_upperarm" y limit -40.00 32.00 0.00
	$jointconstrain "valvebiped.bip01_r_upperarm" z limit -80.00 25.00 0.00

	$jointmassbias "valvebiped.bip01_r_forearm" 4.00
	$jointrotdamping "valvebiped.bip01_r_forearm" 4.00
	$jointconstrain "valvebiped.bip01_r_forearm" x limit -40.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_r_forearm" y limit 0.00 0.00 0.00
	$jointconstrain "valvebiped.bip01_r_forearm" z limit -120.00 10.00 0.00

	$jointrotdamping "valvebiped.bip01_r_hand" 1.00
	$jointconstrain "valvebiped.bip01_r_hand" x limit -25.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_r_hand" y limit -35.00 35.00 0.00
	$jointconstrain "valvebiped.bip01_r_hand" z limit -50.00 50.00 0.00

	$jointmassbias "valvebiped.bip01_r_thigh" 7.00
	$jointrotdamping "valvebiped.bip01_r_thigh" 7.00
	$jointconstrain "valvebiped.bip01_r_thigh" x limit -25.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_r_thigh" y limit -10.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_r_thigh" z limit -55.00 25.00 0.00

	$jointmassbias "valvebiped.bip01_r_calf" 4.00
	$jointconstrain "valvebiped.bip01_r_calf" x limit -10.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_r_calf" y limit -5.00 5.00 0.00
	$jointconstrain "valvebiped.bip01_r_calf" z limit -10.00 115.00 0.00

	$jointrotdamping "valvebiped.bip01_r_foot" 2.00
	$jointconstrain "valvebiped.bip01_r_foot" x limit -20.00 30.00 0.00
	$jointconstrain "valvebiped.bip01_r_foot" y limit -30.00 20.00 0.00
	$jointconstrain "valvebiped.bip01_r_foot" z limit -30.00 50.00 0.00

	$jointmassbias "valvebiped.bip01_l_thigh" 7.00
	$jointrotdamping "valvebiped.bip01_l_thigh" 7.00
	$jointconstrain "valvebiped.bip01_l_thigh" x limit -25.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_l_thigh" y limit -10.00 15.00 0.00
	$jointconstrain "valvebiped.bip01_l_thigh" z limit -55.00 25.00 0.00

	$jointmassbias "valvebiped.bip01_l_calf" 4.00
	$jointconstrain "valvebiped.bip01_l_calf" x limit -10.00 25.00 0.00
	$jointconstrain "valvebiped.bip01_l_calf" y limit -5.00 5.00 0.00
	$jointconstrain "valvebiped.bip01_l_calf" z limit -10.00 115.00 0.00

	$jointrotdamping "valvebiped.bip01_l_foot" 2.00
	$jointconstrain "valvebiped.bip01_l_foot" x limit -20.00 30.00 0.00
	$jointconstrain "valvebiped.bip01_l_foot" y limit -30.00 20.00 0.00
	$jointconstrain "valvebiped.bip01_l_foot" z limit -30.00 50.00 0.00

	$jointmassbias "valvebiped.bip01_head1" 4.00
	$jointrotdamping "valvebiped.bip01_head1" 3.00
	$jointconstrain "valvebiped.bip01_head1" x limit -50.00 50.00 0.00
	$jointconstrain "valvebiped.bip01_head1" y limit -20.00 20.00 0.00
	$jointconstrain "valvebiped.bip01_head1" z limit -26.00 30.00 0.00
}

Also totally unrelated, anyone know of a fix for the messed up right hand?

In the SDK content, there’s QC and QCI files for male six I think. You can easily adapt them for your purposes. Gives you the bonus of perfectly following the valve standard flexes as well.

The L4D2 characters have a few extra sliders from the HL2 qc, and a few sliders have different ranges. You can even omit a few of the standard flexes since I can’t see them in use anywhere on those characters (sneer, the lesser smile, teeth-showing smile, one of the two puckers…). I model 38-ish flexes including four L4D-specific flexes (jaw_right, jaw_left, mouth_sideways_right, mouth_sideways_left, these four just can’t be modeled as two that can be split down the middle either).

Don’t forget to look up eyeballs from the Valve wiki. The tool qc_eyes for setting those up will also set-up the player/npc eyelid flexes (as long as they’re in the right order) to move with the eyes. That’s so when the character looks all the way up, the iris doesn’t roll under the upper eyelid… things like that.

Adding/changing things in the HL2 facerules/standardflex for an L4D2 character is kinda tricky, I can upload my version if you want if you but I’d like to be credited if you use them. They were a huge pain to figure out. I swear, the qc part is far more complex than actually modeling face flexes.

BTW Are you using the proportional edit mode / “soft selection” to model expressions?

That’d be very helpful, and I will of course credit you if you let me use them.

And yes, I’m using proportional edit mode.

Just making sure, I can’t imagine doing facial expressions without proportional edit mode. :slight_smile:

I uploaded the qci files here:
(GameBanana link)