Difference between revisions of "How to make OC playermodels"
(Refined the contents and structure of the page) |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
{{wip}} | {{wip}} | ||
+ | __TOC__ | ||
− | Original tutorial written by | + | Original tutorial 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]. |
− | In this tutorial you will learn how to make a | + | In this tutorial, you will learn how to make a player model for Obsidian Conflict. |
− | == | + | ==Prerequisites== |
+ | *'''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 (Optional, unless you intend to modify a model from a 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 |
− | *''' | + | *'''MDLDecompiler''': Self-explanatory. http://www.chaosincarnate.net/cannonfodder/mdldecompiler.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 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 |
− | *'''Notepad++ | + | *'''VTFEdit (Optional if you intend to use ''Notepad++'' to open [http://developer.valvesoftware.com/wiki/Vmt .vmt] files instead)''': http://nemesis.thewavelength.net/index.php?c=178 |
− | *''' | + | *'''An Image Editor''' (such as ''Paint.NET'', ''Adobe Photoshop'', ''Paint Shop Pro'') |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ==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 → ''New'' → ''Folder''). Copy your model's materials into the new folder you created, then open their <tt>.vmt</tt> files. | ||
+ | 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" | + | "$envmap" "env_cubemap" |
− | + | "$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 | + | 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. | ||
+ | |||
+ | 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>. | ||
+ | |||
+ | '''Note:''' If you reference an invalid path, your model will have the infamous error texture (i.e. a purple and black checkerboard texture will be seen instead). | ||
− | + | 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 [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> → <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'', 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. | |
− | Open MDLDecompiler | ||
+ | '''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> | |
− | |||
+ | 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 (but not a word processor like ''Wordpad'' or ''Microsoft Word''!). | ||
− | This file | + | This script file determines the Studiomdl configuration for the model. A snippet is provided below: |
− | <pre>$cd "C:\Users\ | + | <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 95: | ||
$rootbone "valvebiped.bip01_pelvis" | $rootbone "valvebiped.bip01_pelvis" | ||
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1" | $jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1" | ||
+ | </pre> | ||
− | |||
− | + | A breakdown of the important components of the script: | |
− | |||
+ | *<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. | ||
− | + | *<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>. | |
+ | *<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. | ||
− | + | *<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: | |
+ | <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 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> | ||
− | ''' | + | *<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. | ||
− | + | 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 <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'' → ''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'' → ''Load 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 <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. | |
− | + | "usefile" "none" | |
− | + | //base model rig to use. 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" | |
}</pre> | }</pre> | ||
− | + | With this file, you can configure the voice, footstep sounds and gibs of the model. | |
− | |||
− | + | 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. | |
− | + | '''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 | ||
{ | { | ||
− | + | "$translucent" "1" | |
− | + | "$basetexture" "vgui\playermodels\player\Hostage_01" | |
− | + | "$vertexcolor" "1" | |
− | + | "$vertexalpha" "1" | |
− | + | "$no_fullbright" "1" | |
− | + | "$ignorez" "1" | |
− | + | "$decalscale" "0.250" | |
− | |||
− | |||
}</pre> | }</pre> | ||
− | + | 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. | ||
− | |||
+ | 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> → <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. | ||
− | ==== | + | ==Tips And Tricks== |
− | + | ===Creating The VGUI Preview Image=== | |
− | + | *'''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'''). | |
− | You will also need to download and install a | ||
− | |||
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. | ||
(Prefebably you want the model holding an oc weapon and you can use centre view to get the model where you want it. | (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. | 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). | 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. | 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. | 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. | 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. | 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. | Now 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 | Now 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. | ||
(Baically you want to delete the back ground and not the model itself). | (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. | 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. | 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. | Now 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 go to File and create a new image with these properties: | |
− | |||
− | |||
− | |||
− | |||
<pre>width =256 pixels | <pre>width =256 pixels | ||
Line 265: | Line 232: | ||
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. | ||
− | + | 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). | ||
− | + | 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. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Now here we are using the VTF plugin. Set the properties as: | Now here we are using the VTF plugin. Set the properties as: | ||
Line 285: | Line 247: | ||
Sharpen Filter = Sharpen Soft</pre> | Sharpen Filter = Sharpen Soft</pre> | ||
− | + | 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. | ||
− | |||
Finally add it to your obsidian/materials/VGUI/playermodels/player directory to finish. | Finally add it to your obsidian/materials/VGUI/playermodels/player directory to finish. | ||
− | |||
Example image: | Example image: | ||
[[File:Hostage01.png|frame|Example image: Hostage_01]] | [[File:Hostage01.png|frame|Example image: Hostage_01]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Miscellaneous_Tutorials]] | [[Category:Miscellaneous_Tutorials]] |
Revision as of 16:52, 8 April 2011
Contents
Original tutorial written by fug4life, with tips and tricks from Maestro Fénix.
In this tutorial, you will learn how to make a player model for Obsidian Conflict.
Prerequisites
- 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 (Optional, unless you intend to modify a model from a game): Allows you to browse and extract the contents of Game Cache Files (GCFs). http://nemesis.thewavelength.net/index.php?p=26
- MDLDecompiler: Self-explanatory. http://www.chaosincarnate.net/cannonfodder/mdldecompiler.php
- GUI StudioMDL: This program is a GUI front end for the Studiomdl tool in the Source SDK. http://www.wunderboy.org/apps/guistudiomdl2.php
- Notepad++ (Optional only for models for Source Engine 2006 and below): You can use this or any other hex editor. http://notepad-plus.sourceforge.net/uk/site.htm
- VTFEdit (Optional if you intend to use Notepad++ to open .vmt files instead): http://nemesis.thewavelength.net/index.php?c=178
- An Image Editor (such as Paint.NET, Adobe Photoshop, Paint Shop Pro)
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 → New → Folder). 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 (i.e. a purple and black checkerboard texture will be seen instead).
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. IDST0 → IDST,).
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 (but not a word processor like Wordpad or 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 File → Load .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 File → Load 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. 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" }
With this file, you can configure the voice, footstep sounds and gibs of the model.
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 Options → Multiplayer 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.
Tips And Tricks
Creating The VGUI Preview Image
- 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).
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.
Now 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 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.
Now 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 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.
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.
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).
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.
Now here we are using 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: