How to make OC playermodels

From Obsidian Conflict Wiki
Revision as of 13:29, 8 April 2011 by Maestro Fenix (talk | contribs)
Jump to: navigation, search
WIP.png This page is still a Work In Progress


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.


You will need...

  • Source Development Kit (SDK): Available in your Steam->Games->Tools
  • A image editing program (Paint.net, Photoshop, Paint Shop...)


Preparing the textures

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:


"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" so that it reflects where your textures are located, E.G. "Models/player/MyFirstModel/mossman_sheet".

(If you enter something invalid, your model will have the error texture(purple & black checkered))

Once you have modified all the .VMT files, you are ready to convert the model to be used as a playermodel.


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.


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

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.


This file sets all the configuration of the model. This is an example:

$cd "C:\Users\Rafa\Desktop\Nueva carpeta (5)"
$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"

(more things)


$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:
$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: It used to define what type of physical surface have the model. The default is flesh (organic-human). The complete list is 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.


And that´s is all you must modify to make a playermodel.


Giving the final touches

Save it and open GUIStudioMDL. Select OrangeBox in "SDK version" and select in "Target mod/gameinfo path" Obsidian Conflict (you must have configurated SDK for OC). Load the .QC file in file->load .qc file and push the "Compile" button.

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


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"
}

Using the values that come there, you can set the voice, sounds and gibs of the model.


Lastly, go to Obsidian/materials/VGUI/playermodels/player and create a .VMT file and .VTF file.

In the .VMT file (you can copy an existant one and clear it to use), put the following:


UnlitGeneric
{
// Original shader: BaseTimesVertexColorAlphaBlendNoOverbright
   "$translucent" "1"
   "$basetexture"   "vgui\playermodels\player\Hostage_01"
   "$vertexcolor" "1"
   "$vertexalpha" "1"
   "$no_fullbright" "1"
   "$ignorez"   "1"
   "$decalscale" "0.250"

}

In "$basetexture", change the "hostage_01" for the name of your .VTF file, that must be named like 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 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.



Tips & tricks

Making the VGUI:

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


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.


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.


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


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:

Example image: Hostage_01


With Paint.Net:

  1. Get the image (you know, "impr. pant" or another way to take a photo of your model).


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


  1. Go to "Image" and select "change size". Deactivate "keep relation size" and set the image in 200x200.


  1. Back to "Image" and select "change canvas size". Set 256x256 and select "upper left position".


  1. Save the image in .tga format with the name of the model.


  1. Drag and drop the .tga file into VTFedit. Press "ok" and save as .vtf format. Must have the same name of the model.


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


  1. Sucess.