Tutorials

Re-skinning a Counter-Strike: Source Model




Reskinning a Counter Strike Source model

This tutorial was created on a Windows OS. I do not offer support for the MAC OS as I do not own this operating system.

Description and aim:
Welcome to my up-to-date tutorial on how to edit a skin for a CSS model. Editing a CSS skin for player models will be our primary goal for this tutorial.

Before you begin this tutorial, I'd like to remind you that nothing is easy during the process. It's a long and time consuming process the first time you attempt to do the tutorial. During the process you will encounter a lot of errors and mistakes. These should not be taken as setbacks as you will eventually learn the process if you are patient enough and give yourself the time to learn.

I have learned the process myself by using the following tutorials and mixing them with my own knowledge of skinning: Mani-Admin-Plugin forum: How to recompile skins (Tutorial does not exist anymore) - Interlopers forum: Skinning models.
The issue with both of the above is that they're not up-to-date and they may be quite confusing for newbies in the field. During the tutorial, I may use quotes from both of the above sources.

Without the above tutorials, the creation of this tutorial would not have taken place, so therefore I would like to thank both authors for their tutorials. If they hadn't made these tutorials, I wouldn't have made my own. :)

It is, of course, not necessary for you to read these tutorials, but they may be helpful after you have completed mine.

NOTE: Please refer to the "Known Issues" part of this tutorial (near the end) when encountering any error(s) during the process. I have tried to address all issues occurring during the process of reskinning, so please check the available workarounds and fixes for these before asking any questions.

Programs we will be using during the process:

  • The Source SDK - Required in case you want to edit anything at all. The Source SDK can be downloaded as below:

    • Open the Steam window.
    • Click on the "View" tab.
    • Click "Tools".
    • Double-click on the Source SDK entry.
    • The Source SDK will then be downloaded to your computer via Steam.



Using the SDK will be explained later in this tutorial.

  • Adobe Photoshop - This is the image editing tool I would recommend for more advanced users, but if you're not familiar with it, you could always try some simple and free alternatives:

    • The Gimp - Freeware image editing tool. Recommended for the newbie.
    • Paint.Net - Freeware image editing tool. Recommended for the newbie.



  • Cannonfodder's MDL decompiler - Decompiling program, used to 'extract' the actual model files from within. How to install this, will be explained later in this tutorial.
  • Nem's VTFLib - Used to import and to export the textures. The actual skin material.



These are the programs we will be using for our reskinning process. If some of the above terms seem confusing, feel free to use TheFreeDictionary.com to find the definitions. :)

If you already feel the process is confusing by now, by all means do NOT quit! You will eventually get the hint of it and understand the process. Be patient. The next steps are going to be easier to follow.

Getting started...
As the first step of this tutorial, I will be explaining how to use and install some of the required programs we listed above. First off, the Source SDK.

1: Installing and setting up the Source SDK
Assuming you have downloaded the SDK as suggested above, you should now do the following steps:

  • Open the Steam Window.
  • Click the "View" tab.
  • Click "Tools".
  • Now double click the Source SDK or right click it and select "play game".
  • You have now opened the Source SDK. At the bottom of the SDK window, you should have two options to select from: "Engine Version" and "Current Game".

    At "Engine Version", please select "Source Engine 2006".
    At "Current Game", please select "Counter-Strike Source".

    We have done the above because we want to edit skins for Counter Strike Source, which is a game that uses the Source Engine 2006 (If you do not understand this, don't worry).

    NOTE: If "Counter-Strike Source" is NOT listed under "Current Game", please select the "Reset Game Configurations" in the Source SDK window.
  • Having done all of that, you're now free to close the Source SDK.



2: Setting up the MDL decompiler
Having downloaded the MDL decompiler, go to your Steam directory (C:\Program Files\Steam). Proceed to the "steamapps" folder and choose the folder that is equal to the Steam Account you're using.

Example:
C:\Program Files\Steam\steamapps\username

Once you're here, you should find several folders. Select the "sourcesdk" folder. Once inside the "sourcesdk" folder, select the "bin" and continue to the "ep1" folder and once more to another "bin" folder.

You should now be located in the following directory:
C:\Program Files\Steam\steamapps\username\sourcesdk\bin\ep1\bin

Now you may go back to the place you've downloaded your MDL decompiler and extract the files to the above directory we have just located (C:\Program Files\Steam\steamapps\username\sourcesdk\bin\ep1\bin).

You should now be ready to use the MDL Compiler.

3: Using the MDL decompiler. Decompiling the models we want to reskin...
Now that we have extracted the mdldecompiler.exe to our sourcesdk/bin/ep1/bin folder, we would like to open it. Once opened, it's time to select the MDL (model) file we want to decompile. For this example, I'd like to decompile Lolobubu's France skin, because that's the model I want to decompile in order to be able to reskin it!

At this point, you may select your own model that you wish to reskin but I would suggest you to use the same skin as I, so the process of reskinning can be simplified.

You can now either select to browse the model or simply copy the path to its location from Windows. The Lolobubu France skin that I use, may be located somewhere around here:
C:\Program Files\Steam\steamapps\username\counter-strike source\cstrike\models\player\lolobubu\france\ct_urban.mdl

If it's not in there already, that simply means the model hasn't been downloaded on your PC to the same location as mine. To download it, [url=http://laurentbubu.free.fr/click.php?url=http://laurentbubu.free.fr/File/skin_soccer.rar:2eivc6ng]click here[/url:2eivc6ng]. Place it in the same path as I chose.

Having selected the MDL file, we will need an output directory. Create one (by creating a new folder) inside your sourcesdk_content\cstrike\modelsrc\ folder.

Example:
C:\Program Files\Steam\steamapps\username\sourcesdk_content\cstrike\modelsrc\insert-random-foldername-of-your-output-directory-here!

After creating it, assign the path inside your MDL decompiler as shown below:

news post image

Done that? Now simply select "Extract". You may want to select "Use Steam File Access" when compiling but Steam MUST be open while doing this!

NOTE: It's VERY important that you create the folder yourself, for the MDL decompiler. If you don't create it on your own, the MDL decompiler will give you an error!

If you get any errors using MDL decompiler, please see: http://developer.valvesoftware.com/wiki ... _Beta_Bugsor simply, Google the error you've got. The solution may be some where on the 'net...

You may also want to try to uncheck the "Use Steam File Access" field in case you chose it earlier. Sometimes selecting this feature will cause an error.

4: Editing the .QC file - adding new paths to your new skin
Having decompiled the model we want to reskin, we will now have a lot of new files in the output directory we selected in the MDL decompiler. Navigate to the output directory and you should have the following files in there (if you've used the same skin as I, the Lolobubu France skin):

news post image

Assuming you've been using the same model as I (Lolobubu's france skin), you should make sure that you have have the same amount of files inside your output directory. In case you don't, you may want to delete the files inside the folder and start over again (from step 3).

Got everything in there? Okay, now it's time to edit our .QC file. Open up the "mdldecompiler" file with Notepad (or any other text editor that you prefer to use).

Inside of the mdldecompiler.qc, you'll find a lot of confusing text. We will not be editing everything in here, as there are irrelevant parts that we do not need to focus on. We will only focus on the parts needed for an edited skin. :)

First off, locate the $modelname part of the .QC file.

$modelname "player\lolobubu\france\ct_urban.mdl"


Found it? Good. Edit it now, to whatever name you prefer it to be. In my case, I want it to be:

$modelname "player\penguin\lolcake\ct_urban.mdl"


The $modelname identifier, defines where your actual model files will be located. Such as the actual model file (.mdl) and a couple of others which are necessary for the Source Engine to read.

NOTE: It's very important that you don't change the actual file name (ct_urban.mdl). Only the names of the folders. I recommend you not to edit the "player" part either. According to my knowledge, you can add several additional folders, not just replacing the original \lolobubu\france\.

Having done that, we can now move on to the part of the .QC file that defines what texture/skin your model will be using and searching for. This being the $cdmaterials part of the .QC file.

$cdmaterials "models\player\lolobubu\"


You will now need to edit it again to the name you prefer it should have. In my case, it will be:

$cdmaterials "models\player\penguin\lolcake\"


I have to advise you again that editing the "models" and "player" part of the path is not recommended!

Under the $cdmaterials, you will have to add a couple of very important entries which will stop the skin from causing errors when we are done. ($bonemerge):

$bonemerge "ValveBiped.Bip01_R_Hand"
$bonemerge "ValveBiped.Bip01_L_Hand"
$bonemerge "ValveBiped.weapon_bone"
$bonemerge "ValveBiped.weapon_bone_Clip"


Simply add the above entries right under your $cdmaterials.

Remember the $cdmaterials path you just created. And the original one, as we'll need it for the next step, which is editing the actual skin/texture/material!

Oh and... Always remember to save your work! Save the mdldecompiler.QC!

Note: The mdldecompiler.QC will not display the full paths as you've seen above. Only the important part. Such as, the $modelname path will start with a \player\ folder. But it's actually located inside your Counter Strike Source/cstrike/models folder. Because that's the game we're editing it for (Counter Strike Source/cstrike) and it's part of the $modelname - therefor, it's inside the models folder. The .QC knows this and will not display the full path as it is unnecessary. It will start from the \player\ folder.

^ The above part may seem incredibly confusing. But you'll understand it near the end of the tutorial.

Links:
Want to know more about the .QC file? - http://developer.valvesoftware.com/wiki/QC
Want to learn more about the .QC identifiers? - [url=http://developer.valvesoftware.com/wiki/Category:QC_Commands:2eivc6ng]http://developer.valvesoftware.com/wiki/Category:QC_Commands[/url:2eivc6ng]

5: Editing the skin/texture/material of the model
Before we start editing the actual texture, we have to identify where the texture is located and assigned in the .QC file from step 4.

Find this part in the .QC file:

// Model uses material "skin_foot_a2.vmt"


According to the .QC file, the model is using the "skin_foot_a2.vmt" file for it's textures! And as we saw earlier, it should be located in your "models\player\lolobubu\" directory...

Example: C:\Program Files\Steam\steamapps\username\counter-strike source\cstrike\materials\models\player\lolobubu\

Navigate the skin_foot_a2 file.

Found the "skin_foot_a2" files? The VMT and VTF file with the same name? Good.

Copy these files to our new location, which we defined earlier in the .QC file under ($cdmaterials). The location I chose was:
"models\player\penguin\lolcake\" (C:\Program Files\Steam\steamapps\username\counter-strike source\cstrike\materials\models\player\penguin\lolcake\)

Navigate to your location and paste these files (the VMT and VTF you just took a copy of).

Assuming you have installed VTFLib already, you may now open your skin_foot_a2.VTF file with it. You should now see the actual skin we will be editing:

news post image

In order to create the skin we want, we will need to export this skin from the VTF file in order to be able to edit it with an image editor. You will have to export it, by going to File - Export. I will not show you how to edit the actual skin, as I assume this is where your creativity comes in, with whatever image editor you prefer to use. :)

Once you have edited and created your NEW skin/texture/material in whatever image editor you prefer to use, save it as either:
*.bmp, *.dds, *.gif, *.jpg, *.jpeg, *.png, *.tga. - these are the supported import file formats for the new VTF we will be creating.

Once you are done, return to VTFLib. Import your new skin into VTFLib by going to File - Import

When Imported, you will have to save your new skin! Remember to save it to your (in my case) "models\player\penguin\lolcake\" directory and with the same name as provided earlier: skin_foot_a2.VTF !

Done saving the VTF? Excellent! Now we just have to edit the VMT file, the skin_foot_a2.VMT. Open it with VTFLib and you should see something like this:

"vertexlitgeneric"
{
	"$baseTexture" "models\player\lolobubu\skin_foot_a2"
}


Now edit the "models\player\lolobubu\skin_foot_a2" to the NEW directory, where our VTF and VMT files are actually located in!

"vertexlitgeneric"
{
	"$baseTexture" "models\player\penguin\lolcake\skin_foot_a2"
}


The $baseTexture identifier, defines where the VMT should be searching for its VTF for.

Getting a hint of the creation process yet? I hope you have. :)

Moving on to the last step of the tutorial...!

6: Recompiling the model with our new skin and paths assigned!
Found the previous part of the tutorial very confusing? Don't give up yet...! This part should be the easiest one! :)

Simply open Notepad and add the following content (of course with the appropriate paths that you assigned earlier):

"C:\Program Files\Steam\steamapps\username\sourcesdk\bin\ep1\bin\studiomdl.exe" "C:\Program Files\Steam\steamapps\username\sourcesdk_content\cstrike\modelsrc\penguin\mdldecompiler.qc"

pause



The appropriate paths being:
1: The path to your studiomdl.exe (Should be in your sourcesdk\bin\ep1\bin\ directory).
2: The path to your decompiled and edited .QC file (Which is in your output directory you defined in step 3).

Done that? Now save your notepad file to any location you prefer as: anything-you-prefer.bat

Now simply, go to your desktop, locate your .bat file and double click it. Your model should now be recompiled!

Note: If you get any errors please check your .QC file again (step 4). Check your directory paths. If they are correct and you still encounter errors, you may want to Google your specific error(s)! Alternatively, check out the links below:

Links:
- If you are not happy with the studiomdl.exe, you could always try Cannonfodder's alternative application, Studiocompiler:
http://www.chaosincarnate.net/cannonfod ... iocompiler- There's another wonderful alternative for the studiomdl.exe, and that's the GuiStudioMDL:
http://www.wunderboy.org/apps/guistudiomdl2.php
7: Viewing our recompiled model!
Having recompiled the .QC file, our model should now be in the same path as we defined earlier under $modelname in the .QC. In my case: player\penguin\lolcake\.

Open up Source SDK, open the Model Viewer and locate your model. Your model should now be displayed correctly with your new skin applied.

news post image

Did it work...? Do you see your model with your own new skin applied? If so... Congratulations!!! :D You are now officially a skinner!

I hope you've enjoyed this tutorial and that it may guide you to create many more skins! Perhaps even inspire you to create a tutorial on your own and help out the community!:)

Tips:
- Google is certainly the best place to look in order you want to search for any errors during the process of reskinning. But alot of the sites on Google, could have old and outdated information. So make sure to check the Valve Developer Community first and take a search there:
http://developer.valvesoftware.com/wiki/Main_Page

Known issues:


These are the most common issues you'll meet on your way during the skinning process. Hence that all of the software used during this tutorial are pretty outdated and will not be updated any time soon. Therefor, real fixes are not to be expected. (Blame the authors :P)

But there are workarounds for each known issue. Here they are:

1) When extracting files with MDLdecompiler, I get the following message: Unable to find gameinfo.txt?
Are you sure that you have configured Source SDK properly (see step 1)? Are you sure current game is set to Counter Strike Source inside of the SDK (explanation at step 1)? Alternatively, try to "Refresh SDK Content" inside of the SDK.

2) I am unable to load a file, I get: Warning: falling back to auto detection of vproject directory?
According to Valve, this is a Windows Vista only error. The solution can be seen below:

""Warning: falling back to auto detection of vconfig" (Windows Vista)
Vtex will give the following error:

TODO: Please provide an exact quote of the error.

Make a shortcut for vtex.exe and add -game [path to game directory]

Example: -game c:/steam/steamapps/username/counter strike source/cstrike

If there are spaces in any of the folders in your path use "

Example: -game "c:/steam/steamapps/username/counter strike source/cstrike""

More info at: http://developer.valvesoftware.com/wiki ... leshooting
3) "When trying to extract from the MDLdecompiler, I get: Extra App ID set to 211, but no STEAM App ID"?
That's a very common error, which I often get myself.

To fix it:
Navigate to these files:
C:\Program Files\Steam\SteamApps\USERNAME\counter-strike source\cstrike\GameInfo.txt
C:\Program Files\Steam\SteamApps\USERNAME\sourcesdk\launcher\GameInfo.txt

In each of these files, you'll find an entry called:

ToolsAppId 211


To the left of these entries, add 2 slashes:

// ToolsAppId 211


These two slashes will prevent the application to use the ToolsAppId 211 feature and fix your problem.

Note: Launching Counter Strike Source and/or SourceSDK will remove the 2 slashes and make the application use ToolsAppId 211 again. Therefor, make sure you've added the 2 slashes when you work with the MDL decompiler. Otherwise, you'll keep getting the error every time.

If you notice any other errors than those listed above, please make sure to tell me about them. I want to highlight every known issue possible during the process.

Good luck with your skinning!

- MisterPenguin

View comments ( 0 )

Back to top