Difference between revisions of "How to make OC playermodels"

From Obsidian Conflict Wiki
Jump to: navigation, search
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__TOC__
+
Originally written by [http://www.obsidianconflict.net/forums/memberlist.php?mode=viewprofile&u=458 fug4life], with tips and tricks from [http://www.obsidianconflict.net/forums/memberlist.php?mode=viewprofile&u=1667 Maestro Fénix] and [http://obsidianconflict.net/forums/memberlist.php?mode=viewprofile&u=1305 TESLA-X4].
  
{{wip}}
+
In this tutorial, you will learn how to make a player model for Obsidian Conflict.
  
  
Original tutorial written by Fug, with added tips and tricks by Maestro Fénix.
 
  
In this tutorial you will learn how to make a playermodel 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'''.
  
  
==You will need...==
+
==Prerequisites==
  
 +
*'''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 (SDK):''' Available in your Steam->Games->Tools  
+
*'''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.
  
*'''GCFScape''' (Enables you to browse/extract the Game Cache Files (GCFs). Optional): http://nemesis.thewavelength.net/index.php?p=26  
+
*'''GCFScape (Optional, unless you intend to modify a model from an official Valve game)''': Allows you to browse and extract the contents of [http://developer.valvesoftware.com/wiki/GCF Game Cache Files (GCFs)]. http://nemesis.thewavelength.net/index.php?p=26
  
*'''Model Decompiler:''' http://www.chaosincarnate.net/cannonfodder/mdldecompiler.php
+
*'''MDLDecompiler''': Self-explanatory. http://www.chaosincarnate.net/cannonfodder/mdldecompiler.php
  
*'''GUI Studio Compiler:''' http://www.wunderboy.org/apps/guistudiomdl2.php  
+
*'''GUI StudioMDL''': This program is a GUI front end for the [http://developer.valvesoftware.com/wiki/Studiomdl Studiomdl] tool in the Source SDK. http://www.wunderboy.org/apps/guistudiomdl2.php
  
*'''Notepad++ (optional):''' http://notepad-plus.sourceforge.net/uk/site.htm  
+
*'''Notepad++ (Optional only for models for [http://developer.valvesoftware.com/wiki/Source_Engine_2006 Source Engine 2006] and below)''': You can use this or any other hex editor. http://notepad-plus.sourceforge.net/uk/site.htm
  
*'''VTFEdit:''' http://nemesis.thewavelength.net/index.php?c=178  
+
*'''VTFEdit''': http://nemesis.thewavelength.net/index.php?c=178  
  
*'''A image editing program (Paint.net, Photoshop, Paint Shop...)'''
+
*'''An Image Editor''' (such as ''Paint.NET'', ''Adobe Photoshop'', ''Paint Shop Pro'' or others).
  
  
==Preparing the textures==
+
==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 <tt>obsidian</tt> folder (inside <tt>Steam/steamapps/sourcemods</tt> for the uninitiated) and proceed to navigate to <tt>materials/models/player</tt>. Create a new folder (with the name of your model) inside this folder (right-click an empty area &rarr; ''New'' &rarr; ''Folder''). Copy your model's materials into the new folder you created, then open their <tt>.vmt</tt> files.
First, you need to create a new folder for the model you're going to make. Go to the Obsidian Conflict folder (remember: Steam/steamapps/sourcemods/obsidian), and then navigate to materials/models/player Create a new folder in this directory with the name of your model; copy the materials that your model uses into this folder, then open the VMT files.
 
 
 
 
 
You will see something like this:
 
 
 
  
 +
You should see something like this, in typical [http://developer.valvesoftware.com/wiki/KeyValues KeyValues] format:
 
<pre>"VertexLitGeneric"
 
<pre>"VertexLitGeneric"
 
{
 
{
 
"$baseTexture" "Models/player/Mossman/mossman_sheet"
 
"$baseTexture" "Models/player/Mossman/mossman_sheet"
"$envmap" "env_cubemap"
+
"$envmap" "env_cubemap"
                "$bumpmap" "models/player/Mossman/Mossman_normal"
+
"$bumpmap" "models/player/Mossman/Mossman_normal"
"$normalmapalphaenvmapmask" 1
+
"$normalmapalphaenvmapmask" "1"
"$envmapcontrast" .20
+
"$envmapcontrast" ".20"
"$envmapsaturation"0.9
+
"$envmapsaturation" "0.9"
 
"$envmaptint" "[ .36 .36 .36 ]"
 
"$envmaptint" "[ .36 .36 .36 ]"
         "$halflambert" 1
+
         "$halflambert" "1"
 
"$nodecal" "1"
 
"$nodecal" "1"
 
}</pre>
 
}</pre>
  
Go to the "$baseTexture" line, and change "Models/player/Mossman/mossman_sheet" so that it reflects where your textures are located, E.G. "Models/player/MyFirstModel/mossman_sheet".
+
Go to the <tt>$baseTexture</tt> line, and change <tt>Models/player/Mossman/mossman_sheet</tt> to point to where your textures (i.e. the [http://developer.valvesoftware.com/wiki/VTF .vtf]s) are located.
 +
In the case of the above example, it would become <tt>Models/player/<span style="color:red;"><your model name></span>/mossman_sheet</tt>, where <tt><span style="color:red;"><your model name></span></tt> is the name of your model.
  
(If you enter something invalid, your model will have the error texture(purple & black checkered))
+
We're not done yet - you will also need to replace all occurences of <tt>Models/player/Mossman/</tt> with <tt>Models/player/<span style="color:red;"><your model name></span>/</tt> in that <tt>.vmt</tt> file. To illustrate, in the above example, the line <tt>$bumpmap</tt> also needs to be changed from <tt>models/player/Mossman/Mossman_normal</tt> to <tt>models/player/<span style="color:red;"><your model name></span>/Mossman_normal</tt>.
  
Once you have modified all the .VMT files, you are ready to convert the model to be used as a playermodel.
+
'''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 <tt>.vmt</tt> 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++. Go to the first line and search IDST0. If is the same, then is ok. If you found it as a IDST, , change it to IDST0. This will allow you decompile an Orange Box model.
+
==Converting The Model==
 +
Go to the model files, and open the [http://developer.valvesoftware.com/wiki/MDL .mdl] file with ''Notepad++'' (or your favorite hex editor). The first four bytes in the file should be <tt>IDST</tt> (hexadecimal sequence: <tt>0x49</tt>, <tt>0x44</tt>, <tt>0x53</tt>, <tt>0x54</tt>). Now, verify that the fifth byte (immediately after the <tt>T</tt>) is a <tt>,</tt> (comma, hexadecimal: <tt>0x2C</tt>). If it is, then you can safely close the program; nothing else needs to be done. If it is something else, such as a <tt>0</tt> (zero, hexadecimal: <tt>0x30</tt>) or a <tt>-</tt> (minus sign, hexadecimal: <tt>0x2D</tt>), you will need to change it back to a comma (i.e. <tt>IDST0</tt> &rarr; <tt>IDST,</tt>).
  
+
'''Note:''' This workaround is required because the model decompiler was written before games on [http://developer.valvesoftware.com/wiki/Source_Engine_2007 Source Engine 2007 and 2009] were released, and was never updated for forward compatibility by its author.
Open MDLDecompiler. Select the model that you want decompile and the folder where you want put the files. Wait until a pop-out window appears saying "(model) model decompiled".
 
  
  
(If for some reason crashes, try again 3-4 times. If still without work, try with [http://www.chaosincarnate.net/cannonfodder/cftools.htm StudioCompiler].
+
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.
  
Go to the folder where the new files are. You will see some files with the extension .SMD and a single file with the extension .QC called mdldecompiler. Open it with Wordpad.
+
'''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 [http://www.chaosincarnate.net/cannonfodder/cftools.php?program=studiocompiler StudioCompiler], or [http://developer.valvesoftware.com/wiki/User:Erix920 Erix920]'s [http://kathar.net/other/mdldecompiler.exe modified version of MDLDecompiler] instead.
  
 +
<span style="color:red;">'''Additional Note:''' In certain cases, MDLDecompiler will seem to work perfectly fine - no crashes or error messages are generated - but will actually generate corrupted [http://developer.valvesoftware.com/wiki/SMD .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 <tt>.smd</tt> files are unusually small (< 1 MB), coupled with an unusually large physics model <tt>.smd</tt> (> 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.</span>
  
This file sets all the configuration of the model. This is an example:
 
  
<pre>$cd "C:\Users\Rafa\Desktop\Nueva carpeta (5)"
+
Go to the folder where the resulting files are. You will see several files with the <tt>.smd</tt> extension and a file <tt>mdldecompiler.qc</tt>. Open the [http://developer.valvesoftware.com/wiki/Qc .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:
 +
 
 +
<pre>$cd "C:\Users\User\Desktop\New folder"
 
$modelname "player\Flandre.mdl"
 
$modelname "player\Flandre.mdl"
 
$model "body" "ref.smd"
 
$model "body" "ref.smd"
Line 96: Line 97:
 
$rootbone "valvebiped.bip01_pelvis"
 
$rootbone "valvebiped.bip01_pelvis"
 
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"
 
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"
 
+
</pre>
(more things)</pre>
 
 
 
 
'''$cd''' indicates where the compiler must read the decompilated files (change it if after decompile the model you moved this files to another folder).
 
 
 
 
 
'''$modelname''' indicates the path where will be created the model and their name. Change it for the path that the model will use and their name if you want rename it. For a playermodel the path is "player/nameofthemodel.mdl".
 
 
 
 
 
'''$cdmaterials''' indicates the path where will be the textures of the model. Write right the path or you will see your model black and purple chequered.
 
 
 
 
 
'''$includemodel''' indicates the path and the name of the animations of the model. For make a Obsidian Conflict playermodel you must put:
 
  
  
*For a male model:
+
A breakdown of the important components of the script:
  
<pre>$includemodel "player/male_shared.mdl"
+
*<tt>$cd</tt>: A pointer to the folder where the <tt>.smd</tt> files reside in. If you moved these files elsewhere after decompiling the model, modify this to reflect that change.
$includemodel "player/male_ss.mdl"
 
$includemodel "player/male_gestures.mdl"
 
$includemodel "player/male_postures.mdl"</pre>
 
  
 +
*<tt>$modelname</tt>: This command determines where the resulting model will be placed in, with respect to the <tt>models</tt> folder. Using the above snippet as an example, the resulting (compiled) model will be located at <tt>models/player/Flandre.mdl</tt>.
  
*For a female model:
+
*<tt>$cdmaterials</tt>: A pointer to the folder where the materials for the model reside in, with respect to the <tt>materials</tt> folder. Using the above snippet as an example, the full path will be <tt>materials/models/player/Flandre/</tt>. Ensure that the path is valid or your model will end up with purple and black checkerboard textures instead.
  
<pre>$includemodel "player/female_shared.mdl"
+
*<tt>$includemodel</tt>: 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:
$includemodel "player/female_ss.mdl"
+
<br />
$includemodel "player/female_gestures.mdl"
+
<div style="padding: 0.5em 1em 0.5em 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em;">
$includemodel "player/female_postures.mdl"</pre>
+
'''For a male model''':<br />
 +
<tt>$includemodel "player/male_shared.mdl"<br />
 +
$includemodel "player/male_ss.mdl"<br />
 +
$includemodel "player/male_gestures.mdl"<br />
 +
$includemodel "player/male_postures.mdl"</tt>
 +
</div>
 +
<br />
 +
<div style="padding: 0.5em 1em 0.5em 1em; border: 1px dashed #2f6fab; color: black; background-color: #f9f9f9; line-height: 1.1em;">
 +
'''For a female model''':<br />
 +
<tt>$includemodel "player/female_shared.mdl"<br />
 +
$includemodel "player/female_ss.mdl"<br />
 +
$includemodel "player/female_gestures.mdl"<br />
 +
$includemodel "player/female_postures.mdl"</tt>
 +
</div>
  
  
'''$surfaceprop:''' It used to define what type of physical surface have the model. The default is flesh (organic-human). The complete list is [http://developer.valvesoftware.com/wiki/Material_surface_properties here]. '''Note:''' If you used this command in the .VMT files to define multiple types of surface, and now you use here this command, it will override them. Eliminate the command from the mdldecompiler.qc or use the "default" value.
+
*<tt>$surfaceprop</tt>: Used to define the physical surface properties the model will have. The default is <tt>flesh</tt> (organic-human). The complete list is available [http://developer.valvesoftware.com/wiki/Material_surface_properties here].
 +
'''Note:''' If this command was used in the <tt>.vmt</tt> files to define multiple surface types and is also present in the <tt>.qc</tt> script, the values set in the <tt>.vmt</tt> files will be ignored. If this behavior is not desired, either delete this command from the <tt>mdldecompiler.qc</tt> script, or specify the value as <tt>default</tt> instead.
  
  
And that´s is all you must modify to make a playermodel.  
+
This is all that you will typically need to modify in order to make a player model compatible with Obsidian Conflict.
  
  
==Giving the final touches==
+
==Finishing Touches==
 +
Save the script file and open ''GUI StudioMDL''. Select <tt>OrangeBox</tt> for <tt>SDK Version</tt> and for <tt>Target Mod or "GameInfo" path</tt> select <tt>Obsidian Conflict</tt> (you will need to [[Obsidian SDK Setup|configure the Source SDK for Obsidian Conflict]] prior to this). Go to ''File'' &rarr; ''Load .qc file'' and load the <tt>.qc</tt> file, then click on the <tt>Compile</tt> button.
  
 +
When ''GUI StudioMDL'' finishes compiling the model (you should see <tt>Completed "mdldecompiler.qc"</tt>), open the ''Source SDK'', select <tt>Source 2007</tt> in the <tt>Engine Version:</tt> combo box and select <tt>Obsidian Conflict</tt> in the <tt>Current Game:</tt> combo box (once again, you will need to [[Obsidian SDK Setup|configure the Source SDK for Obsidian Conflict]] prior to this), then click on <tt>Model Viewer</tt>. When ''Half-Life Model Viewer'' loads up, go to ''File'' &rarr; ''Load model...'' and select your model.
  
Save it and open GUIStudioMDL. Select OrangeBox in "SDK version" and select in "Target mod/gameinfo path" Obsidian Conflict (you must have [http://wiki.obsidianconflict.net/?title=Obsidian_SDK_Setup configurated SDK for OC]). Load the .QC file in file->load .qc file and push the "Compile" button.
+
If all went well, you should now see your model, complete with working animations.
 
 
Once GUIStudioMDL finished compiling (it will say "Completed "mdldecompiler.qc""), open Source SDK, select Source 2007 in "Engine version" and Obsidian Conflict in "Current game" (you need have to be [http://wiki.obsidianconflict.net/?title=Obsidian_SDK_Setup configurated SDK for OC]). Once HLMV get opened, go to file->load model and search your model.
 
 
 
 
 
And if everything are went good, you should be able to see your model with their animations.
 
 
 
Once you see that your model work, go to Obsidian/models/player folder and create a new text file. Call it with the same name of your model and put this:
 
  
  
 +
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 <tt>.txt</tt> extension. Using the previous snippet as an example, the file would be <tt>models/player/Flandre.<span style="color:red;">txt</span></tt>.
 +
Paste the following inside the file (don't forget to alter the gender of the <tt>base model rig</tt> and <tt>voice</tt> as necessary):
 
<pre>ModelSettings
 
<pre>ModelSettings
 
{
 
{
  //Use this option to choose a base script to use instead.
+
//Use this option to choose a base script to use instead.
  "usefile"   "none"
+
"usefile" "none"
  
  //base model rig to use. Use either Male_01 or Female_01 for best results.
+
//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"
+
"basemodel" "Male_01"
  
  //Voice Sound 0=none, 1=male, 2=female, 3=combine
+
//Voice Sound 0=none, 1=male, 2=female, 3=combine
  "voice"     "1"
+
"voice" "1"
  
  //Footstep Sound 1=shoe, 2=combine boots
+
//Footstep Sound 1=shoe, 2=combine boots
  "footsteps"   "1"
+
"footsteps" "1"
  
  //Gibs, 1 = generic human, 2 = generic alien, 3 = human rebel ragdoll gibs, 4 = Ragdoll only
+
//Gibs, 1 = generic human, 2 = generic alien, 3 = human rebel ragdoll gibs, 4 = Ragdoll only
  "Gibs"     "4"
+
"Gibs" "4"
 +
 
 +
//Determines if this model should be considered anime-related, 0 = no, 1 = yes
 +
"anime" "0"
 
}</pre>
 
}</pre>
 +
With this file, you can configure the voice, footstep sounds and gibs of the model.
  
Using the values that come there, you can set the voice, sounds and gibs of the model.
+
<span style="color:red;">'''Note:''' At the time of writing, the <tt>anime</tt> 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.</span>
  
  
Lastly, go to Obsidian/materials/VGUI/playermodels/player and create a .VMT file and .VTF file.  
+
Finally, head over to <tt>obsidian/materials/VGUI/playermodels/player</tt> and create a new <tt>.vmt</tt> and <tt>.vtf</tt> file with the same name as your model's <tt>.mdl</tt> file.
  
In the .VMT file (you can copy an existant one and clear it to use), put the following:
+
'''Note:''' The path after <tt>obsidian/materials/VGUI/playermodels/</tt> '''must''' reflect the path to the model, i.e. if the model is at <tt>models/player/somemodelname/somemodel.mdl</tt>, the two files will be <tt>obsidian/materials/VGUI/playermodels/player/somemodelname/somemodel.vmt</tt> and <tt>obsidian/materials/VGUI/playermodels/player/somemodelname/somemodel.vtf</tt>.
  
  
 +
In the <tt>.vmt</tt> file (you can make a copy of an existing one and clear it for use), paste the following:
 
<pre>UnlitGeneric
 
<pre>UnlitGeneric
 
{
 
{
// Original shader: BaseTimesVertexColorAlphaBlendNoOverbright
+
"$translucent" "1"
  "$translucent" "1"
+
"$basetexture" "vgui\playermodels\player\Hostage_01"
  "$basetexture"   "vgui\playermodels\player\Hostage_01"
+
"$vertexcolor" "1"
  "$vertexcolor" "1"
+
"$vertexalpha" "1"
  "$vertexalpha" "1"
+
"$no_fullbright" "1"
  "$no_fullbright" "1"
+
"$ignorez" "1"
  "$ignorez"   "1"
+
"$decalscale" "0.250"
  "$decalscale" "0.250"
 
 
 
 
}</pre>
 
}</pre>
  
In "$basetexture", change the "hostage_01" for the name of your .VTF file, that must be named like your model.
+
On the <tt>$basetexture</tt> line, change <tt>Hostage_01</tt> to point to your accompanying <tt>.vtf</tt> file.
  
 +
To create that <tt>.vtf</tt> file, take a screenshot in ''Half-Life Model Viewer'' then save it as a <tt>.tga</tt> file and open that in ''VTFEdit'', then save it in the <tt>.vtf</tt> format. Give it the same name as your model.
  
To create the .VTF file, take your photo, transform it to .tga, open it in VTFEdit and save it in .VTF format. Name it like your model.
 
  
 +
Once you have placed the two files into your client's <tt>obsidian/materials/VGUI/playermodels/player</tt> 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 <tt>Options</tt> &rarr; <tt>Multiplayer</tt> 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 <tt>sv_cheats</tt>. Execute the <tt>thirdperson</tt> command.
  
Once you have colocated the two files in the Obsidian/materials/VGUI/playermodels/player path, test it in game (check if the VGUI image work properly). If everything work (animations, sounds, image...) then significates that you create with success a playermodel.
 
  
 +
== Extra ==
  
 +
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===
==Tips & tricks==
+
====Using Paint Shop Pro====
 
+
You will also need to download and install a [http://nemesis.thewavelength.net/index.php?p=39 VTF Plugin for Paint Shop Pro] beforehand (Information about how to use it and what programs can use it [http://developer.valvesoftware.com/wiki/Photoshop_VTF_Plugin here]).
 
 
 
 
'''Making the VGUI:'''
 
 
 
 
 
 
 
*'''With Paint Shop Pro:'''
 
 
 
 
 
You will also need to download and install a '''http://nemesis.thewavelength.net/index.php?p=39 VTF Plugin for Paint Shop Pro''' beforehand (Information about how to use it and what programs can use it '''http://developer.valvesoftware.com/wiki/Photoshop_VTF_Plugin here''').
 
  
 
So, Open Paint Shop Pro and open the screenshot (.tga file) you took in SDK Model Viewer earlier.
 
So, Open Paint Shop Pro and open the screenshot (.tga file) you took in SDK Model Viewer earlier.
Line 224: Line 218:
 
Now, click layers and select new mask layer/show all.
 
Now, click layers and select new mask layer/show all.
  
Now you will see the picture has a mask-raster 1 layer, right click and select delete and then yes.
+
You will see the picture has a mask-raster 1 layer, right click and select delete and then yes.
  
Now select the Magic Wand tool set up with something like mode = replace
+
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.
 
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.
 
Click on the background on the image and not the model to use the Magic Wand.
Line 234: Line 228:
 
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.
 
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.
  
Now click layers select new mask layer/form image, make sure source opacity is checked and everything else is unchecked, click ok.
+
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.
 
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.
  
Now go to File and create a new image with these properties:
+
Go to File and create a new image with these properties:
  
 
<pre>width =256 pixels
 
<pre>width =256 pixels
Line 249: Line 243:
 
And check the Transparent box.
 
And check the Transparent box.
  
Now to 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.
+
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.
 
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.
Line 255: Line 249:
 
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).
 
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).
  
Now 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.
+
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.
  
Now here we are using the VTF plugin. Set the properties as:
+
It´s time to use the VTF plugin. Set the properties as:
  
 
<pre>Template = Compressed Texture With Alpha
 
<pre>Template = Compressed Texture With Alpha
Line 264: Line 258:
 
Sharpen Filter = Sharpen Soft</pre>
 
Sharpen Filter = Sharpen Soft</pre>
  
check/tick Mipmaps and Thumbnail.
+
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.
 
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.
Line 272: Line 266:
 
Example image:
 
Example image:
  
[[File: http://img17.imageshack.us/img17/9614/hostage01.png|frame|Example image: Hostage_01]]
+
[[File:Hostage01.png|frame|Example image: Hostage_01]]
 +
 
 +
 
 +
====Using Paint.NET====
 +
 
 +
# Get the image (you know, "impr. pant" or another way to take a photo of your model).
 +
# 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.
 +
# Go to "Image" and select "change size". Deactivate "keep relation size" and set the image in 200x200.
 +
# Back to "Image" and select "change canvas size". Set 256x256 and select "upper left position".
 +
# Save the image in .tga format with the name of the model.
 +
# Drag and drop the .tga file into VTFedit. Press "ok" and save as .vtf format. Must have the same name of the model.
 +
# 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.
 +
# Sucess.
 +
 
 +
 
 +
===Fixing the facemap bug===
 +
 
 +
 
 +
Some models like [http://img17.imageshack.us/img17/7545/badfacemap.jpg 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: <tt>Clamp S</tt> and the <tt>Clamp T</tt> parameters. Save the file and check back in SDK Model Viewer by 'refreshing' the model and you'll see the face is now fixed.
 +
 
 +
 
 +
 
 +
===Recommendations===
 +
 
 +
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:
 +
 
 +
<pre>$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</pre>
 +
 
 +
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 [http://kathar.net/hl2modding/errors.php 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 [http://www.youtube.com/watch?v=tmfK-xlNn88 video]. More information about $jigglebone command [http://developer.valvesoftware.com/wiki/$jigglebone here].
 +
 
 +
 
 +
If you have the following error when you are compiling the model in GUIStudioMDL:
 +
 
 +
<pre>ERROR: Too many materials used, max 32</pre>
 +
 
 +
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 <tt>alternate normals export method</tt> to avoid make your model "polygonal". [http://img585.imageshack.us/img585/2839/21223383.jpg example photo] (only when you are going to export the referencial model, for the ragdoll use the <tt>sequence</tt> 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 [http://img543.imageshack.us/img543/5624/56712636.jpg this].
 +
 
 +
 
 +
If you made a phymodel ([http://developer.valvesoftware.com/wiki/Jointed_collision_model Collision model]), remember rig it with the skeleton, or you will have [http://img228.imageshack.us/img228/2781/33368549.jpg 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 [http://img63.imageshack.us/img63/518/10321754.png this].
 +
 
 +
 
 +
Don´t know about how to rig models? No problem, follow the complete guide about how to do it made by MarioKart64n [http://www.facepunch.com/showthread.php?t=542906 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 ([http://obsidianconflict.net/forums/viewforum.php?f=7 Modeling help forum]). We will be always give you help (if you first respect us, obiously).
 +
 
  
 
[[Category:Miscellaneous_Tutorials]]
 
[[Category:Miscellaneous_Tutorials]]

Latest revision as of 18:47, 14 May 2012

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.


Prerequisites

  • 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:

"VertexLitGeneric"
{
	"$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):

ModelSettings
{
	//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:

UnlitGeneric
{
	"$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.


Extra

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.


Recommendations

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).