Left 4 Dead 2

Left 4 Dead 2

550 ratings
Custom Playermodels (Proportiontrick & Face Flex)
By мяFunreal
Want to make survivors, common infected and special infected for L4D2? Learn how right here.
8
4
5
12
2
3
2
2
2
2
2
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Foreword
This guide is made to explain how to create playermodels using proportion trick and face flexes.

The core information applies to any model in any source engine game.
Which means this information can be used for any humanoid character in any source engine game.
No matter if you replace Nick, The Hunter, Chell from Portal or Father Grigori from HL2.

Attachments and face flexes will be different for other games, as these are only for l4d2.

Very important note:
L4D2 is going to crash if you have too high detailed models.
Models above ~50k vertices might need to be separated into multiple smd chunks to compile.
Models above ~70k vertices need "$nodecal 1" in vmt's to prevent crashes when pounced.
Models above 100k vertices are going to crash the game if it appears multiple times at once.
Models above 120k vertices will barely compile and crash L4D2 no matter what.

Please for the love of god, don't write comments here if you need help. having to check up on comments multiple times an hour because you want a discussion is annoying.
Please use the Dead 4 Mods discord server[discord.gg] to ask for help in the #modding channel.


Requirements
You need:
Tool
Comment
L4D2 Authoring tools
Specifically HLMV, QC_Eyes, VPK.exe, Starter Kit
Blender[www.blender.org]
Blender SMD Tools[steamreview.org]
Get the one matching to your version of blender
Extremely useful for the "preparing to rig" and Rigging" steps. Effectively cutting those process times right in half.
Works on Blender 4.0 now!
To de-/compile, un-/packing vpk files, and more.
VTFEdit[nemstools.github.io]
Or VTFEdit Reloaded[github.com]
To port textures into the proper format.
I'd reccomend "Reloaded" because it is a bit better.
Contains all other required files for the playermodels.
(ref-poses, attachment helper, declaresequences, anim swap base)

Optional, for if you want the "Old" way of making the proportion pose:
We would previously use this script, but the new way uses blender, and only blender.
Strawberry Perl[www.perl.org]
A programming language just to use the script below.
This perl Script[www.dropbox.com] Made by JazzMcNade
Makes the proportion pose.

This guide works for almost all games, but some things are a little different for other games.
For Garry's Mod:
These files for Face Flexes[drive.google.com] Used for the face flex section. FACS.dmx or FACS_HWM.dmx as source for the face in step 13.01 and also as "Controller source" for step 13.05 Flex_FACS.qci instead of Bodyrules.qci and Facerules.qci in step 13.01
Using another survivors animations
First off, here's is some important information you need to know if you want to use someone elses animations on your model, it is a tutorial written by ZeqMacaw.
If you don't want to use another survivors animations, skip to "Getting Model Files".


He allowed me to pretty much just copypaste his tutorial here.

See, he said so!
Check his website[sites.google.com] for various tutorials. It does have a few dead links from facepunch and L4Dmaps (RIP) though.

Originally posted by Zeq "The Sexy" Macaw:
Say you want an all-woman team of survivors. By following the other sections of this tutorial, you could replace Coach, Ellis, and Nick with a woman each, but each would be using the respective man's animations. Not that bad, but not ideal having a man's animations for a woman.

You could go a step further and rig each woman model to either Zoey's or Rochelle's animations. However, in online multiplayer campaigns, many of the animations will not show correctly. This is actually worse than seeing a man's animations for the woman. The problem is that each survivor's set of animations are listed in a different order in the mdl file, and the server says which animation to play based on this ordering.

I'll give an example to show the problem. Keep in mind this is simply the gist of, and not exactly, what occurs. The server says to each client player, "play Nick's reload shotgun animation", and each client knows this simply by receiving the number "3", meaning "play the third animation". If Nick is replaced by a custom woman using Zoey's animations, then the client will play Zoey's "third animation", which is not the "reload shotgun" animation.

The trick to make the animations show correctly online is to re-order the list of animations in the replacement model's mdl file. For the example, you need to re-order Zoey's animations to be in the same order as Nick's. You do this in the qc file via the $declaresequence command.

Notice that this means you only have to rig a custom model once and can then use a modified qc file to recompile for each of the other survivors.

Follow these steps unless an update to L4D2 causes this process not to work:
  1. Download my specially-prepared Survivor Anim Swap source file pack[drive.google.com]
    (last updated: 03-Jul-2015) containing qci files ready for ease-of-use.
    Included in the "Declaresequence" pack listed in foreword
    NOTE: The files are very good and have been used for many released addons already, but they probably could still use some tweaking to make the conversion the best it can be using this method.
  2. Choose the correct qci file from the pack. For example, if you have rigged a woman custom model using Zoey's skeleton (and thus her animations should be used) and you are using it to replace Louis, then choose this file: "Anims_RigToZoey_ReplaceLouis.qci"
  3. Open the chosen qci file with Notepad++.
  4. Follow the instructions at the top of the chosen qci file.
More information on how to proceed with these files, once it is time to use them again.
For now, unpack the model of the survivors who's animations you want to use in the next step.

IF (and only if) the above declaresequences end up not working, follow tese steps to make new ones yourself
You'll find out if the declaresequences from this "anim hack" won't work at the very end when you test the mod online. If the survivor plays the wrong animation when walking, or healing...

  1. Open Crowbar.
  2. Click the Decompile tab.
  3. Select for "MDL input" the MDL file of the model for which you will rig the custom mesh (call this the "RigTo" model).
  4. Click the "Use Defaults" button.
  5. Tick the "$DeclareSequence QCI file" option.
  6. Click Decompile button.
  7. Open the QC file and look for $includemodel.
  8. For each $includemodel line, decompile the given MDL file with the "$DeclareSequence QCI file" option as done in the steps above.
  9. Combine the $DeclareSequence QCI files into one file, keeping the $declaresequence lines in the same order as the $sequence and $includemodel lines in the first QC file.
  10. Do all of the above again for the MDL file of the model that will be replaced (call this the "Replace" model).
  11. Rename the "Replace" model's combined $DeclareSequence QCI file to "Anims_RigTo<rig_to_name>_Replace<replace_name>.qci" where <rig_to_name> is the character name you are rigging to and <replace_name> is the character name you are replacing.
  12. Open the "Anims_RigTo<rig_to_name>_Replace<replace_name>.qci" file in Notepad++.
  13. Rename each sequence to the equivalent sequence name used in the "RigTo" model's combined $DeclareSequence QCI file.

What this means is that if you want to use replace nick, but with zoeys animation, rig the mesh to zoey. Or whatever models animations you want.

The Declaresequence.qci file you get from this part should be used in step 8.03 instead of the one from the "Required files".
Getting Model Files
The first step is to decide which model you want to replace and then grab the model files so you can begin your work.
If you want to use another player's animations, get their model. You need their armature for their animations
As in; If you replace nick with a model using bills animations, decompile bill.

1.1
Head to the game folders. You can do this by right clicking the game in your library, Select "properties" and in the "Local Files" tab click on "Browse Local Files"


There's a folder called "sdk_content".
Inside of that is a zip file called "Starter_Kits".
That file contains outdated, files used to make the first set of playermodels. Later we will get some files from there. But for now we will continue with the original way of decompiling the required models.
Just letting you know that there's is some sort of source you can look at if you want to.


1.2.1 - Survivors
In this folder open the "Update" Folder.
Open up the pak01_dir.vpk file with either GCFScape or Crowbar.
Survivor models are in: "Models/Survivors"
Their arms are in: "Models/Weapons/Arms"

Survivor Modelnames:
Name
Filenames
Nick
survivor_gambler
Ellis
survivor_mechanic
Rochelle
survivor_producer
Coach
survivor_coach
Bill
survivor_namvet
Louis
survivor_manager
Francis
survivor_biker
survivor_biker_light
Zoey
survivor_teenangst
survivor_teenangst_light

Francis and Zoey have a "Light" model. Their actual models are identical to the default player version, except that they have different animations. Those models are only used for the "The Passing" Intro sequence. You don't really need them, but you should make those anyways.

Bill's Corpse from "The Passing's" last map is in dlc1 - "Models/Survivors/Namvet".
It is a static prop, which you have to make your own pose for.

1.2.2 - Special Infected models
The infected models are stored a bit all over the place.
Here's where to find their models:
Infected
Body vpk folder
Body Location
Arms vpk folder
Arms Location
Boomer
update (Body)
left4dead2 (Gibs)
Models/Infected
Models/Infected/gibs
update
v_models\weapons
Charger
update
Models/Infected
update
weapons\arms
Hunter
update
Models/Infected
update (L4D1)
left4dead2 (L4D2)
v_models\weapons
Jockey
update
Models/Infected
update
weapons\arms
Smoker
update (L4D1)
left4dead2 (L4D2)
Models/Infected
update (L4D1)
left4dead2 (L4D2)
v_models\weapons
Spitter
update
Models/Infected
update
weapons\arms
Tank
update (L4D1 + Train)
left4dead2 (L4D2)
Models/Infected
update
v_models\weapons
Witch
left4dead2_dlc1 (Bride)
left4dead2
Models/Infected
This table is subject to change with any update that changes a model.
Lets say we someday get an update which changes the l4d2 smokers arms.
Those arms would then end up alongside the smokers l4d1 arms in update/pak01_dir.vpk


1.2.3 - Common Infected models
Common infected are all in the Models/Infected folder.
"left4dead2" Contains the L4D2 CI
"DLC1" Contains the wedding CI
"DLC2" Contains the L4D2 variant of the patient and the Surgeon.
"DLC3" Contains outdated L4D1 Infected.
"Update" Contains new L4D1 infected.

Models which contain "_w_" in their name, like "Common_infected_w_Groin" are wounds.
Furthermore, every single CI uses the exact same armature, except the L4D1 Ci.
L4D1 has their jaw bones rotated upwards into the upper lip.
This means you can replace all CI with the exact same SMD, but the L4D1 versions will have their jaws rotated into the upper lip unless you swap armature for those.

1.3.
Locate the model you want to replace.
Put the files in a folder you can work with.

"Anim_" and "Gestures_" files only hold animations. You don't need them.
Decompiling Models
Blender cannot open MDL files, so we need to decompile the MDL, PHY, VVD and VTX files to get a QC file and several SMD files.
Well, there's some tools that can apparently import MDL to blender, but we won't be doing that.

2.1. (Optional)
Open Crowbar - Head to the option tab and assign MDL files to the "Decompile" option.
This will allow you to DoubleClick any MDL file and immediately get to the Crowbar Decompile screen.


2.2.
Decompile your models.
I recommend using the settings I am using here.
Importing To Blender
3.01
Import the Decompiled models into Blender.
If you don't know which of the SMD files you should import: Open the QC file and check the $model line. It tells you which SMD file the actual model is.

It could be possible that a model for some reason has a $model line and further down the QC file it has a $bodygroup line for any additional SMD files.

Import that SMD file of the $model line into Blender.





3.02
Import your custom model into blender

If your custom model is a SMD (gmod or sfm port), you must pick "Make New Armature".
Otherwise your two armatures (skeletons) will mix.


It is possible that your custom model might have a slightly different scale.


In those cases just scale your custom model until it fits the original model.
Generally, making the chin be in similar places is enough. But if your model is proportionally very different (Like a child) just scale it until it seems right.
NEVER SCALE THE ORIGINAL

After you scaled your model to the right size, select it and click "Object - Apply - All Transforms


3.03
If your model has an armature, Delete it.
UNLESS it has special bone locations where you could make jigglebones, or bones that transform the face. In those cases delete every bone but the face and possible jigglebones.
Jigglebones will need to be redone, but you can keep the location for now.
Face bones are VERY useful for face flexes. Keep them for now.



3.04
Head to the material tab.
The names in that box are what will later be the exact names of the materials (VMT files).
You can rename them by double clicking the names.
Delete any file endings from those materials.
Also very important, Each eye needs its own material.
Call one "eyeball_R" and the other "eyeball_L"


Actually eye material names do not matter as long as they are unique for each eye, but calling them eyeball_R and eyeball_L will save you two seconds when doing the eye posing part.
In the entire tutorial you'll see me use "eye_l" and "eye_r". But whilst proofreading I decided to change this up here and add this disclaimer.
Headhacks
"Head hacks" are mods in which the head of the original survivor remains, while the body swaps.
Alternatively, mods in which the face remains default while anything else changes.
These mods will not require new face flexes to be made, skipping the entire "face flex" section.
Although if you do end up changing head location, the eye tracking needs to be redone.

If you are not making a headhack, just skip this section and all steps beginning with "HH"

Examples of headhacks:
https://steamcommunity.com/sharedfiles/filedetails/?id=194962388 Riot officer ellis uses headhack and proportion changes.
https://steamcommunity.com/sharedfiles/filedetails/?id=357667139 https://steamcommunity.com/sharedfiles/filedetails/?id=148452092 https://steamcommunity.com/sharedfiles/filedetails/?id=142692504

HH 1.01
To make a headhack, import the decompiled VTA file onto the SMD file.
Select the original survivor mesh after import, then import the VTA as if it was a SMD.


You'll get a "VTA vertices" object, along with the shape keys.
Delete the VTA vertices object.


You may now change this model in any way shape or form you'd like.
Delete the body to only keep the head and change the clothes, add a hat, glasses or whatever.

You may continue following the guide and change the players proportions if you want.
You may also just go to Preparing to Rig to start rigging your new body if you want to keep proportions default.

The next "Headhack only" step will be "HH 1.02", in "Base QC editing".
Continue along the guide for now.
═══════════════════════════
Proportion Modification 1/2
We'll use Haggets' Armature toolkit to cut our editing time in half
It can create base armatures for us and mirror pose edits from one arm/leg onto the other.
We'll only use the symmetrical editing because we already got the armature in there.
Which means you can put extra care into making one hand fit perfectly, while the tool does the same edits on the other hand. This allows us to edit the armature way quicker.

4.2.01
Duplicate the original model's armature.
You can do this by selecting the armature in the outliner or 3D View, pressing "Shift & D".
This will duplicate your armature, but it will follow your mouse. Just press ESC to reset it to its default position.


As seen in the GIF, the armature will have the same name with a 001 appended to it.
Rename it to whatever you want. Its name is irrelevant.
We're doing this to keep one vanilla armature. should you end up comparing proportions, bone locations or anything of the likes.

From now on, you'll work on the this duped armature and no longer touch the original.
At no point should you ever edit the original armature, because it is a backup.

Keyframe Note
Before we start doing anything on the armature, you should enable "Auto Keying".
Blender uses the arrow keys to advance frames of an animation.
If the pose you build is not saved as a set of keyframes, pressing the arrow keys will advance to an empty frame and undo your entire pose.

Media keys on keyboards (Pause/Play) will not only affect Spotify and Youtube, but also Blender. Blender will start playing your empty keyframes and you lose your progress.

Ctrl+A will also play animations.
If you're used to pressing Ctrl+A to select all files in a folder. Suprise.
Only happened to me at least fifty times :)

In pose mode, enter the "Animation" tab and turn "Auto Keying" on.
This will save every piece of movement as a frame instantly.


4.2.02
Making the duplicated armature fit your custom model.
Our model is a taller and has longer arms, we will need adjust the proportions now.

First enter pose mode on the duped armature.
Select the armature and press this button. Or use the "Shift & Tabulator" hotkey.


Select the entire duped armature by pressing "A", until all bones are orange.
Scale it by Pressing "S" until the shoulders fit your custom model.


Scale origin tip:
Press "Shift & C" so that blenders crosshair goes to the middle of the scene, where your models feet should be.
In the "Pivot Point" Menu you can select "3D Cursor" so that the model scales relative to the 3D cursor.

Doing this will allow you to scale from the feet up, as opposed to the pelvis. So that the feet don't go through the floor.

Without proper Pivot:
(Look at the feet)


With proper Pivot:



Pelvis Warning:
The pelvis should remain roughly in the same area!
The pelvis bone location directly affects the height at which your player model is placed.
If the pelvis remains at default location but your legs are too short, the legs will be fully extended while standing but never touch the floor.
If your legs were too long, they'll sink into the floor.

Lowering or raising the pelvis bone to compensate will make the feet connect with the floor properly, but the model's crouch and incap height will also be affected by the same amount.
(Incap height has a fix, as seen later in the guide. So it isn't that bad)

Instead of raising and lowering the pelvis to compensate for floating or sinking legs, you should consider scaling the entire model so the pelvis stays where it should be and make the feet match location of the original model.

If that is just not possible because your model is either a giant or a little garden gnome, you will simply have to deal with the fact that your model will behave weirdly at all times.


I'd recommend you to now turn on your movement gizmos, if you had turned them off.
As you can see, the crosshair with the three arrows on it is tilted. It uses the local axis of the selected bone.



The pelvis and spine should be in the proper location already.

If they aren't, make sure the pelvis is where it needs to be and then move up the spine.

until it fitts.


4.2.03
Once the shoulder location matches, move bones from the pelvis away.
So first the thighs, knees, feet, toes, clavicle, shoulders...

For that we'll use Hagget's tools to edit both sides at once.
Select the armature and go to its Object Tab, then expand the Armature Toolkit Section.

Pick the armature you had just modified.

Then the Add Symmetry constrain button.


Depending on whether you picked Left or Right, one side will mirror its action to the other.



Deleting Useless bones
Francis has vest jigglebones, Zoey has hair jigglebones...
There's no point in moving them around at all because you have no use for those.


You can also delete all "attach" bones, weapon bones and the forward bone on the face.
We will add them later again using $definebone lines.
Deleting attachment and weapon bones is optional, yet seems to yield better results.

Note: Deleting the weapon bones is easier for the next few steps. However, the guns could end up being misaligned. That can be fixed when you're done with the player, but its extra steps. Would be worth it to delete them for now, just so you can put extra care in fixing it when we're done.
I myself delete the weapon bones at this time.

Bones like Wrist, Elbow, Knee, Zoey's Glute and maybe other special bones in bendy places are helper bones. Those fix up some rotation issues.
You should keep those, with possible exception of the glute. At least i never needed that one.


4.2.04
Start putting the bones where you want them.

But remember:
You must rotate the parent bones to get the child bones to where you want them.
You are only allowed to move a bone along the direct axis it has to its parent! (Usually X)
Else the Proportion pose will break and your body parts may end up twisting, because the rotation between parent and child is no longer the same.


Example:
I need to move the knees, so I rotate the thighs and then move the knees closer to the thighs, on the X axis, instead of just moving the knee bones.
This Gif is recycled, so the bones are not colored.


Then do the arms

4.2.05
The hands are a beast in their own right.
Just move the hand bone and its wrist bone close to where your custom mesh has its wrist.
But only by moving away from the forearm on one single axis.
Just like you had moved the elbow and knees.


Do not rotate the hand bones too much. The weapon bones depend on them!
You may end up with guns that float next to the hands.
Proportion Modification 2/2
Ran out of space again

4.2.06
After you did the hand bones, you're ready for the worst thing since sliced bread: Finger bones!
Doing those is often a chore, but if you're careful you won't have any issues.

I'd recommend first selecting all finger bones on both hands in pose mode.
Then enter "Edit mode". All selected fingers will still be selected. Don't be alarmed when the pose changes back to default. That's normal for edit mode with a non-applied pose.

In here you will scale the finger bones down just so that posing them is easier, because otherwise you'd have large round spheres in your way of seeing the hand.
You should still have "Pivot Point" set to "Individual Origins". Then just press S and scale the bones down. I like to just scale it to 0.25.


Then exit back to pose mode and you'll have smaller spheres!


Now to actually pose them.
You need to switch back and forth between all views to nudge those bastards until they're in the correct spot.
First the front

Then from the top

Until you're reasonably happy with the results.
This work is tedious and you might need to fix it later because that's just how it is.
Even experienced modders got to fix fingers, even though they know how it would work.


4.2.07
The Yellow bones are helper bones. Make sure they are in a spot where they can help you.
Helper bones allow a piece of mesh to move depending on how much another moves.
i:e: It calculates how much the wrist rotates, if the hand rotates by X amount of Degrees.


4.2.08
Eventually, your entire armature is posed.


Now that all available bones are posed, save this pose as a new rest pose.
This will save the pose you made as the new default.
The "Apply" button on the Armature toolkit should also work, but its a bit buggy on 2.8

Remove the symmetry setup by clicking "Remove" in the toolkit


Once the pose is applied, delete animation keyframes that you may have leftover.
Leftover keyframes mess up your pose cause it re-applies the keyframes to your new pose.
Preparing to Rig
Thanks to Hagget's Armature Toolkit this step takes like five seconds.
Without the tool, it would take half a damn hour sometimes.
There's still a little bit of editing we have to do though.

5.2.01
In the Armature Toolkit Section, scroll down to the "Weight Armature" part.


Click the Generate button.
You'll get a new armature that has ".weight" appended to the name.


Best of all, it has 99.99% of the crap done for you.

This Armature is now ALMOST in perfect shape to auto-rig the weights for you.
We're Doing automatic weights because it helps you out so much. But even then, you must manually fix some spots.

5.2.02
We need to do some tweaking.
From personal experience, moving the "Thick end" of the leg bones just under the crotch,
while moving the "thick end" of the pelvis just above the crotch yields better rigging results.
This will cause the thigh bones to not affect the hip as much.

In the image below you can see bones that are highlighted orange are where the bones in the default armature are, that i just proportionally modified.
You can also see where my leg bones and pelvis bone bases are in the "Weight" armature.


Here is a GIF of just how much the thighs would affect if you would not do this:
The hips cave in like I cave in on a dessert buffet.


And here is a GIF showing how little the thighs affect if you do move those bones further down:
I later realized that the thighs and pelvis could've gone down even more.
The thigh bones should barely affect the hip. Buts it's an easy Weight paint fix.


5.2.03
I would also pull the tip of the knee bones further ahead.
From this

To this


All "End" bones like Toes, and fingers must point towards the end of the mesh it is supposed to rig.
The toolkit doesn't do always to that for you.


5.2.04
If you have (or want to have) extra bones that need to be added (Face, Jiggle, Helper), now would be the time to deal with those.
If you don't have any extra bones, skip to 6.2.1.

in step 3.03 we deleted all the extra bones except face, possible jiggle and helpers.
If your leftover armature of the custom model both has face bones and the face is still rigged, we will keep the facial rigging.

Duplicate the armature from step 3.03 with the custom bones.
In one of those two armatures, delete the face bones.
The one without the face bones will be merged to the .weight armature.
The one with the face bones will be merged to the other armature.


You could pretty much keep the position for most jiggle and helper bones, but sometimes you may need to move them.

If you want to add jigglebones, I'd reccomend you to take a look at this guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=3219785194

You now have all the bones in both armatures. default and .weight
The .weight armature should not have face bones IF your face is already rigged.


5.2.05
Now you gotta manually set up the parenting those Extra bones in both armatures.
For now, go to the armature that you'll eventually export your model with. (not .weight!)
First, parent them in edit mode to the closest or most sensical real bone.
For example, the breasts would go to Spine 4


If you got a bone with multiple children, where deleting said bone would give you a lot of "Orphans", (like my head bone with the face bones as children) make that bone a child of whatever makes most sense and then delete it.
This will reparent all those bones to whatever bone is next in the hierachy.

example:
In this gif the parent of all the face bones called "bip01_head"
It has been made a child of the "ValveBiped.Bip01_Head1" bone.
When i delete "bip01_head" all face bones take"ValveBiped.Bip01_Head1" as their new parent.


5.2.06
Select the .weight armature and enter edit mode.
Do the same parenting thing that you did in the other armature,
Then, position the very tip of the last bone in a chain to where it's weight should go to.
Just like you did with the toe.


Set "Pivot Point" to "3D Cursor" Shortcut is "." (Fullstop, next to comma)
Select the base the bone you just positioned
Press "Shift & S" and then "Cursor to Selected".
The 3D Cursor will now be at the base of that bone.
Select the tip of its parent, press "S" to scale it and then press 0 (Number Zero).
The tip of the parent bone will now connect to the base of its child.


Now all default player bones and your own extra jigglebones are part of the armatures.
Sorry it had to be this way.
Rig, Check Rigging & Export
6.2.1
Just as a precaution, duplicate your custom model and suffix those with _Orig and _Rig as well.

If you have face bones and your model's face is already rigged, detach the head by entering edit mode on the model, selecting the head and pressing P to separate the selected mesh out into a new model.
It's best to do this from adam's apple upwards.
Or if your model has a choker, or another physical disconnection between head and body somewhere on the neck itself, use that as a barrier of what gets separated.
Use wireframe mode to select the entire head, mouth interior included.

We'll merge back together after the rigging, before we fix the weights.

Also, if your body was already rigged to any armature at all, delete all its vertex groups now.


6.2.2
Now the actual rigging can begin!
Select your mesh. (If you have a rigged face, use the body without the head)
Hold "Shift" and click on the .weight armature in 3d View, Object mode.
Press Ctrl & P
Pick "With Automatic Weights".
Blender will pause for about two seconds while it rigs the mesh for you.

After it's rigged, re-parent your model back to the previous armature.
Do that by just dragging the mesh onto the other armature while holding "Shift".


6.2.31
In the mesh modifier tab, swap the armature to the one you you dragged the mesh back onto.
It must only have one single armature modifier.


6.2.32
if you had previously detached the head from the body to keep the face rigging, you can now merge the head back onto the body.


6.2.4
Enter pose mode on the original armature and rotate bones to check the rig on your mesh.
Some spots probably need to be fixed.


In those cases pose the bone to the point where you can see the obvious mistakes.
Select the mesh and enter "Weight Paint" mode.

By the way, if you think you could just import the original game animations and use those to check the rigging; You can't.
You modified the proportions of your model. It will look stretched.
Here's an image of how original Zoey animations look like on the proportionally different Harley model.


Moving on.

I won't go into the details of weightpainting, but I'll explain the basics.
In weight paint mode your model will be blue for parts that are not rigged to anything and red when something is 100% rigged to the selected bone.
The heavier it is weighted to a bone, the more influence that bone will have over your model.

In the 3 minute long video below you can see how I use the "Subtract" and "Add" brush in weight paint mode to remove and add weights to the jiggle part of the hat.
Notice how I go back and forth between two bones to remove weights from one bone and add weights to the other.
I recommend watching it in full screen. The video is real time as well.

THIS would be the time to re-rig that head you had detached entirely to the head bone with a small gradient on the neck bone. Luckily the head is simple this way.

6.6 (Optional)
Jigglebones that practically lay on top of the actual body (such as Louis' tie or Harley's necklace), might also be rigged incorrectly.

Fixing such instances where one piece of mesh shouldn't be rigged to another bone at all can be fixed quickly and easily.

Enter edit mode on the mesh.
In "Vertex Group" select a bone and click the "select button.
Blender will select anything that is rigged to the selected bone.


There's a bunch of body rigged to the jigglebone. That's not what we want.
To remove the body from the jigglebone, select the mesh you want to un-rig.
Sometimes you can hover over a mesh and hit "L".
This will select all linked mesh.
On the lower left hand side you'll get a window which allows you to pick what linked mesh you want to select. Usually "UV" is a good option. If not, just manually select it.


In "Vertex Group" hit the "Remove" button to delete all weights of the selected mesh from the selected bone.



In the GIF above you can see me selecting the jigglebone to check what is weighted to it.
I then select the body I want to unrig from the jigglebone and hit the "remove" button.
Afterwards I select the jigglebone again to see if it was removed correctly.

If your model has gaps like these its because you had vertices touching, but they weren't merged.


You can fix that by entering edit mode and selecting both edges, pressing "Alt & M" and picking "By Distance"


Fixing the entire rigging will probably take you a while. Just modify it until you think its right.
I myself have been fine tuning this model for about two hours before I even compiled it.

6.7
Once you are reasonably happy with the rigging, you may export your model as a SMD to the same folder where your qc file is.
Headhacks (or any meshes with shape keys) will also export a VTA file of the same name.
═══════════════════════════
Base QC editing
7.01
Open your QC file.
The $modelname line at the top defines the models location and name.
Duplicate it, comment out the original and change the location/name to use that in HLMV.
Otherwise it'll load the original model from the pak01_dir.vpk
I prefer to swap all folders with an "!"


The $Model line decides what local name it has, which mesh to use, and info about face flexes.
The "local" name is irrelevant. Only bodygroups would ever make use of it.

HH 1.02
For a headhack, swap the SMD and VTA files with yours, but don't edit any of flex rules.
then skip to step 7.03 for the LOD.


7.02
For a fully custom model, swap the SMD and VTA files with yours, comment out the eye lines and delete the flexfile lines.
We'll do face flexes later. For now we'll just get the model to compile at all.

You'll end up with just the $model line and commented out eye and mouth lines.
Those will later be used for the face flexes.
If you don't want any face flexes, just delete the eye, mouth lines and the { } as well.


7.03 (optional)
The next lines will be "Level Of Detail" lines.
They're used for model optimization for far distances. Either by swapping the model with a less detailed version, not rendering bone movement or ignoring face flexes.

Delete the "replacemodel" line, unless you made a less detailed version of your model to use.
Disabling face flexes and collapsing bone-trees is enough.

Here's more info on LOD's

Note: Every "Replacemodel" SMD adds to the max triscount. Which looms at around 110k tris.
Therefore; adding replacemodels to swap a super high detail model with a lower detail model might just break your mod entirely.

For playermode, this LOD setup is fine.
$lod 10 { bonetreecollapse "ValveBiped.Bip01_L_Finger01" bonetreecollapse "ValveBiped.Bip01_L_Finger11" bonetreecollapse "ValveBiped.Bip01_L_Finger21" bonetreecollapse "ValveBiped.Bip01_L_Finger31" bonetreecollapse "ValveBiped.Bip01_L_Finger41" bonetreecollapse "ValveBiped.Bip01_R_Finger01" bonetreecollapse "ValveBiped.Bip01_R_Finger11" bonetreecollapse "ValveBiped.Bip01_R_Finger21" bonetreecollapse "ValveBiped.Bip01_R_Finger31" bonetreecollapse "ValveBiped.Bip01_R_Finger41" } $lod 15 { bonetreecollapse "ValveBiped.Bip01_L_Finger2" bonetreecollapse "ValveBiped.Bip01_L_Finger1" bonetreecollapse "ValveBiped.Bip01_L_Finger0" bonetreecollapse "ValveBiped.Bip01_L_Finger31" bonetreecollapse "ValveBiped.Bip01_L_Finger41" bonetreecollapse "ValveBiped.Bip01_R_Finger2" bonetreecollapse "ValveBiped.Bip01_R_Finger1" bonetreecollapse "ValveBiped.Bip01_R_Finger0" bonetreecollapse "ValveBiped.Bip01_R_Finger31" bonetreecollapse "ValveBiped.Bip01_R_Finger41" } $lod 40 { bonetreecollapse "ValveBiped.Bip01_Head1" replacebone "ValveBiped.Bip01_Neck1" "ValveBiped.Bip01_Spine4" bonetreecollapse "ValveBiped.Bip01_L_Forearm" bonetreecollapse "ValveBiped.Bip01_R_Forearm" bonetreecollapse "ValveBiped.Bip01_L_Calf" bonetreecollapse "ValveBiped.Bip01_R_Calf" replacebone "ValveBiped.Bip01_L_Clavicle" "ValveBiped.Bip01_Spine4" replacebone "ValveBiped.Bip01_R_Clavicle" "ValveBiped.Bip01_Spine4" replacebone "ValveBiped.Bip01_Spine1" "ValveBiped.Bip01_Spine2" replacebone "ValveBiped.Bip01_Spine" "ValveBiped.Bip01_Pelvis" bonetreecollapse "ValveBiped.weapon_bone" nofacial }

7.04
Only for modified proportions. Skip to step 7.05 if you have not modified proportions.
Delete all $bonemerge lines.
Open your model smd in notepad++.
You'll be able to see all bone names. Copy them into a new empty file.

Press "Ctrl & H"
Make sure "Regular Expression" is turned on
Find ^\s*\d+\s*"(.+)"\s*-?\d+\s*$
Replace with $bonemerge "\1"

This will turn your bone list into $bonemerge lines.


Save this as "!Bonemerge.qci" Next to your QC file.


In your QC file add "$include !bonemerge.qci" Where your bonemerges were.
This will include all the info from that qci file into your qc file, without having to paste all those lines right into your qc file.

7.05
Scroll down to the $CDMaterials line.
This line decides where the materials of your model are.
Pick any location you want. Just make sure the folder tree ends with /.

7.06
Right below $CDMaterials is the $TextureGroup block.
This is only used to swap normal textures for "Covered in vomit" versions.

There's two ways of making textures that can be covered in vomit.
You can either:
  • Do it like valve and make use of texturegroups to use a completely different VMT for vomit overlays
  • make one single material capable of switching to vomit overlay, not needing to make a separate _IT material and therefore upping your material count. (Max is 32 materials)
    If your materials make use of $detail textures, you must use _it materials.

Note:
It would be good to do it like Valve so that you, or reskinners, could fall back on dedicated _IT materials if they would be required.
If you do not want to have dedicated _IT materials for your mod or reskins, skip this step.
You cannot add these lines but refuse use _it materials. You'll get Missing Textures if you do that.

If you want to do it like Valve:
Make one line which contains all materials that should be able to have the vomit overlay.
Those are usually all materials, except for the eyes.
Valve doesn't let vomit cover hair, but you should. Looks out of place if hair is miraculously clean.

Duplicate the line and add "_it" to all materials.

More info on how to actually make these textures in step 10.061

If you do not want dedicated _IT materials, step 10.062 explains how to do this.

7.07
Scroll down to the jigglebone lines, if your decompiled survivor had any.
Either delete them if you got no use for them, or change/replace them with new ones.

Tee Jigglebone guide i mentioned a while ago holds info on what kind of jigglebone presets you could use, or you can make up your own.

7.08
Scroll to the very bottom of your QC file. You'll see a $CollisionJoints block.
Survivor replacements (and infected) shouldn't use different collision information because that could lead to errors and even crashes. So just delete the entire block.


This block is responsible for the .phy file. So now you won't get that file when you compile your model, making the game use the original.
$Definebones
Look for the $Definebone lines. Those will override the bone location and rotation.
Since you moved all bones in blender, every $definebone line is now out of date.
this may cause issues down the line.

We can either generate a new block of definebone lines which takes about three minutes to set up, and a few second to generate, or we can use the super short way of using one single command to skip all of that junk.

Fast approach:
Above all $definebone lines, simply add the following command: $UnlockDefineBones.


This command makes the definebones keep its order (which is important) but it will update the actual location of all bones based on whichever unique smd has been used last in the entire qc.

I would recommend moving your $model lines to the very bottom of the qc, below the proportion pose lines that will come later. Because the new ref pose you get will be based on whatever that last smd/dmx uses.
You do not want it to be based on the subtracted proportion pose. Trust me.


Slow approach:
Really just ignore this please. i'm keeping it here for legacy reasons.

We will keep the "Attach.....", "Forward" and all "Weapon" bones, because we deleted the actual bones in the model in step 4.2.10
All other lines must go.

Keeping the attachment, forward and weapon bone definebones makes sure that those bones are still in the proper location in relation to their parent bones.


Make a brand new qc file called "!Making_Definebones.qc"
The only things inside that qc file is:
  • A $model line with your model. Or one of your smd's if you have multiple
  • A $sequence line also using your model as animation
  • The "$include !bonemerge.qci" line you just made.
Yes, really. Only those three things. Not even a modelname line.

The first "body_1" on the $model and $sequence line are just internal and irrelevant names.
The second "body_1" is your actual model.


Drag that QC file onto crowbar.
In the compile tab, pick the $DefineBones option and its QCI option.
Call the file "!definebones"



Press the Compile button.
Instead of a model you will get a qci file containing the new $Definebone lines.
Afterwards disable the $definebone option in crowbar again, before you compile your actual model later.

Open your actual model qc file and paste "$include !definebones.qci" above your remaining definebone lines.


Now you got definebones that are fresh and 100% based on your model.
Every time you modify the armature even just a little bit, you gotta redo these definebones.
Proportion Pose Creation (Blender)
If you do not want custom proportions, skip to Procedural Bones (HelperBones)
In this step we will generate that pose we need to make our custom proportions work.
Instead of the perl script, we'll use blender. Its faster and does not require installing perl.

8.1.00 - Non-L4D2 only
In the next step you're going to use a Ref-Pose_***.smd file from my L4D2 prefab.
But if you're modding Gmod (or any other game), you don't have these files in the prefab, yet.
To make such a Ref-Pose_***.smd file, make a copy of your decompiled playermodel, open it as a text file with notepad++ and delete literally the entire Triangles section completely.


8.1.01
You downloaded a Githup repo. It has a folder called Refpose_Pack_For_proportion.
Inside of it are a few Ref-Pose_***.smd files.

Select the armature of your player and import the Ref-pose of whatever player you're doing.
Import it with "Append To Target".


Your playermodel will look real strange for a second. Don't worry about it.


8.1.02
Open the animations tab and move the keyframes of this imported pose to Frame 1
They currently are on Frame 0, but they must be on Frame 1.
Hover over the list on the left, press A, then G, 1 and Enter.
This selects all keyframes and moves them one frame.


8.1.03
Move your cursor back to Frame 0.


In pose mode, select all bones and clear locational transforms. Only location!


Press i and insert new keyframes for Location & Rotation.


You now have the proportional pose required for the qc file.
Assuming you actually did the posing of the armature correct to begin with.


8.1.04
Rename this pose to "Proportion" and export it.


After exporting, you can either keep or delete the this pose.
DO NOT APPLY THIS POSE!

I just unlink this animation with this button below, and then clear all transforms on all bones.


Now we just made the same pose that the perl script would give us.
Pretty cool, huh? All without installing a programming language.

DeclareSequence Info
For games other than L4D2:
Find the used "includemodel" mdl and decompile it with only the Declaresequence option to get your required declaresequence files.
If you have multiple used includemodels, decomile all of them and use the declaresequence.qci's in the same order as their respective includemodel's are listed.
Gmod doesn't even need one. All proportion changes come first, before the includemodel.

Usually, i would tell you to do the following:
Open the DeclareSequence.qci and delete or comment all $DeclareSequence lines from the top to, and with, the Ragdoll Line.
Most survivors only have two lines, but Francis and Louis have more.
But the DeclareSequence files in my GitHup Repo are already been modified as such.
Except for francis and louis, because i made something special for them. More about that later.

For Common Infected:
You must list the DeclareSequence.qci files in the order as their respective includemodels.


The Declaresequence is required to force the $includemodel sequences to be loaded before our proportion changing sequences (which we'll add shortly).
Not doing this will cause the sequence order to be offset by two sequences, causing animations to be broken in online games. Such as seeing the "charger carry" sequence when walking.
It is of immense importance not to mess this up!

8.1.05
Take the fitting DeclareSequence.qci file from the downloaded Github Repo and put it into the same folder as your QC and SMD/DMX files.
Either the "***_$DeclareSequence.qci" from the Declaresequence_Survivors/Infected folder.

Or if you want to use another players anims (or port a mod to another player) use the "Anims_RigTo***_Replace***.qci" from the "Declaresequence_Anim_Swap" folder.

Open your QC file again and scroll to the bottom.

Add the following lines:
$include ****_$DeclareSequence.qci
$sequence Proportion_Trick anims/Proportion.smd delta subtract Proportion_Trick 1 numframes 1 autoplay noautoik
Replace the ****_$DeclareSequence.qci in the block with whatever qci you want to use.
Proportion Pose Creation (Perl)
If you do not want custom proportions, skip to Procedural Bones (HelperBones)
This is the "old" version using the Perl script. For when you do not want to use blender.
But really. Use blender...

8.2.01
Drop the "ReferenceCreator.pl" in the same folder as your QC and SMD files.
I recommend adding a ! to the filename beginning, so that it will alphabetically be at the top of all files.

You can optionally open the .pl file in a text editor and change what filename it will generate.
This isn't required, but I like it this way.


8.2.02
Open a new file in Notepad++ (or whatever notepad you use) and paste the following lines:
Perl !referenceCreator.pl default.smd custom.smd quit
Swap "default.smd" with the smd of the original model, from the base game.
Or whatever model has the armature that you are using for this mod.
If you replace bill with a model using nick's bones, use nick's smd.


Swap "custom.smd" for your model.
If you got several SMD's making up your model, pick any of those SMD's.

Also note that I have the leading "!" in referenceCreator.pl, because i renamed the file.
Save this as "!Modify_Bone_Rotations.bat".
Make sure "All Types (*.*)" is selected when saving.

This bat file will trigger the Perl script to run, which then builds a pose for your proportion sequence.
Run the bat file now. You also need to run it anytime you change bone rotations.
DO NOT CLOSE THE WINDOW! It closes itself when it is done.

DeclareSequence Info
For games other than L4D2:
Find the used "includemodel" mdl and decompile it with only the Declaresequence option to get your required declaresequence files.
If you have multiple used includemodels, decomile all of them and use the declaresequence.qci's in the same order as their respective includemodel's are listed.
Gmod doesn't even need one. All proportion changes come first, before the includemodel.

Usually, i would tell you to do the following:
Open the DeclareSequence.qci and delete or comment all $DeclareSequence lines from the top to, and with, the Ragdoll Line.
Most survivors only have two lines, but Francis and Louis have more.
But the DeclareSequence files in my GitHup Repo are already been modified as such.
Except for francis and louis, because i made something special for them. More about that later.

For Common Infected:
You must list the DeclareSequence.qci files in the order as their respective includemodels.


The Declaresequence is required to force the $includemodel sequences to be loaded before our proportion changing sequences (which we'll add shortly).
Not doing this will cause the sequence order to be offset by two sequences, causing animations to be broken in online games. Such as seeing the "charger carry" sequence when walking.
It is of immense importance not to mess this up!

8.2.03
Take the fitting DeclareSequence.qci file from the downloaded Github Repo and put it into the same folder as your QC and SMD/DMX files.
Either the "***_$DeclareSequence.qci" from the Declaresequence_Survivors/Infected folder.

Or if you want to use another players anims (or port a mod to another player) use the "Anims_RigTo***_Replace***.qci" from the "Declaresequence_Anim_Swap" folder.

8.2.04
Open your QC file again and scroll to the bottom.

Add the following lines:
$include declaresequence_here.qci $sequence reference output $animation a_proportions model_smd_here subtract "reference" 0 frames 0 0 $sequence !!!_proportions a_proportions predelta autoplay
Swap "declaresequence_here" with your declaresequence
Swap "output" in the second line with whatever you called the output file in step 8.2.01, if you decided to rename it.
Swap "model_smd_here" in the third line with your exported model.
The proportions sequence starts with !!!_ so that you can find it easier in SFM, because in SFM sequences are alphabetically ordered.

note: "frames 0 0" is there to stop any keyframes in the proportion pose from affecting the model.
For Louis and Francis
in "Proportion Pose Creation", i mentioned i made something special for Louis and Francis.
Those two guys got a few of their anims inside their own models. Which means, they already contain a whole awful lot of $declaresequence lines.

If you want, check out the folder "New_Includemodels" from that downloaded Github Repo.
That folder contains "anim_biker_new.mdl" and "anim_manager_new.mdl".

If you use these mdl files as $includemodel, you're able to delete all $declaresequence, $animation, $sequence and $includemodel lines inside the qc file, and use the same setup as all other players.


Do not forget to ship that file alongside your survivor_biker.mdl or survivor_manager.mdl!


Procedural Bones (HelperBones)
Models without custom proportions, may not need modified procedural bones.
If you're making a headhack, you may skip ahead to 1st Compile & materials.


Procedural bones are the best thing since the other best thing since sliced bread.

They help to move parts of the model without those bones being animated themselves.
For example: The animations in L4D2 only rotate the hand bone into what position it should be.
Then the procedural wrist and ulna bone figure out in what way they need to move so that the model looks good.


You could make entirely new procedural bones, or modify the existing VRD file.
Making new ones is useful to make sure your specific arms will look good, or when you need to add more bones for coats, skirts or other things.

Follow either the guide in step 9.0 and then skip ahead, or follow the rest of this section.

9.0 Procedurals From Scratch (Recommended)
This guide explains how to make Procedurals from scratch.
https://steamcommunity.com/sharedfiles/filedetails/?id=2415253996

9.01 Procedurals by Editing Original VRD
Since we are replacing existing models in L4D2 which have procedurals already set up, we will just change those existing ones.

The following information is taken from MSF's guide, but explained in a more concise fashion.
If you want to read MSF original guide, look here:
https://steamcommunity.com/sharedfiles/filedetails/?id=887935033

You decompiled the original survivor and got a .vrd file.
Open both the VRD and your own models SMD file in Notepad++

First, change the last three numbers of every <trigger> to 0 inside the VRD.
Of course only for the helper bones you are actually using.


Those last three numbers are "Transitional values". For when the Helper bone would move to a different location. But keeping the movement value will mess up the proportions we got, because all bones are moved to a completely different location already by our proportion changes.

9.02
I recommend you to move one of the two files to the "other view" to be able to see both files.



The first bone name in the <helper> line is the name of the helper bone.


Look for that bone name in your models SMD file.
You can see the number 6 on the very left of that line.
Meaning it is bone nr.6. Your numbers may vary.


Scroll down in the SMD file to the "skeleton" part.
Look for the one line that also starts with the number your bone had.
That line is the bone location information.

Copy the first three numbers over to the <basepos> of that bone.


Do that for every helper bone you had used.


1st Compile & materials
Before you compile anything I would very strongly recommend you to create a new content folder for l4d2, to separate custom content from original content.

Learn how to do this here:
https://steamcommunity.com/sharedfiles/filedetails/?id=1507939076

10.01
Drag the qc file onto crowbar. This should automatically open the "Compile" tab.
In that tab, make sure it compiles for the correct game.



10.02
If you used a custom modelname line, you will now be able to open the model in HLMV.
Click "File - Load Model" and then search your model.
It will be pink and black. That's Source Engines way of telling you that it's unable to find/load textures.


Go to the "Sequence" tab and select a few animations to see if the model works and looks okay.

10.03
Now is a good time to make basic materials so that you at least have some textures show up in HLMV. Easier to see clipping issues this way.

Make a "Root" folder in the same folder where the QC and SMD files are.
Or go one folder out of that and make one.
This Root folder will later end up being the addon itself. Give it any name you want.
I'm making Harley Quinn for Zoey, so I'll call my "root" folder "Surv_Zoey_Harley_Quinn".
Inside the root create a "Materials" folder.
Inside that materials folder, build whatever folder tree you had chosen in the qc's $cdmaterials line.


The reason we're starting this root folder now is so that the textures will already be packed in the right spot.
I'd suggest naming the textures to whatever material name you had chosen in blender before you even convert them to vtf. For the eyes you'll only need one texture, since both eye materials can use the same texture.

For Common Infected:
Common Infected have special materials, because they use a funky color system.
This guide explains how those textures are set up. If you are not making a CI, ignore this.
https://steamcommunity.com/sharedfiles/filedetails/?id=1567031703

10.04
Speaking of eyes, decide what to do with those.
You could keep using the original player eye textures, so that "custom eye" mods are compatible.
But if you want an accurate port of your model, you'd need to port its eye textures too.

Important is just that eyes must be a separate texture with nothing but the eyeball on it.

If you want to port your eye textures:
Open your eye texture in an image editing program.
Import one of the original eye textures, which can be found in "materials\models\survivors"
As you can see in the GIF below, my iris is as large as the pupil is. Scale it to match.


Not mathcing scale causes this weird sperical line to appear on the eyes.


10.05
Open VTFEdit.
You can convert an entire folder worth of textures to VTF.
Click "Tools - Convert Folder" and pick an input folder, output folder and from what filetype it should convert to VTF.
You can also pick the "Create VMT Files" option.
When set up, click the "Convert" button and wait for it to finish.


Once finished, visit the folder where the files appeared.


Open all VMT files and change the shader from "LightmappedGeneric" to "VertexLitGeneric".
Just drag all of the vmt files onto Notepad++ and use its replace feature to replace "LightmappedGeneric" in all files at once.

While you're at it, If your model is replacing the Witch, add $allowdiffusemodulation 0 to all of her VMT files. Else the game turns her a funny color because she runs on the same "coloring" setup as all the CI

Note:
Super high poly models may crash the game when pounced by hunters.
Adding $nodecal 1 to the vmt files will prevent those crashes.

Decals spawn on separate meshes distanced from the model to prevent Z-fighting[en.wikipedia.org].
Those "decal meshes" have the same tris count as the mesh they are landing on, upping the triscount. Every decal seems to have its own "decal mesh" to up the triscount even more.

Another fix:
Add a low polygon body over the highpoly, turn it invisible and allow it to show decals.

Open your eye materials and swap it entirely with this one
EyeRefract { $Iris "models/survivors/brown_iris" //YOUR EYE TEXTURE HERE //Change NOTHING below this point. Removing some things can break the eyes entirely. $AmbientOcclTexture "models/survivors/survivor_eye_ao" $Envmap "Engine/eye-reflection-cubemap-" $CorneaTexture "Engine/eye-cornea" $EyeballRadius "0.5" $AmbientOcclColor "[.4 .4 .4]" $Dilation ".5" $ParallaxStrength "0.25" $CorneaBumpStrength ".5" $halflambert 1 $nodecal 1 $ambientocclusion 1 $RaytraceSphere 1 $SphereTexkillCombo 0 }

Textures will only show on one side of the mesh, but some things like hair or sunglasses would need texture on both side of the mesh. This can be done without adding mesh to the other side. Just adding "$Nocull 1" to the VMT file is all you need.

Note:
This does not render the texture on both sides with their own shadows and decals (bulletholes)
It only lets you see through the usually invisible backside and see the other side, like a window.
Any shadow and decal on the front will be seen on its back aswell.

10.06
Survivors can be covered in boomer bile, this bile overlay (by default) requires a new material file.
As explained in Step 7.06, you can do it with one VMT file, or two.

10.061 - using dedicated _IT material
In Step 7.06 you have made texturegroups that define _it materials. Duplicate every material that needs an _IT counterpart and rename them accordingly. Add a second } on a new line at the very end of the _IT VMT. Swap the "Vertexlitgeneric" with this:
patch { include "materials/models/survivors/survivors_it_shared.vmt" insert

10.062 NOT using _IT materials
Open every VMT that should be covered in vomit. Add a second } on a new line at the very end of the _IT VMT. Swap the "Vertexlitgeneric" with this:
patch { include "materials/models/survivors/survivors_it_shared.vmt" insert

No matter if you used dedicated _IT materials or not, the materials with vomit look like this now.


Fun fact: It is called IT texture because of "Tag, you're it"

10.07
In your "Root" folder, copy the entire "Materials" folder and paste it in the "New content" folder you created before step 10.01.

You can now reload the model in HLMV by pressing F5 and see how the textures look like.
These textures are basic right now, you can make them look nicer anytime you want.
It's normal that the eyes are broken right now. They'll be fixed once we do the eye tracking setup.


10.08
If the textures won't show up, look at this video, it explains every single possible reason why textures won't show up.
Yes, every single possible reason. I got at least eight people who said this video was useless. But once they sent me their files to check i simply pointed out which step they had ignored.

Model Testing
11.01
You can give the survivor weapons to hold by clicking "File - Load Weapon" "w_models/Weapons" for firearms
"weapons/Melee" for melee (only w_ affixed models)
Click "File - Unload Weapon" to remove a weapon.
If HLMV gives you an error when opening the folder, you can use crowbar to create the folders so that HLMV can "see" them properly.



11.02
Load a several animations to test the rigging.
I'd recommend using the following animations:
  • idle_standing_elites - test shoulder and armpit rigging
  • any idle_crouching - test thigh and knee rigging
  • any rifle animation - test left wrist.
  • idle_standing_axe - test right wrist and weapon attachment.
You can also use these sliders to do spine and neck rig testing.


You can now either continue reading through the "Fixing" steps, or skip right through to the attachments, if you want.
═══════════════════════════
Fixing Thin Elbows/Knees/Thighs
Thin Mesh Fix
If you see anything that doesn't look right, manually weight paint the mesh.
In the image below i have super thin thighs, caused by insufficient weights on the thighs.

You can pose the armature in a similar way as HLMV shows the trouble spot and then paint the weights onto the model. Because It is possible that the weights don't show exactly the same in HLMV. As it does for my trouble spot.

Note the pointy bit above the thighs in HLMV.
If a vertex is too lightly rigged to bones, blender will accurately try to compute stretch with this very light weight painting.
But the source engine isn't good at that part and the weights will look wonky.

So all you'd need to do in those places is add weights to the nearest bone.
I've also removed weights from the thigh to undo the indent and now it looks better.


Also, the thigh can clip a bit into the pelvis when crouching, as you see in my image. That's not a problem, considering that every source engine character ever from Valve does that anyways.

You've already seen my weight paint video further up. That's the only help I can give you.
All you got to do is learn the weight paint and figure out which bones affect a bone too much and which affect them too little.

Attention:
If you pose the armature in blender to fix the weights, undo the entire pose before you export the mesh. The mesh will accept that new pose as rest pose, which sometimes will end up looking broken in HLMV.
Fixing "Inverted Normals"
Inverted Normals Fix
Sometimes pieces of the model have textures on the wrong side of its mesh (aka normals).
This usually happens when you mirror a mesh in blender.
Example:

OOOhhhhh.... which way is he spinning?
Clock wise. Just look at his face...

Anyhow. that's caused by inverted normals.
It could be fixed by adding $nocull 1 to the vmt, but It will mess up your models lighting.

Instead, inside of blender, select the inverted mesh and press Alt & N.
The new window got the options to Flip your normals. press it.
You can also select the entire model and recalculate normals on all of it in case you're worried there's more flipped things you don't see. But doing that could very well also flip some normals the wrong way.
Fixing Feet (When using High Heels)
Sunken Feet Fix
Anytime the foot bones are raised off the floor, foot clipping will happen.
This can happen when you use high heels, or Satyr (Goat) legs.


The old fix was making new IK bones for the feet, which did work, but it was a pain.
Thanks to Lt.Rocky, we got a new, easier fix. It lost him his sanity, but it was for the greater good.

Note:
- Using this fix might require you to use the later mentioned "Floating Incap Animations" fix.
- The higher the heels, the less viable this fix is.
- You might even need to make procedural bones to rig the feet to. (not shown)

Sunken Feet Fix 1
Select the pelvis bone and move it upwards until the bottom of the feet touch the "floor".
Do not apply this movement. Just check the amount of distance it moves.
In this image, you can see the value I chose is 0.9.
Keep this value in mind. Write it down somewhere.


Sunken Feet Fix 2
After checking the amount of upwards movement required, drop the transforms.
Enter Edit mode of the armature and move the foot bones down by exactly that amount.
Then export the model with the lowered foot bones.
You will need to redo the proportion pose via Perl Script.



Sunken Feet Fix 3
Enter pose mode and move the pelvis back up by the amount you had chosen.
According to Rocky, the foot bones would need to be lowered in this pose by the same amount again. But when testing, this was not required on my end.


Save this pose as an animation. Call it "FootFixPose"
In the QC, use the "FootFixPose.smd" for the "a_proportions" sequence.


Sunken Feet Fix 4
You may need to adjust the calf's rotation via definebone lines.


This can be done by editing the second to last value in the $definebone lines to a negative value.
A Good starting value is -5. You may need different values though. (The gif abofe used -5)

$definebone "ValveBiped.Bip01_L_Calf" "ValveBiped.Bip01_L_Thigh" 16.572350 0.000000 -0.000000 -0.000000 0.566827 -0.000000 -0.000001 0.000000 -0.000000 1.000000 -5.000000 -0.000000 $definebone "ValveBiped.Bip01_R_Calf" "ValveBiped.Bip01_R_Thigh" 16.572348 0.000000 0.000000 -0.000000 0.566827 -0.000000 0.000000 -0.000000 -0.000000 -1.000000 -5.000000 -0.000000


Here is the old fix.
Do not follow these steps. They're extra buggy and a pain to deal with.
I'm keeping them here for legacy purposes
This can be fixed by duplicating the feet bones and moving them to where the original player's feet bones were. Or even lower, in some cases. Make these new bones children of the original feet bones, but do not rig anything to them. Set up the $IKChain lines of the feet to use those new foot bones instead. These IK bones should have $bonemerge lines, but not in the !bonemerge file. Place these $bonemerge's above the IKchain instead. Sometimes it is even best to delete the "knee" section of the feet IK lines.
Fixing Floating Incap Animations
When you move the pelvis up or down, you'll end up with a player either floating or clipping into the floor when incapped.
Luckily, Davi (Debiddo) Gooz has made a prefab that aids in fixing this issue.
It requires manual work and editing a few files so pay close attention!
This setup, basically, creates a new includemodel that has offset animation origins, so that the entire model either lifts up, or drops down by whatever value you want.
Important: it replaces the incap animations with bills incap anims. (for now?)



IncapFix 1
You need to download this prefab[drive.google.com]
More info on this Prefab can be found in the Dead 4 Mods Discord discussion here[discord.com]

I would reccomend to create a new folder next to your existing QC files called "Animfix"
Unpack the survivor_incap_prefab.zip in that folder.

IncapFix 2
Open anim_fix.qc
Replace the second "Name" in the first line to what you want to call the new includemodel.
from: $definevariable Name Name to: $definevariable Name SURVIVORNAME_FloatFix
this will end up creating models/survivors/SURVIVORNAME_FloatFix.mdl

IncapFix 3
If you're compiling for any of the models listed in the scale table, you'll need to swap the scale value to the listed size.



IncapFix 4
For now, scroll down to the Offsets per sequence section.
Change the last value in the incap lines to a value you think might fit.
Positibe values to push it to the ground, negative to raise it off the ground.


IncapFix 4
Compile this anim_fix.qc. For now, you want it inside the game files. To see in HLMV.
Open your player's qc file, scroll to the proprtion trick part and above the original includemodels, add the includemodel to the mdl you had just made.


Compile your playermodel as "!/Temp.mdl" or whatever name you picked in Step 7.01
Now you can load the survivor in HLMV. Load the Incap anim and you should see that the model is no longer high as a kite, or digging itself into the floor.
The feet will most likely not adhere to any IK. That's just how it is at the moment.

You can adjust the values set in the offset part of the anim_fix.qc. and recompile just the anim fix model, then reload the playermodel in hlmv until the height is acceptable.

IncapFix 5
Load the Idle_Incap_Elites animation and load "weap_pistol_a_dual" as a weapon.
This is important, because the prefab has its own definebone file, but the weapon bones for that might be misaligned and your guns might be rotated in the incap anims.


If your guns are rotated, you'll need to fix it now. If they're not rotated, skip to to next step.

In Step 7.05.1 you had separated out the original weapon and attachment bones.
They should be chilling in your qc file for the playermodel.
Copy the 16 weapon and attachment definebone lines.
Open "Animfix\includes - definebones.qci"
Scroll down to where you can see its definebone lines for the weapons.
Replace the definebones in the animfix prefab's definebones.qci with the one from your player.qc

from:
to:

IncapFix 6
IncapFix is Done.
But you must ship this new model with your player mod, else it obviously will not work.
Fixing Misaligned Guns
11.06
If the gun is in the correct spot, but the magazine or other parts are in the wrong spot:
Delete the weapon bones from your model in blender.
Delete the $definebone lines of the weapon bones in your qc/qci.
Copy the original $definebone lines from a decompiled player and copy them into your qc file.
Deleting weapon bones from your mesh, requires redoing the proportion pose via perl script.


This will make sure that all pieces of the gun are relative to the weapon bone.



If you, for whatever reason, have guns that do not sit in the hand, you'll be able to fix this here.
Definebone edits will not be able to solve this issue, sadly.
We'll have to do more bone work in blender.



GunAlignFix 1
Get the original players armature into blender.
Either because you still have it, or by importing it again.


GunAlignFix 2
In pose mode, select the hand bone of the original player.
Add the "Copy Transforms" constrain to the hand, make it follow the hand of your proportionally altered armature.
The hand will move to where it should.


GunAlignFix 3
Apply the pose of the constrained armature as rest pose.
Delete the constraint.
The bone for the hand and all its children should remain right where they are.


GunAlignFix 4
Delete all body bones that have no relation to the hand.



Delete all finger bones.


GunAlignFix 5
Move the hand bone of this armature and give it a random name.


Join this armature to the playermodel armature.
Add the Right hand bone as parent to the randomly named bone that used to be the hand.


Delete this randomly named bone.
You should see that the weapon bone and the 4 other bones in the same spot will now have a straight line to the hand bone.


GunAlignFix 6
Now you can move the ValveBiped.weapon_bone closer to the fingers.
Sometimes just moving long its local X axis is enough.


You could even load a worldmodel and do the same Bone Constrain thing to make it follow the weapon bone, so you got some kind of a gauge of how far to move it.


GunAlignFix 7
After you moved it to where you think its okay, apply the pose as rest pose.
Now you gotta re-export the mesh, because the bone data is saved in the mesh.

You'll also need to redo the proportion pose.
Either via the perl script, or the blender animation shenanigans.
Weapon position is saved inside the proportion pose, afterall.

GunAlignFix 8
Now you should be done

═══════════════════════════
Attachments
Now we'll determine where equipped items will be attached to the survivor .

12.01
Import the "ATTACHMENTS.smd" to your blender file as a separate armature.
You'll see a few items and get a bunch of bones.


Use pose mode to pose the items where you want them to be.
Note: Melee weapons are not entirely accurate, but I got them as close as I could.
Also, Adrenaline uses pills attachment, defib and ammo upgrades use the medkit attachment.
Pipebomb and Molotov got their own attachments for some reason. If you want you can make both attachments follow the same bone, so you can delete one of those bones and helper mesh if you are in need to an extra bone on your model.


12.02
When you finished placing your attachments, apply the armature modifier on the attachment mesh and add a new armature modifier, using your survivor armature.


Next, apply the pose you just made as a rest pose, then join that armature to your survivor armature.


Enter armature edit mode and parent the attachment bones to the nearest survivor bone.
You could also parent them to jigglebones, but don't make the actual attachment a jigglebone because jiglebones always need to be in a very specific orientation to work, while our attachment bones also need their own special orientation.

Now since we made new bones, we need to make new bonemerge lines and run our "Generating Definebone" qc again.


12.03
Export your model again as a new smd and open it in Notepad++
Copy the bone part, open your !bonemerge.qci, delete all of it and paste your bone part from the smd file.

Press "Ctrl & H"
Make sure "Regular Expression" is turned on
Find ^\s*\d+\s*"(.+)"\s*-?\d+\s*$
Replace with $bonemerge "\1"

Save the !bonemerge.qci again.

Info
All attachment helper bones will be collapsed, as they are unrigged bones without $definebone.
For example: your melee_attachment bone is a child of Spine4.
The compiler will recognize that the attachment ultimately follows Spine4 and will instead calculate the offset to from teh attachments current location to Spine4 on its own, making the attachment stay where it is, but now directly attached to Spine4. As opposed to being attached to "melee_attachment".


If, however, you want to keep this bone for a jigglebone or maybe a moving attachment, you need to write $definebones for those bones aswell and paste those custom definebone lines below the original bones.

12.04 (Optional - when you want to keep the attachment bones)
Delete your old "!definebones.qci".
Comment the $include Last_Stand_Weapon_Bones.qci from your qc file.

Drag your "!Making_Definebones.qc" onto crowbar again.
In the compile tab, pick the $DefineBones option and its QCI option.
Name the file "!definebones"


Press the Compile button to write a new !definebones.qci.

Now we got new definebones that include the attachment bones.
We needed to write a new one because those bones have no mesh rigged to it, so the compiler would have removed them from the model. Plus, if the model bones don't match with the $definebone lines for any reason (like not having some $definebone lines for existing bones) the DMX face flexes will break
Uncomment the commented "Last stand qci"

12.05
Delete your old weapon attachment lines and replace them with these:
Important notice: IF the attachment order is originally different, rearrange these lines to be in the same order. Different attachment order can mess up the attachments location.
Some attachments appear twice because valve spaghetti work. so just replace all lines of the attachment with the same data.

$Attachment "Molotov" "Molotov_attachment" 0 0 0 rigid $Attachment "pills" "pills_attachment" 0 0 0 rigid $Attachment "grenade" "grenade_attachment" 0 0 0 rigid $Attachment "pistol" "pistol_attachment" 0 0 0 rigid $Attachment "primary" "primary_attachment" 0 0 0 rigid $Attachment "medkit" "medkit_attachment" 0 0 0 rigid $Attachment "melee" "melee_attachment" 0 0 0 rigid
If you decided that the Molotov and pipebomb should use the same attachment bone, then change one of those attachment bone names from "grenade_attachment" to "Molotov_attachment" or vice versa

Some L4D1 characters don't have the melee attachment, so just add that one below all original attachments instead.

Note

Sometime survivors, like Zoey or Coach, decompile without the following attachments:
  • L_weapon_bone (For holding two handed melees)
  • weapon_bone
  • Melee (which we just generated)
  • attach_R_shoulder_blade_aim
  • attach_L_shoulder_blade_aim
Not entirely sure why, but check if you have these attachments.
If you don't have them, add the following lines below your already existing ones.
$Attachment "L_weapon_bone" "ValveBiped.L_weapon_bone" 0 0 0 rotate 0 0 0 $Attachment "weapon_bone" "ValveBiped.weapon_bone" 0 0 0 rotate 0 0 0 $attachment "attach_R_shoulderBladeAim" "ValveBiped.Bip01_Spine4" -10.07 -1.33 -4.85 rotate -90 -103 0 $attachment "attach_L_shoulderBladeAim" "ValveBiped.Bip01_Spine4" -10.07 -1.33 3.36 rotate -90 -103 0

Should you ever mess up the attachment lines, or some are missing;
Here are all original attachment lines for all survivors[pastebin.com].
Face Flexes
If you are working on a headhack, you will already have everything you need. Skip this part and only do "eyetracking" if you had to modify the proportions of your headhack model.

I recommend you to rig your face to a few bones. At the very least the eyelids, jaw and lips.
Cheeks and brows can be modified rather well with sculpt mode. If you use sculpt mode, use the "mirror" function to have both sides of the face scuplted at once. But only use Sculpt mode after you made a flex via posing the mesh, otherwise you edit the base.

Be aware that flexes using DMX format (which we will use) will be broken if your definebone.qci doesn't match with the actual location of the bones.

13.01
Instead of using the decompiled heads as model to copy flexes from, we will use the Starter Kits'.
Those have the original flex data.

Head over to "Left 4 Dead 2\sdk_content" and unpack the "Starter_Kits.zip"
In the new folder, look for the character you want to replace.
In my case "Starter_Kits\Survivors\L4D1\Zoey\models\survivors\Compiling Files"
Inside of it is a QC file. Open that up real quick.

It references a DMX file, which is the model that has the flexes we seek.
It also has two QCI related to flexes which we can use.


Copy those into the same folder as all your other model files.

13.02
Import that DMX file you copied from the starter kits.
Don't forget to use "Make New Armature" when importing it.

You can delete its armature and every piece of mesh that is not head.
Then move it out of the way so that you can see it next to your own head.


In the "Object Data" tab, right under Vertex Groups you can see a list of its flexes.

Note, Zoey for example has two flexes at the very end which we have no use for.
"old-cheekRaiser" and "tempWrinkler". They are needed, but unused.
Add them with their proper names, but leave them default face flex.

Pick the first flex of the original head and recreate it on your own head.



In the models modifier tab, change the name of the armature modifier to the name this flex had on the original head (Case Sensitive!) and click the "Apply as Shape Key" button.

This will remove the modifier and add a flex with the armature modifiers name to your model.
Add the modifier again.

13.03
Not required, but useful, would be to save every flex pose as keyframe in the armature.
In case you ever need to modify a flex, go to the keyframe and add a fresh flex from the pose.

Before you make any new flexes, go to the "Animation" screen and check if this setting that you had enabled earlier in step 4.02 is still enabled.
That button, as you may remember saves all bone modifications immediately as a keyframe.


If done correctly, your pose stays when pressing the right/left arrow keys.
This little number in the top left corner is what keyframe you are currently on.


Once you made a pose, hit "Right Arrow" to step to the next frame.
Clear that pose and make a new one.


Rinse and repeat this process.
Make pose, apply modifier, re-add modifier, advance frame, clear pose, make pose...

Tip: for AU13 (Puffy cheeks) I recommend to use Sculpt mode's "Blob" Brush to inflate the cheeks.
Make sure it only affects the face and not the teeth inside the mouth by first entering edit mode and hiding everything that you don't want to have affected in sculpt mode.
Also, make a new empty flex before you modify the face, otherwise you edit the base.

There might be a few flexes where the sculpt mode is more useful than your bones.

Eventually you will have a list of all flexes, with the original names. (Remember; Case Sensitive!)


13.04 (Optional)
"Ignoring" face bones when you're over the 128 bone limit.

Duplicate the mesh.
Remove face bones from the Vertex Group list in one of the meshes.

(My mesh has no head in the gif. i had head and body separated. Nevermind that.)

Pose the entire armature back a bit to reveal all unrigged vertices.
Re-Rig those vertices to the head/neck bones.


Open $definebone.qci and delete the face bones you removed from your mesh.
$definebones forces bones to be present even if they are not rigged or not actually exist.
Deleting bones from the vertex group only deleted its rigging.
The compiler itself will delete bones without mesh rigged to it.


13.05
Export the model as SMD
You'll get a SMD and VTA file. We need the VTA for the eyelid lines later. You can delete the SMD.

Select the DMX option.
L4D2 uses "Binary 3 Model 15".
Gmod uses "Binary 2 Model 1"


In the Source Exportables, select your head.

In this picture i got a different name from before. I decided to merge head and body.

In "Flex properties", click the "Advanced" button.


in the "Controller Source" search for the very same Starter Kit head DMX file you had imported.
This will copy the Flex Controllers from that file onto yours.

OPTION 1 (Reccomended)
Make a new vertex group called "DMX Stereo Balance"
Its name probably does not matter and no such bone exists either.
Enter weight paint mode on your head and select "Gradient"


Paint across the face from right to left on the "DMX Stereo Balance" group only.
Make sure you're painting as horizontal as you can.
Turn on the wireframe and use the vertices as point of reference.
This gradient defines the space in which the Left and Right halfes blend.

Yes, ellis' head. I was updating my Riot Police mod and learned a new, better way of doing it.

In the "Stereo Flex Balance field, pick the "DMX Stereo Balance" vertex group.

Export the DMX with these settings.

OPTION 2 (Buggy, Unreliable)
In the "Stereo Flex Balance field Click the menu on right, pick any Axis and set the slider to 99%.


100% sharpness:

99% sharpness:


You can set this slider to a different setting if you want.
Start at 100% and work your way down im 0.2 instances.
I've seen 99% being way too low already

13.06
Open your QC file to add the following lines to your $model part:
noautodmxrules $include "!survivors_facerules.qci" $include "!survivors_bodyrules.qci"
You'll recognize the bodyrules and facerules from the starterkits. I just added a ! to the filename beginning again.
Eyetracking
The last part of the worldmodel is Eyetracking.

14.01
There's a tool which will practically generate all required lines for you, called QC_Eyes.
Head over to "Left 4 Dead 2\bin" and launch the tool.

You'll see textboxes in which you need to write information.
Lets start with this box.
All we really need is the VTA name. The rest doesn't matter.


14.02
Next are the X Y and Z Values for both eyeballs.

the X value for one eye is pretty much the X of the other, just with a - in front.
Y and Z are pretty much identical aswell.
This might be different if your model is looking to the left or right in blender.

Here's how to get the X and Z numbers:
In blender, pick the very front and center vertex of your eye, Then press "N"
The menu on the right will show you the number. Just copy them into QC_Eyes.


For the Y value you got to find the middle of the eyeball.
Sometimes you're lucky and you get an actual eyeball mesh.


If you do not have at least half an eyeball try this:
Snap your cursor to the front middle vertex. The very same one you used for the X and Z value.


In object mode, add an "UV Sphere". It will appear at the 3D cursor you had set.


Scale it down until its about as wide as your eye.


Move the sphere so far back until you can see your actual eye.
You'll have an approximate location of your eye middle now.

Once you pasted those three values of both eyes into their respective block, continue with the eyelids.

Not setting the Y properly causes your eye to malform.


14.03

This is pretty self explanatory. The images are also really dang useful.

In case you don't get the QC_Eyes instructions:
Select the uppermost vertex as close to the middle of the eye.
Copy the Z position of that Vertex using the Base face flex into "Neutral".
Then switch to a flex where the upper eyelid is at its highest (Should be frame02) into "Raised.
Then switch to a flex where the upper eyelid is at its lowest (should be frame01, but was AU42 for me) into "lowered"

Never change the vertex while picking the numbers.
Then do the same for the lowermost vertex of the lower eyelid.


After adding all numbers, check that none of them have a "m" at the end.
Then select "Z Up Axis" here.


14.04
Click the "Create QC Text" button.
Replace your already existing eyes and mouth attachments, and your already existing $eyeposition lines with the ones you just got.

Then copy all the eye lines from QC_Eyes into your QC file.


Change the eye materials for the ones your model uses and change the pupil to "iris_unused".


If you feel like your iris textures are too large or small, change the 0.63 at the end of the eyeball lines. That number is the scale modifier for the eyeball texture.

These eye lines make the eyes movable at all.
The eyelid lines make the eyelids move with the eyes when looking up/down.

They also make the eyes open automatically when the eyetracking system tracks the eyes to something that might be blocked by the eyelids.

14.03 (Optional)
Inside your bodyrules.qci, you got these two lines:
flexcontroller eyes range -30 30 "eyes_updown" flexcontroller eyes range -30 30 "eyes_rightleft"

The numbers determine how far the eyes can move using the flexes.
If your eyes roll into the players head when using the eye flexes, lower the numbers.
Technically since that qci only has those two lines you might as well add them to your main qc file.

Your QC also has the following line:
$MaxEyeDeflection 30
It determines how many degrees the eyeball is able to look Independent of flexes.
Keep them and the flexcontroller numbers the same.



═══════════════════════════
Biker & Teenangst _light
Francis and Zoey have a "Light" model.
This is only used in the intro map or "The Passing" when they're standing on the bridge.

No clue *why* they made these models, because the only difference is the anims used.
the entire rest of the qc is entirely the same. Which means making those models is really easy.

I've come up with a "new" way of creating these models with even more ease.
that new way uses new $Includemodels, so you do not need to compile any animations.

Either ways, you can use the "new" or the "old" way, whichever you want.
they get the same result, but the "new" way is easier, in my opinion.
New _Light Model approach
The "New" approach to the _light models is using the includemodel and its .ani files.
These can be found in the downloaded Githup Repo's "New_Includemodels" folder.
They're called "anim_biker_light.mdl" and "anim_teenangst_light.mdl" with their .ani files.

Since everything except the animations is the same, we can do a gigachad move.
All we need to do is use a different $modelname, $includemodel, and $include declaresequence.

So you can just copy the $modelname line from the top of the qc to the very bottom.
Then make it look super fancy like this

For Francis:


Or for Zoey:


Now you can toggle the comment between the set of default and _light models and you're good.
Yeah. that's literally it. Cool, huh?

Don't forget to ship the required anim_***_light.mdl and .ani file with your mod!
Old _Light Model approach
Copy everything from your playermodels QC, from the first line after $modelname, up to the $IKAutoPlayLock line, which is right before the sequences start.
Replace every line in your _light.qc between its $modelname and the very first $animation line with what you just copied.


Delete the Collision part at the very end of the _light.qc
replace them with proportion lines after the last $sequence of the _light.qc:
$sequence reference Proportion_override.smd $animation "a_proportions" "harleen_body.dmx" subtract "reference" 0 $sequence "proportions" "a_proportions" predelta autoplay
Note that there's no $declaresequence line, because all animations of the _light model are inside of this qc file, we won't need declaresequence anymore.
If you have this declaresequence anywhere in your _light.qc, delete it.


Alternatively
Make a shared.QCI file to $include into the qc files of the playermodel and the light model.
This QCI includes everything between the $modelname and the first $sequence. As above.


Add the proportion lines to the bottom of your light qc file, and delete the collision part.
$sequence reference Proportion_override.smd $animation "a_proportions" "harleen_body.dmx" subtract "reference" 0 $sequence "proportions" "a_proportions" predelta autoplay
═══════════════════════════
Viewmodel Arms
FYI, Proportion trick does not work on viewmodel arms.
Proportion trick works by changing all animations inside the model, but the arms do not have animations in them. The weapons force their animations onto the arms.

15.01
Import the original survivors viewmodel arms.
You might need to rotate them to be upright.
They might also be a little larger than your model



15.02
Duplicate your player model and its armature.
Delete everything that isn't part of the arms in the model and armature.


15.03
Pose your arms to match the original armature.
You could even pose both into a T-Pose to help.
The viewmodel arm pose doesn't matter, because all weapons will override this pose.
It is not possible to ever see the reference pose of your arms ingame.



Apply the armature modifier to your custom arms.

if you also posed the original player's arms:
Apply the armature modifier to the original arms and add it again.
Apply its pose as rest pose


15.04
Time to rig these arms again. You know the Spiel.
Duplicate the original armature, make the tips of every bone touch the base of its child.
Delete spines, clavivle and wristhelper bones.


Once auto rigged, make the thumbroots area of effect way smaller.

Also increase the hand bone's area of effect.

The thumbroot helps the thumb transition.
Rotate the thumb bone by 60° on Z, and the thumbroot by 30° on Z.
Weight paint them to look good in this pose.



15.05
When happy, Export the model and compile it to a custom name.
Open HLMV and load a Viewmodel of any weapon.
Load the arms via "Load Weapon".

Ironic, but that's how it works.
"Load weapon" loads a model and applies it to any matching bones to follow the animations.
In L4D2 the weapons hold the animations.

Play with the arm weights until you're happy and then do a proper compile of your arms.
HUD images.
There's two guides, with prefabs, which make it stupid easy to create these images.

One i made myself
Prefab: https://goo.gl/fKdX2k The prefab contains:
  • Photoshop save of the lobby images, containing L4D2 and L4D1 style.
  • Photoshop save of the Ingame Hud images, containing L4D2 and L4D1 style.
  • Photoshop save of the Incap texture where the survivors have been removed.
  • Original HUD images for reference.
  • Text file explaining the correct names of all files and info about testing VS images.
  • Text file telling you what Nr# the Incap sequences have so that you don't have to search.

ant this one is made by Splinks:
https://steamcommunity.com/sharedfiles/filedetails/?id=1994377774
Final compile & Packing
Now its time to pack up all the content into a vpk file.

16.01
Swap the comment on in the $modelname lines to what they should be.


Compile all models, collect them together and pack them into their respective subfolder of your "Root" Addon folder.

Tip: You could also use Crowbars output folder to compile directly to the "root" addon folder.

Important
The models must be compiled to the real location and modelname.
Once the MDL is compiled you must not rename it or move it from your "!/" folder to "Survivors".
!!! Use the real $modelname line when shipping !!!

The MDL contains information about what folder it is meant for.


Renaming the mdl file will not change the fact that the model itself seeks "!/TeenAngst.mdl".
Your renamed/re-located "survivors/TeenAngst.mdl" attempts to load "!/TeenAngst.mdl".
Everyone who has "!/TeenAngst.mdl" will see it. But since you won't pack that file into your addon, nobody has it and they will therefore see nothing at all.

DO NOT EDIT THE MDL AFTER COMPILE.
COMPILE IT CORRECTLY TO BEGIN WITH!

16.02
Additional addon files.

Before L4D2 had the workshop, L4D2 used addoninfo.txt and addonimage.jpg files to decide what text and thumbnail will be shown on the addons page in L4D2.


Mods downloaded from the workshop will use the workshup thumbnail and description now.
But if the user decides to take the addons out of the workshop folder and install them like in the good old days (usually done to prevent auto updates or deletion of mods) those addonimage and addoninfo files will be used again, if they exist.

Addoninfo.txt is responsible for having the addon show up in the addon menu, if installed locally.
You should always make one. For yourself and the people installing it locally

You can get away with a simple addoninfo.txt containing the following:
"AddonInfo" { addonSteamAppID 550 //L4D2 in Steams game system. don't change. addontitle "Zoey - Harley Quinn" //Addon name shown in addonmenu addonversion 1 addonauthor "MrFunreal" //your name }

If you want an addonimage, import a 512x512 image to vtf edit and compress it as if you'd do with a texture. But then export it as addonimage.jpg right into your "Root" folder.



16.03
For the addon to work, you must pack it into a vpk file. Crowbar can do that for you.
Just open crowbar in the "Pack" tab and drag your Root folder onto it and press the "pack" button.


Alternatively, you can make a right-click promt for your computer to pack stuff into vpk files.


Find out how to do that here:
https://steamcommunity.com/sharedfiles/filedetails/?id=1544981726

You'll get a vpk file that holds the same name as your root folder.
Its content should look like this:


This vpk file can now be dragged into your addons folder; Left 4 Dead 2\left4dead2\addons.

Test your model ingame.

Make any changes if needed.
You'll be able to release this to the steam workshop using crowbar now.
Final words
If you require help with some steps join the "Dead 4 Mods" Discord Server[discord.gg].
We got channels where you can ask modding and mapping questions.
(Don't join and then send me a DM. Don't be that guy.)

I got my own Discord Server[discord.gg] if you'd like to hop in and chat.
I also got Paypal[paypal.me] for don't-ations.

Special thanks:
ZeqMacaw
For his "Compile survivor on different animationset" tutorial and crowbar.
Lt.Rocky
SD3D
E7aimy
for their help with face flexes.
JazzMcNade
For the Perl Script, which is already outdated now.
But still thanks.
Jakobg1215
For teaching me that the Perl script isn't even required, and its easier without it.
MSF
For his original Proportion Trick tutorial, which i used to learn.
Coffee
Keeping me awake
230 Comments
urielrgz1506 Apr 18 @ 9:36am 
my witch model is just t posing. Also I did already join the server. I was told something about includemodel and that maybe I didn't rig it right which was actually one of the issues but even after fixing that my witch still just t poses.

I'll send sum sort of image or file in the discord server some time soon to see what mistake I made.
мяFunreal  [author] Apr 18 @ 2:44am 
Do they not work "at all", meaning the player is t-posing, or do the animations look messed up?

Because there wouldn't be a reason for animation to not work at all ingame, when it works in hlmv. My first guess would be that perhaps you didn't compile the model into the addon and loaded it, so you haven't got your most recent compile ingame. Which happens sometime.

Other than that, maybe the declaresequence file wasn't used, which would cause the animation order to shuffle, but that would only show up in online play.

Unfortunately i can't tell you without looking at the files myself.
You could join the "Dead 4 Mods" discord server (link is above in the "final words" segment) and then seek out the Modding channel.
You could send screenshots, and if nothing helps, send me the entire mod for me to check out.
urielrgz1506 Apr 17 @ 9:37pm 
everything but the animations work. they work in HLMV but not in game. what would a possible cause be?
мяFunreal  [author] Apr 4 @ 7:48am 
No, for multiple reasons.

This guide has been severely modified various times. I can not do that with a video, unless i re-record new parts and upload a new video every few months.

And a single video for all of this would be multiple hours long.
I've already recorded a video of me just making a CI mod which was already over an hour long. And that was missing all the face flexes and procedural parts.
can u make a you tube video plz
Yukino Mar 30 @ 5:07am 
Ahahaha, ok. Thank you for clarifying.
мяFunreal  [author] Mar 30 @ 4:49am 
Of course they are. I'm not a chinese game dev.
Yukino Mar 30 @ 4:44am 
Are all the linked files at the very least, virus free?*
мяFunreal  [author] Mar 30 @ 4:38am 
Whoever told you that you can just rename the bones has a perfectly aerodynamic brain.
That's not how it works. Not at all. You actually have to follow the guide properly to get it to work.
Hildefuns Mar 30 @ 2:56am 
Could you please help me? I'm having trouble with the Perl Script that rewrites the proportions. I created the batch file with the code you said put in and double checked everything to make sure the names match exactly, but it's not creating anything. It turns on for a second then turns off. Admittedly, I used a different process for the skeleton, someone told me that you can just rename the parts of skeletons to match the Valve Skeleton, but I don't think that would affect the batch file.

My replacement model's called "yamatonagamori.smd", the original model is Nick's model "gambler_model_merged.smd" and for the referenceCreator script, I named it "!referenceCreator.pl". The code I have entered is:

"Perl !referenceCreator.pl gambler_model_merged.smd yamatonagamori.smd
quit"

Is anything wrong here? The only thing I modified in referenceCreator file was putting a "!" in front of the output name. Please get back to me when you can. Thank you very much.