help adding models to TF2

meatpopsicle

L1: Registered
Nov 9, 2007
49
2
Hello,

As you may (or not) have seen in the WIP forums I'm making a new CTF map for TF2. I am adding at least 1 custom model to the game however in digging through the documentation on http://developer.valvesoftware.com/wiki/ I am after 2 days of reading still not able to get my model in.

Can anyone point to any tutorials that helped them get models in game? Or any other recommended reading & resources?

I seem to have problems using the studiomdl for one ; and then secondly the wik i instructions dont seem to indicate proper paths for the files like the /bin dir that studiomdl should be in and such. But then again thats just the latest stop for me :)

Thanks in advance for any tips!

meat
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
Hi, I had problems too how to get models working, after a quest how to do it properly after 3 days, I got it working. It's a bitch the first few times I can tell you that.
Ok lets do this.

I suppose you use 3Dsmax, you have to look for an .SMD exporter from canonfodder (he made it so google it or something, its up to max 9)

Ok you have your model, uvw map and texture. You will have to export your model 3 times. 1st time you call it for example: model_ref.SMD . 2nd time same exporting, but you call it model_idle.SMD (this is for animations in your model if you would need it, if you dont need it don't worry yet). 3rd time exporting, this is diffrend. You need to build the collision model, so use some boxes that you extrude to make a simple collision model, set all smoothing groups to 1, than export it as model_phys.SMD.

Now, the compiling of the model itself. You will need to write a .qc file that is just a text document that you rename, and you use studiomdl.exe to compile it (its in the same folder as vtex in your sourcesdk folder somewhere)
Ok the .qc:

// Output .MDL
$modelname custom/model.mdl //THIS IS THE NAME OF THE MODEL HOW IT WILL BE IN HAMMER


$cdmaterials models/custom //FOLDER WHERE YOUR TEXTURE IS

$staticprop

$surfaceprop "metal" //MATERIAL

$scale 1 //USE UNITS IN MAX TO MAKE SCALE RIGHT


$body studio "model_ref"

$sequence idle "model_idle" fps 15

$collisionmodel "model_phys"
{

$Mass 100
$concave
}

Ok use studiomdl to compile the qc.

Now we gonna make the texture work.

IMPORTANT: if you exported with the material on it you have to use the same name. I called my diffuse map model_diffuse.

PATH: C:\program files\steam\steamapps\username\teamfortress2\tf\materials

Now there you put your texture in .vtf format (use vtex to compile or use photoshop/vtfedit to make a .vtf file. In my example, its called model_diffuse.vtf

Left to do is the .vmt

PATH: C:\program files\steam\steamapps\username\teamfortress2\tf\materials\models\custom

Write your .vmt like this (txt file, rename)

"VertexLitGeneric"
{
"$basetexture" "model_diffuse"
"model" 1
"$envmapmode" 1
}


Thats it! Open hammer and enjoy. Also, if you dont have the maps (...\custom) in your map directory, thats normal, I prefer a map called "custom" where all my custom models appear in.

Good luck, if something doesn't work tell me. :)
 

meatpopsicle

L1: Registered
Nov 9, 2007
49
2
thanks sniper .. one clarification

Thanks for the walkthrough sniper, much of that is pretty close to what I've been doing with some exceptions.

1) I had been refering the idle and other sequences all to the same model ; but if you feel its important to be different files I will do so.

2) You say on just one like to "compile with studiomdl" ; but that is where I am stuck. Any chance of a TF2 specific note about that? The problem I get is a tier0.dll missing error? When I read the instructions on the wiki it says that the studiomdl should be in the sourcesdk/bin folder but its really in the sourcesdk/tf/bin/ folder .. why is that?

thanks in advance!

meat
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
I did not try to compile for TF2 yet. I think you will need some additional parameters to compile for TF because it uses the new engine used in all orangebox games... I will see about that. Ignore the tier dll its something else that is going wrong.
Ill compile my shark tomorrow and I'll see if it works.

About the 3 exports, that is how it really has to be done correctly.
 

meatpopsicle

L1: Registered
Nov 9, 2007
49
2
awesome thats helpful thank you for the information.

I have class tonight so I wont be able to try another compile until tommorow Ill let you know what happens!

meat
 

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
I tried to get custom models working too, and was unsuccessful after a full weekend of trying different things.

Shortly after I tried importing models, I made a custom texture to import, again it would not import with the orange box vtex.exe. SO, after at least 50 different setups I decided to try the EP1 bin tools, and VOILA! it worked. It even placed the texture in the correct TF2 directory.

So my suggestion to you is to use the EP1 studiomdl.exe. Give that a shot and report back any errors you might get. At least on my install, the OB tools are not working at all but the EP1 vtex has worked for texture conversion.
 
Last edited:

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
After alot of shouting I got it working. However I didn't got the error you discribe.

I have studio mdl ineed in orange box map. I use that .exe to compile the .qc (for gods sake make sure that source sdk is not running in the background (not even the splash screen where you select model viewer or hammer etc..! ))
Also, if you use paths like models/mycustommap where you want the model to be (like in this .qc I wrote), make that map structure in advance. The .qc doesnt make maps where they should be, you have to make them yourself. :)
 

oxy

L5: Dapper Member
Nov 27, 2007
208
30
Wow... Compiling a model for source is no easy task. have been at it for 3 days myself. I Am working on a custom model but I don't plan on unwrapping UV's and texturing it unless I am comfortable compiling models.

I am using the Source SDK BETA
I am using Maya 2008 to model.
I am using Prall's Export tools v2.5
I got the .QC and .SMD files to export correctly.
I got the .VMF and .VMT files created correctly.

I just can't compile for the life of me. I have tried using both studiomdl from ep1 and orangebox. I have tried using GUIStudioMDL and it can't find the gameinfo.txt and won't even run.

If I don't get this in the next few days I am go to give up until somebody can provied me with clear instructions on how to complie for TF2.

I am also going to post this in my WIP thread.