[TUTORIAL] Complete Guide to Adding Custom Objects to your TF2 Map

Angry_Ed

L1: Registered
May 25, 2009
41
32
Great tutorial, but I have one question. Right now I'm building something for a map I'm creating and so far the poly count has, for various reasons, hit 740 polys. To me that seems ridiculously high and even if I make lower-poly versions for low-res rendering at a distance it still feels like fundamentally I messed up on the initial part. My question is what's a reasonable target to hit for most objects as far as poly count is concerned?
 

Darth Cyrax

L2: Junior Member
Nov 29, 2008
94
8
Hey, I'm trying to compile a model and also crashing-
here are the lines
Code:
> Executing: C:\Program Files\ConTEXT\ConExec.exe "C:\Program Files\Steam\SteamApps\darthcyrax\sourcesdk\bin\orangebox\bin\studiomdl.exe" "C:\Program Files\Steam\SteamApps\darthcyrax\sourcesdk_content\tf\modelsrc\my_model_name\my_model_name.qc"

WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\program files\steam\steamapps\darthcyrax\team fortress 2\tf\;c:\program files\steam\steamapps\darthcyrax\sourcesdk\bin\orangebox\tf\;c:\program files\steam\steamapps\darthcyrax\sourcesdk\bin\orangebox\hl2\;c:\program files\steam\steamapps\darthcyrax\sourcesdk\bin\hl2\
qdir:    "c:\program files\steam\steamapps\darthcyrax\sourcesdk_content\tf\modelsrc\my_model_name\"
gamedir: "c:\program files\steam\steamapps\darthcyrax\team fortress 2\tf\"
g_path:  "C:\Program Files\Steam\SteamApps\darthcyrax\sourcesdk_content\tf\modelsrc\my_model_name\my_model_name.qc"
Building binary model files...
Working on "my_model_name.qc"
ERROR: c:\program files\steam\steamapps\darthcyrax\sourcesdk_content\tf\modelsrc\my_model_name\my_model_name.qc(55): - bad command my_model_name.mdl
> Execution finished.
Here's what my qc looks like
Code:
/*
----------------
my_model_name QC
----------------
*/

 my_model_name.mdl
 0 0 0 0
 1.0
 "Body" "my_model_name.smd"

 "watermelon"
 Z
 "my_model_name/"

 "idle" "my_model_name.smd" fps 30
One thing worth mentioning is it's small enough it doesn't warrant a collision model, so I excluded those lines from the qc.
 

shatty

L1: Registered
Mar 12, 2009
7
1
Here's what my qc looks like
Code:
/*
----------------
my_model_name QC
----------------
*/

 my_model_name.mdl
 0 0 0 0
 1.0
 "Body" "my_model_name.smd"

 "watermelon"
 Z
 "my_model_name/"

 "idle" "my_model_name.smd" fps 30
One thing worth mentioning is it's small enough it doesn't warrant a collision model, so I excluded those lines from the qc.

I am no pro at this, so I am not exactly sure what a lot of those lines are. Try this for a QC file:
Code:
$modelname "my_model_name/my_model_name.mdl"
$cdmaterials "my_model_name"
$scale 10
$surfaceprop metal
$staticprop
$body mybody "my_model_name.smd"
$sequence idle "my_model_name" fps 1

also, looking at the error message, the models should be in the models folder and not the modelsrc folder. it was a little confusing as to whether or not you have them there. based on the QC i just pasted, your model will be created in models/my_model_name and your materials should be in materials/my_model_name.
 

Darth Cyrax

L2: Junior Member
Nov 29, 2008
94
8
The qc file was what Hawk posted up as his example, I then adjusted it to my model. Anywho, I used the one you posted, moved the textures about and it works now. Thanks.
 

HROP

L1: Registered
Aug 18, 2009
2
0
Hi,

First of all thank you Hawk for this great tutorial.
I have learned a lot.

Everything is working fine, EXCEPT that I cannot manage to have more than 1 skin applied to my model at a time.

I have spent the last 6 hours, trying to figure out why, read a couple of similar tutorials, but this couldn't fgure it out.

Model viewer sees that my model should have 6 different skins, but refuses to show any of them.

Anyways...
Here is my QC file, and also my main vmt file. And of course my smd is refferencing the main vmt as the material to be applied to the triangle.

$modelname "ctf_resort/gift_flag.mdl"
$body "gift" "gift.smd"
$texturegroup skinfamilies
{
{ "gift" }
{ "gift_1" }
{ "gift_2" }
{ "gift_3" }
{ "gift_4" }
{ "gift_5" }
}

$cdmaterials "ctf_resort/"

$scale 1.0

$sequence "idle" "gift" fps 30

$collisionmodel “gift_collision.smd”

And the .vmt

"VertexLitGeneric"
{
"$basetexture" "ctf_resort/gift"
"$model" 1
"$surfaceprop" "cardboard"
"$envmaptint" "[0.5 0.5 0.5]"
"$envmapcontrast" .5
"$bumpmap" "ctf_resort/gift_normal"
"$normalmapalphaenvmapmask" 1

}

If anyone manages to resolve this mystery, I will give him a cookie.
 

HROP

L1: Registered
Aug 18, 2009
2
0
HALLELUIA !

Brothers, Sisters, rejoice.
I just found out the reason of why it was NOT working, only seconds after posting this...
The reason was the QC file.
Actually, the QC file you se in my previous post is OK, but my previous QC file and naming convenion wasn't right.


Here are RULES that you MUST respect, if you want to have multiple skins;
1- First of all, your SMD must reference the base texture that wil be applied to your model;
i.e.:
version 1
nodes
0 "Box01" -1
end
skeleton
time 0
0 0.000000 0.000000 -5.000000 0.000000 -0.000000 0.000000
end
triangles
gift.vmt
0 -9.500000 -14.500000 -5.000000 0.000000 0.000000 -1.000000 0.491667 0.175000 1 0 1.000000
0 -9.500000 14.500000 -5.000000 0.000000 0.000000 -1.000000 0.491667 0.658333 1 0 1.000000
0 9.500000 14.500000 -5.000000 0.000000 0.000000 -1.000000 0.175000 0.658333 1 0 1.000000
2- Then, the VMT file for this exact same texture should look something like that:
"VertexLitGeneric"
{
"$basetexture" "ctf_resort/gift"
"$model" 1
"$surfaceprop" "cardboard"
"$envmaptint" "[0.5 0.5 0.5]"
"$envmapcontrast" .5
"$bumpmap" "ctf_resort/gift_normal"
"$normalmapalphaenvmapmask" 1

}
Here you can see that the $basetexture name if simply gift, not gift0, nor gift_basetexture. No; it is simply gift. This is important to keep in mind, for the third rule is...
3- You must respect the naming convention.
The VMT that is referrenced by your SMD must be the base texture, and must have similar yet different name than the other textures you wish to apply to your model.
Here is a naming example that works for your VMTs (and VTFs):
gift
gift_1
gift_2
gift_3
Here is an example that wouldn't work
gift_0
gift_1
gift_2
gift_3

That should help you out. And don't frget to update your .QC fle, and recompile your model if you stumble upon this problem :)

Cheers.
 

Wraith411

L1: Registered
Jul 24, 2009
12
0
Thanks so much man, this tutorial just saved myself and the artists on my team so much time and frustration mad props sir.
-W
 

eyefork

L3: Member
Oct 27, 2008
130
186
Hopefully someone will be able to solve this...

help.jpg


Yes, my TF2 folder is set to read-only. I don't know why. Every time I uncheck it and click apply, it goes back to read-only when I exit the properties menu. :(

edit- Running Win7 64-bit
 
Last edited:

eyefork

L3: Member
Oct 27, 2008
130
186
Did NOT know that you had to create your own model directories. FML

Time for some sleep :facepalm:
 

UGLYdumpling

L3: Member
May 24, 2010
127
56
sweet jesus on a rubber crutch!

This Complete Guide, although the intentions are totally in the right place ... is HOPELESSLY out of date - and/or missing information. It took me countless hours to correct issues presented by this tutorial.

The syntax in most of his examples leaves out the $ ... horrible.

Some critical facts were entirely left out. The collision mesh portion of this guide, for example.
Almost entirely useless and leaves out the critical necessity of using the $convex command.

I almost feel inspired to write a revision to this thing. AAAAARRGH!
ok, i've vented. Now back to work.
 
Last edited:

Beetle

L9: Fashionable Member
Aug 17, 2008
627
178
What version (year) of Softimage is best for this? Is this possible in Max?

This is out of date. You don't need XSI. You can export them directly from the 3d software and it'll work.

Since I've finally got it down to a science (other than when animations are involved) I think I might make a new tutorial. It'll be with Blender, but the concept will be the same. As a matter of fact, everything after you export the smd will be the same.
 
Last edited: