How to make OC playermodels

From Obsidian Conflict Wiki
Jump to: navigation, search

Originally written by fug4life, with tips and tricks from Maestro Fénix and TESLA-X4.

In this tutorial, you will learn how to make a player model for Obsidian Conflict.

Ask always permission if you are going to port/modify a model created for another person. If he/she accepts your request, don´t forget give credit him/her. NO, SERIOUSLY, ASK FOR IT, DONT BE AN ASSHOLE.


  • Have a permission from the author, or in case this is not available (i mean you cant contact him, not in case the author dont give you permission), follow the conditions of the license (if it doesnt have any condition/license, it has the "Credit to the author" license by default).
  • Source Development Kit (Source SDK): Available in Steam → Library → Tools. This is required as a base for the model decompiler program, and to recompile models.
  • An Image Editor (such as Paint.NET, Adobe Photoshop, Paint Shop Pro or others).

Preparing The Materials

First, you will need to create the folder of the new model that you are going to make. Go to your client's obsidian folder (inside Steam/steamapps/sourcemods for the uninitiated) and proceed to navigate to materials/models/player. Create a new folder (with the name of your model) inside this folder (right-click an empty area → NewFolder). Copy your model's materials into the new folder you created, then open their .vmt files.

You should see something like this, in typical KeyValues format:

	"$baseTexture" "Models/player/Mossman/mossman_sheet"
	"$envmap" "env_cubemap"
	"$bumpmap" "models/player/Mossman/Mossman_normal"
	"$normalmapalphaenvmapmask" "1"
	"$envmapcontrast" ".20"
	"$envmapsaturation" "0.9"
	"$envmaptint" "[ .36 .36 .36 ]"
        "$halflambert" "1"
	"$nodecal" "1"

Go to the $baseTexture line, and change Models/player/Mossman/mossman_sheet to point to where your textures (i.e. the .vtfs) are located. In the case of the above example, it would become Models/player/<your model name>/mossman_sheet, where <your model name> is the name of your model.

We're not done yet - you will also need to replace all occurences of Models/player/Mossman/ with Models/player/<your model name>/ in that .vmt file. To illustrate, in the above example, the line $bumpmap also needs to be changed from models/player/Mossman/Mossman_normal to models/player/<your model name>/Mossman_normal.

Note: If you reference an invalid path, your model will have the infamous error texture (a purple and black checkerboard texture will be seen instead of the original).

After you have modified all the .vmt files for your model, you are ready to convert the model for use as a player model.

Converting The Model

Go to the model files, and open the .mdl file with Notepad++ (or your favorite hex editor). The first four bytes in the file should be IDST (hexadecimal sequence: 0x49, 0x44, 0x53, 0x54). Now, verify that the fifth byte (immediately after the T) is a , (comma, hexadecimal: 0x2C). If it is, then you can safely close the program; nothing else needs to be done. If it is something else, such as a 0 (zero, hexadecimal: 0x30) or a - (minus sign, hexadecimal: 0x2D), you will need to change it back to a comma (i.e. IDST0IDST,).

Note: This workaround is required because the model decompiler was written before games on Source Engine 2007 and 2009 were released, and was never updated for forward compatibility by its author.

Open MDLDecompiler, then select the model that you wish to decompile and select the folder where you wish to put the decompiled files. After starting the decompile process, wait for a prompt to appear, informing you of a successful recompile.

Note: If the decompiler crashes for some unknown reason, attempt another 3-4 tries. If it still fails to work, you may wish to attempt to decompile it with StudioCompiler, or Erix920's modified version of MDLDecompiler instead.

Additional Note: In certain cases, MDLDecompiler will seem to work perfectly fine - no crashes or error messages are generated - but will actually generate corrupted .smd files, which when viewed in a modeling program such as XSI Mod Tool will have no mesh at all. A telltale sign of this is when the file sizes of most of the .smd files are unusually small (< 1 MB), coupled with an unusually large physics model .smd (> 1 MB). There is no known solution for this issue at the time of writing, apart from contacting the creator of the model and asking (nicely!) for the model sources.

Go to the folder where the resulting files are. You will see several files with the .smd extension and a file mdldecompiler.qc. Open the .qc file with Notepad++ or your favorite text editor, for example Wordpad (but not a word processor like Microsoft Word!).

This script file determines the Studiomdl configuration for the model. A snippet is provided below:

$cd "C:\Users\User\Desktop\New folder"
$modelname "player\Flandre.mdl"
$model "body" "ref.smd"
$cdmaterials "models\player\Flandre\"
$hboxset "default"
// Model uses material "txFlanFace.vmt"
// Model uses material "txFlandre.vmt"
$includemodel "player/female_shared.mdl"
$includemodel "player/female_ss.mdl"
$includemodel "player/female_gestures.mdl"
$includemodel "player/female_postures.mdl"
$surfaceprop "flesh"
$illumposition 0.016 0.578 34.522
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$ikchain rhand ValveBiped.Bip01_R_Hand knee  0.707 0.707 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee  0.707 0.707 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee  0.707 -0.707 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee  0.707 -0.707 0.000
$collisionjoints "phymodel.smd" {

	$mass 60.0
	$inertia 10.00
	$damping 0.01
	$rotdamping 1.50
	$rootbone "valvebiped.bip01_pelvis"
	$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"

A breakdown of the important components of the script:

  • $cd: A pointer to the folder where the .smd files reside in. If you moved these files elsewhere after decompiling the model, modify this to reflect that change.
  • $modelname: This command determines where the resulting model will be placed in, with respect to the models folder. Using the above snippet as an example, the resulting (compiled) model will be located at models/player/Flandre.mdl.
  • $cdmaterials: A pointer to the folder where the materials for the model reside in, with respect to the materials folder. Using the above snippet as an example, the full path will be materials/models/player/Flandre/. Ensure that the path is valid or your model will end up with purple and black checkerboard textures instead.
  • $includemodel: This command determines which model files are 'included' into the model. In layman's terms, this determines which animation libraries are referenced by the model. An Obsidian Conflict player model requires a different set of animation libraries depending on the character's gender:

For a male model:
$includemodel "player/male_shared.mdl"
$includemodel "player/male_ss.mdl"
$includemodel "player/male_gestures.mdl"
$includemodel "player/male_postures.mdl"

For a female model:
$includemodel "player/female_shared.mdl"
$includemodel "player/female_ss.mdl"
$includemodel "player/female_gestures.mdl"
$includemodel "player/female_postures.mdl"

  • $surfaceprop: Used to define the physical surface properties the model will have. The default is flesh (organic-human). The complete list is available here.

Note: If this command was used in the .vmt files to define multiple surface types and is also present in the .qc script, the values set in the .vmt files will be ignored. If this behavior is not desired, either delete this command from the mdldecompiler.qc script, or specify the value as default instead.

This is all that you will typically need to modify in order to make a player model compatible with Obsidian Conflict.

Finishing Touches

Save the script file and open GUI StudioMDL. Select OrangeBox for SDK Version and for Target Mod or "GameInfo" path select Obsidian Conflict (you will need to configure the Source SDK for Obsidian Conflict prior to this). Go to FileLoad .qc file and load the .qc file, then click on the Compile button.

When GUI StudioMDL finishes compiling the model (you should see Completed "mdldecompiler.qc"), open the Source SDK, select Source 2007 in the Engine Version: combo box and select Obsidian Conflict in the Current Game: combo box (once again, you will need to configure the Source SDK for Obsidian Conflict prior to this), then click on Model Viewer. When Half-Life Model Viewer loads up, go to FileLoad model... and select your model.

If all went well, you should now see your model, complete with working animations.

Once you have verified that your model is in working condition, go to where the model files are located in your client's folder and create a new text file with the name of your model, but with the .txt extension. Using the previous snippet as an example, the file would be models/player/Flandre.txt. Paste the following inside the file (don't forget to alter the gender of the base model rig and voice as necessary):

	//Use this option to choose a base script to use instead.
	"usefile"	"none"

	//Base model rig to use (doubles up as a fallback if loading fails). Use either Male_01 or Female_01 for best results.
	"basemodel"	"Male_01"

	//Voice Sound 0=none, 1=male, 2=female, 3=combine
	"voice"	"1"

	//Footstep Sound 1=shoe, 2=combine boots
	"footsteps"	"1"

	//Gibs, 1 = generic human, 2 = generic alien, 3 = human rebel ragdoll gibs, 4 = Ragdoll only
	"Gibs"	"4"

	//Determines if this model should be considered anime-related, 0 = no, 1 = yes
	"anime"		"0"

With this file, you can configure the voice, footstep sounds and gibs of the model.

Note: At the time of writing, the anime keyvalue is ignored. It will only take effect with the next release of Obsidian Conflict, but applying it now is highly recommended for forward compatibility.

Finally, head over to obsidian/materials/VGUI/playermodels/player and create a new .vmt and .vtf file with the same name as your model's .mdl file.

Note: The path after obsidian/materials/VGUI/playermodels/ must reflect the path to the model, i.e. if the model is at models/player/somemodelname/somemodel.mdl, the two files will be obsidian/materials/VGUI/playermodels/player/somemodelname/somemodel.vmt and obsidian/materials/VGUI/playermodels/player/somemodelname/somemodel.vtf.

In the .vmt file (you can make a copy of an existing one and clear it for use), paste the following:

	"$translucent" "1"
	"$basetexture" "vgui\playermodels\player\Hostage_01"
	"$vertexcolor" "1"
	"$vertexalpha" "1"
	"$no_fullbright" "1"
	"$ignorez" "1"
	"$decalscale" "0.250"

On the $basetexture line, change Hostage_01 to point to your accompanying .vtf file.

To create that .vtf file, take a screenshot in Half-Life Model Viewer then save it as a .tga file and open that in VTFEdit, then save it in the .vtf format. Give it the same name as your model.

Once you have placed the two files into your client's obsidian/materials/VGUI/playermodels/player folder, test it all out in-game. If all works well (animations, textures, sounds, preview image), pat yourself on the back - you've successfully created a new player model.

  • To test the model's preview image, start the game, then go to OptionsMultiplayer tab, and select your model from the combo box.
  • To test the model's animations and textures, select the model, then start a local server and turn on sv_cheats. Execute the thirdperson command.


OC playermodels are compatible with faceposing, jigglebones and particles. If your model have them, you will be able to see their effects in game. Also, in the next version, it will support multiple skins and bodygroups.

Tips And Tricks

Creating The VGUI Preview Image

Using Paint Shop Pro

You will also need to download and install a VTF Plugin for Paint Shop Pro beforehand (Information about how to use it and what programs can use it here).

So, Open Paint Shop Pro and open the screenshot (.tga file) you took in SDK Model Viewer earlier. (Prefebably you want the model holding an oc weapon and you can use centre view to get the model where you want it. To look around in SDK Model Viewer use: Right mouse click - zoom in/out. Left mouse click to rotate. Hold shift and use left click mouse to move the model up/down/left/right).

Also in Paint Shop Pro it helps to add a grid (view/grid, size dosen't matter)it just helps when working.

So lets move on to converting/working on the screenshot.

First we will use the Crop tool to cut the picture just so that we have the top half of the body. Make sure you use free form and have the box size that you are cropping set to 256x200, position in the centre of the top half of the body (showing the head, chest and shoulders), and then crop.

Now, click layers and select new mask layer/show all.

You will see the picture has a mask-raster 1 layer, right click and select delete and then yes.

Select the Magic Wand tool set up with something like mode = replace matchmode = RGB value tolerance = 1 use all layers and use contiguous also use Anti-alias and select outside from dropdown box. Click on the background on the image and not the model to use the Magic Wand. (Baically you want to delete the back ground and not the model itself). So if the the whole box and around the model is selected, its ok to delete.

Once the background is deleted, with the Magic Wand tool still open change the matchmode to = All opaque and this time click on the model in the image and it should change the Magic Wand from around the edges and around the model to actually now just around the model only.

Click layers select new mask layer/form image, make sure source opacity is checked and everything else is unchecked, click ok.

Now we are going to cut the highlighted model onto a new image. So with the Magic Wand still highlighting around the model on the image change to the Pan tool and right click on the highlighted model and select: copy merged.

Go to File and create a new image with these properties:

width =256 pixels
height =256 pixels
resolution =72,000 pixels/inch

Choose Rastor Background image depth =RGB - 8bits/channel

And check the Transparent box.

Paste your copied image onto your new image, so, right click on your new image and paste as a new selection. Position into the top left hand corner as much as possible and then just left click.

Now we need to give an alpha channel so go to selections select load/save selection and choose save selection to alpha channel and clcik ok/save in the pop-up.

Finally now click File and save copy as and name it Hostage_01.png using the .PNG file format and press yes to the pop-up. (this is so you have a nice image to upload to the forums).

Click File and save copy as again and this time name it nameofthemodel.vtf using the .VTF file format and press yes/ok to the pop-up.

It´s time to use the VTF plugin. Set the properties as:

Template = Compressed Texture With Alpha
Format = DXT5 (Common Format)
Mipmap Filter = Box
Sharpen Filter = Sharpen Soft

Check/tick Mipmaps and Thumbnail.

And from the list just make sure Eight Bit Alpha (Format Specific) and Nice Filter are both checked/ticked. Everything else should be unchecked/unticked, then press ok.

Finally add it to your obsidian/materials/VGUI/playermodels/player directory to finish.

Example image:

Example image: Hostage_01

Using Paint.NET

  1. Get the image (you know, "impr. pant" or another way to take a photo of your model).
  2. Prepare the image. If you are used "impr. pant", use the rectangule selection and select "cut selected" (after go to edit->paste as a new image). Only will have the image that it was inside of the rectangule. Use the "wand" tool and put the tolerancy level to 10% or less. Delete everything that surround the model.
  3. Go to "Image" and select "change size". Deactivate "keep relation size" and set the image in 200x200.
  4. Back to "Image" and select "change canvas size". Set 256x256 and select "upper left position".
  5. Save the image in .tga format with the name of the model.
  6. Drag and drop the .tga file into VTFedit. Press "ok" and save as .vtf format. Must have the same name of the model.
  7. Create the .vmt coping another .vmt from the materials/VGUI/playermodels/Player folder if you don´t want write it, change the directory of the image and put it in materials/VGUI/playermodels/Player.
  8. Sucess.

Fixing the facemap bug

Some models like this can present this bug after compiling the model. To fix this, go to the materials folder and edit the facemap material VTF (this model in particular uses the: art_facemap.VTF).

You will need to use the VTF Edit program to open the art_facemap.VTF file.

Once in the program and file is open, under the 'Image' tab is a list of check boxes, we need to un-check (un-tick). The: Clamp S and the Clamp T parameters. Save the file and check back in SDK Model Viewer by 'refreshing' the model and you'll see the face is now fixed.


All this tutorial is made for models with the Valvebiped skeleton (a.k.a. HL2 biped skeleton). If the model have different names in the bones or a different structure of the skeleton it will give problems.

In this case, open the refencial SMD file of the model in a Model editor program such as 3DS Max, XSI, Blender or others, and fix it changing the name of the bones or directly re-rigging the model with a new skeleton.

After do this, remember modificate too the phymodel and the ragdoll (and the animations file if the model have too).

If you are making a playermodel directly from a ragdoll (a model that doesnt have a HL2 skeleton), and you have problems when you try compile it, try adding the following to the .qc file:

$poseparameter move_yaw -180.00 180.00
$poseparameter body_pitch -90.00 90.00
$poseparameter body_yaw -90.00 90.00

$attachment "grenade0" "ValveBiped.Bip01_Spine" 5.99 0.39 7.59 rotate 76.91 71.22 57.14
$attachment "grenade1" "ValveBiped.Bip01_Spine" 6.24 -2.34 6.66 rotate 62.97 100.42 87.46
$attachment "grenade2" "ValveBiped.Bip01_Spine" -0.35 2.21 -8.34 rotate -75.89 92.68 95.17
$attachment "grenade3" "ValveBiped.Bip01_Spine" 1.22 -1.11 -7.34 rotate -78.22 82.38 102.13
$attachment "pistol" "ValveBiped.Bip01_R_Thigh" 0.05 3.84 -6.30 rotate 0.08 -2.59 79.96
$attachment "primary" "ValveBiped.Bip01_Spine2" 10.44 -5.10 -4.88 rotate -11.71 179.79 3.52
$attachment "defusekit" "ValveBiped.Bip01_Pelvis" 0.00 1.22 -6.66 rotate -73.06 90.93 179.75
$attachment "eholster" "ValveBiped.Bip01_L_Thigh" 5.36 0.02 4.90 rotate 8.31 -91.56 99.67
$attachment "lfoot" "ValveBiped.Bip01_L_Foot" -0.00 5.20 -0.00 rotate -0.00 0.00 -0.00
$attachment "rfoot" "ValveBiped.Bip01_R_Foot" 0.00 5.20 0.00 rotate 0.00 0.00 0.00
$attachment "muzzle_flash" "ValveBiped.Bip01_L_Hand" -0.00 -0.00 -0.00 rotate 0.00 -0.00 -0.00

Not always fix the problem, but at least you will have an another chance to get it work.

If HLMV (Half-Life model view) crashes when you load your model, try compiling it without the animations (add // or delete the lines of $$includemodel). You will be able to see it (but without animations), useful to search possible bugs. Normally, this happen when the skeleton isnt the HL2 biped type, or if you committed an error when you rigged the model.

If your model is invisible in HLMV (completely, doesnt proyect shadow), there is a problem with the rig of the model. Try re-rigging it again.

If only when the model got the "ragdoll" pose, and when you go to the "physics" tab, the model is screwed, then you will have to remade again the ragdoll SMD file (get the original referencial model, and export it to SMD as a sequence).

This page it will be very useful if you have an error with some of the programs that we use in this tutorial. It explains all about the problem, why it happens and how to fix it.

To add jigglebones to a model, follow this video. More information about $jigglebone command here.

If you have the following error when you are compiling the model in GUIStudioMDL:

ERROR: Too many materials used, max 32

Significates that you reach the limit of textures of the model. Try deleting the bodygroups of the model (if it have) or re-make the UVmapping.

If you use 3DS Max to modify a model, remember check in the SMD exporter plugin alternate normals export method to avoid make your model "polygonal". example photo (only when you are going to export the referencial model, for the ragdoll use the sequence option).

If you are going to do a model hack (for example, using the head of a model in a different body), it must have both the same skeleton. If not, remember rig the new part, or you will get bugs like this.

If you made a phymodel (Collision model), remember rig it with the skeleton, or you will have this bug.

Just before start the rigging of a model, make sure that the skeleton and the mesh are correctly sized. Use the male_01 or female_01 reference (copy the original model to another folder, decompile it and compare the referencial model inside your model editor with your model). A wrong size will cause deformations on the model like this.

Don´t know about how to rig models? No problem, follow the complete guide about how to do it made by MarioKart64n here.

Ask always permission if you are going to port/modify a model created for another person. If he/she accepts your request, don´t forget give credit him/her. NO, SERIOUSLY, ASK FOR IT, DONT BE AN ASSHOLE.

In case your model doesnt show a static shadow, add to the qc the command $opaque or $mostlyopaque. If after compile, in HLMV->model flag it show "model is opaque" instead of transparent, your model show have a static shadow now (it can happen that sometimes, a model with "transparent" have a static shadow, or a model with "opaque" still without having it. I dont know why happens this).

If after all you continue having problems or doubts about something, go to the forums to ask help (Modeling help forum). We will be always give you help (if you first respect us, obiously).