Warning: array_merge() [function.array-merge]: Argument #1 is not an array in [path]/archive/global.php(40) : eval()'d code on line 2
[TUTORIAL] Complete Guide to Adding Custom Objects to your TF2 Map [Archive] - TF2Maps.net Forums

PDA

View Full Version : [TUTORIAL] Complete Guide to Adding Custom Objects to your TF2 Map


Hawk
02-03-2008, 01:48 AM
Complete Guide to Adding Custom Objects to your TF2 Map

Is there something you want that you can't find among Team Fortress 2's included objects? Are you eager to put your own custom objects and textures into your latest map? Well, if you're like me , you realize now that the process of getting a custom model into a Source map is not automated or even convenient. In fact, this may be the fourth or fifth tutorial you've looked at, because most tutorials on importing objects (including Valve's own documentation) have various holes and sometimes unclear information.

The purpose of this tutorial is to make as complete a guide as possible to the process of getting a custom object into a Team Fortress 2 map. The same process will work for other games like Half Life 2 and Counterstrike, but it's about time you got a TF2-specific tutorial on this subject. And I want to help you skip the headaches I went through. Follow me as we go through the process.

Hawk
02-03-2008, 01:50 AM
Planning

So you've found something that your Team Fortress 2 map is desperately missing... Well, with a little know-how, it's possible for you to create that object. But the first thing you must know about that object will be its size and proportions. For this tutorial I'm going to walk you through the creation of a couch for my map cp_corporation.

If I want to put a couch into a map, I need to know what size to build it it. There are a few ways to do this:

- Knowing the exact measurements and making direct conversions
In Hammer, 16 units equals 1 foot. Knowing this, you can make an object to the perfect scale. One unit in Hammer equals one unit in XSI, Maya, and 3dsMax.

- Exporting a piece of your map and building the object right there on it.
Softimage XSI Mod Tool, which you'll become familiar with later in the tutorial, can import .VMF files. If you select pieces of your map (like a hallway, table, or building) and you export them as a .VMF file from Hammer, Mod Tool can import it. From there, Mod Tool can make it compatible with your favorite 3D package by converting it to an .OBJ file. Now you can build the object right there admidst your own map geometry (though it will have no textures). This method is a bit cumbersome because of its several steps. It also doesn't give you a direct comparison to the size of players.

- Making a quick mockup in Hammer.
This is my favorite method and the one I use most. Directly in your map you can build a simple version of your object out of brushes. You can even put in a player model to compare the size. This lets you visually size things up and get the right proportions.

http://www.alternatedimension.com/post/tftut/mockup.jpg

After that, you can select each brush to look at its dimensions and make a quick drawing that lists the dimensions of the object.

http://www.alternatedimension.com/post/tftut/diag.jpg

Use the dimensions in your sketch to build a rough model in your 3D package of choice that will eventually become your final model.

Hawk
02-03-2008, 01:53 AM
Building

You can build your object in virtually any 3D package that will properly export an .OBJ file with UV maps intact. I choose Maya because it's what I know, but the choice is yours. If you know how to build and texture an object in XSI or XSI Mod Tool, you can save yourself a step because your model will end up in that package anyway.

While building your model, I think it's important to suggest that you try to keep your model and texture in the Team Fortress 2 style. Nobody likes an object that looks like it doesn't belong.

Here are the different versions of my couch that I modeled.

http://www.alternatedimension.com/post/tftut/3couch.jpg

You can see I made three different versions.
1. The first is the full-resolution model. It has more polygons, beveled edges (rounded corners), and is made to look nice up-close.
2. The second is a low-res version of the model. This is what will show up when the player is far away from the object. This doesn't have beveled edges and has a lot fewer polygons. A low-res version of your model is not necessary, but it's good to have, and it's not hard to make. It's as easy as keeping a version of your model from before all the smoothing and beveling.
3. Third is The collision model. This model sets up the clipping for players. It also isn't absolutely necessary, but realize that any object you don't make a collision model for will not be solid in the game (unless you build clipping brushes for it). I recommend that you make a collision model. It will save you time in the long run. See my special section for collision models later in the tutorial.

Here are some special things to keep in mind as you create your objects:

- Make them all occupy the same space. They can't be sitting next to each other with different origin points. In my 3D package I can set them up to be in different layers that can be turned on and off.
- They must have the same origin point. In fact, if you can, make sure that origin point is floor-level, so when you place the object it's sitting neatly on the floor.
- All models must have UV maps. Yes, even the collision model. The collision model doesn't need to be nicely textured, or even have the right texture. It just needs to have a UV map.
- You may have more that two levels of detail for your model, but use your judgement. If the object doesn't have many polygons in the first place, then a lower level of detail is pointless. And you're eating up memory and processor power for no good reason if you include a lower-detail model that doesn't shave off many polygons.
- Make sure each seperate model is one complete merged object... except for the collision model. It should be in seperate pieces if more than one piece exists.

Export each of your models seperately as .OBJ files so that they can be opened up in Mod Tool (if you aren't in Mod Tool already).

Hawk
02-03-2008, 01:57 AM
Texturing

Textures on the objects and brushes in a Source game use a special image format called .VTF. It probably stands for "Valve Texture File". You most likely made a .TGA or .TIF image for your texture, but whatever it was, it's going to need to be converted to a .VTF to be used in Team Fortress 2.

The Source SDK comes with a texture conversion tool called Vtex that is meant to turn your image file into the proper format, but I think tool is more trouble than it's worth. Instead, I use Nem's .VTF

Photoshop Plugin (http://nemesis.thewavelength.net/index.php?p=39), which immensely simplifies the process. For those who don't have Photoshop, I've heard that VTFedit (http://nemesis.thewavelength.net/index.php?p=40) is a very capable frontend that can do the trick and more.

http://www.alternatedimension.com/post/tftut/tex.jpg

Here is the texture for my couch, albeit scaled down a bit to post in this tutorial. One thing most people know, but is important to note, is that all textures must be sized by square increments (for example: 256x256, 512x512, or 1024x1024). My original is 512x512. I also made a blue version of it in case I ever decide to put that couch on the blue side of the map. Models with multiple textures require some extra settings but we'll get to that later...

With my texture open in Photoshop, I choose "Save As..." and in the file format field I choose .VTF way down at the bottom. Give it a name and tell it to save, and it will open up the VTF Options.

http://www.alternatedimension.com/post/tftut/vtfopt.jpg

There are actually a lot of different formats within the .VTF filetype. You can select these formats from the Format dropdown menu. BGRA888 is listed as a common format, and does not compress your texture. However, an uncompressed texture takes up a lot of space, especially if your image is large. On the other hand, DXT1 (also a common format) will compress your textures down to a MUCH more manageable size. And you know what? In-game I can't even tell the difference. I highly recommend DXT1.

If you're including an Alpha channel in your image to create transparency or areas that are self-illuminated (like a TV screen), you'll have to choose a format that allows an alpha channel. For compressed textures, DXT5 works, and for uncompressed you can use BGRA8888.

http://www.alternatedimension.com/post/tftut/tex_spec.jpg

This is the Specular map for my couch. Specular maps in a Source game work just like they do in most 3D software packages. It's just a grayscale image with white representing reflectiveness and black representing matte. On my map you can see I made the couch's fabric unreflective, but the wood part is glossy. This image file must also be a .VTF and is subject to all the same rules as your main texture file.

http://www.alternatedimension.com/post/tftut/tex_norm.jpg

Last of all, here's my normal map. I'm posting it at actual size so you can see the details. This will give my couch a sense of texture and bumpiness when viewed in the game. A normal map is easy to make if you use Nvidia's Normal Map plugin (http://developer.nvidia.com/object/photoshop_dds_plugins.html). It's as simple as creating a grayscale bumpmap file like you would for most 3D software packages, and use Nvidia's Photoshop plugin on it. Make sure that when you're using the plugin on a grayscale image, you have it work from "Average RGB" rather than "Alpha Channel" (unless of course you actually did use the Alpha Channel for your height information). As with the other images, this too must be a .VTF file. However, when you reach the VTF Options box while saving, make sure you check the "Normal Map" box.

NOTE: both the specular map and normal map are unnecessary, so you may leave them out if you don't need that extra level of shine and detail.

All of your texture image files should be placed in your SourceSDK_content folder. You should make a new folder for the textures of your model within the "materialsrc" folder of the "tf" folder, so the path looks similar to this:

C:\Program Files\Steam\steamapps\Yoursteamname\sourcesdk_cont ent\tf\materialsrc\Yourmodelname\*.vtf

Hawk
02-03-2008, 01:59 AM
Your Object's Material Shader

Once you have all the images made to texture and shade your object, you must write a shader for them. The Source engine gets your shader from a text file you create, and it's not very evident what your shader will look like until you're in the game, so it may take you some trial and error to get what you want. Here is the shader file for my couch:


"VertexLitGeneric"
{
"" "officecouch/officecouch"
"" 1
"" "carpet"
"" "env_cubemap"
"" "officecouch/officecouch_spec"
"" "[0.5 0.5 0.5]"
"" .5
"" "officecouch/officecouch_normal"
"" 1
}



Now, let me explain each line so that you'll know what it's for and how you change it:

"VertexLitGeneric" - This is the lighting model Source uses for lighting objects. If you're making a material for an object (and you are) then this is what you must use.

"$basetexture" "directory/texturefile" - Here you place the path to your base texture file. Source already assumes you're in tf\materials directory, so you'll want to just list the subdirectory for your object's textures, followed by the name of the texture itself. Mine is pointing to tf\materials\officecouch\officecouch.vtf. HOWEVER, you must leave off the .VTF extension, since Source assumes it will be looking for a .VTF file. If you leave the extension on, it will look for texture.vtf.vtf, and of course it won't find it.

"$model" 1 - Tells Source that this texture is for an object, not a brush.

"$surfaceprop" "________" - This gives your entire model surface property which dictates how it sounds when stepped on, or what happens when it's shot. You can find a big list of different surface properties for your model right here (http://developer.valvesoftware.com/wiki/Material_Surface_Property), including things like metal and wood. I chose "carpet" so that the couch kicks up dust when shot.

"$envmap" "env_cubemap" - Tells source to use a nearby cubemap for the object's reflection.

"$envmapmask" "directory/specular_texture" - sets the path to your specular map file. Use the same rules as you did for your base texture.

"$envmaptint" "[0.5 0.5 0.5]"
"$envmapcontrast" .5 - These two settings adjust the crispness of the shine on your object. Each number must be from 0 to 1, and you'll probably have to adjust them to get the look you want. In $envmaptint the three numbers are in RGB format, and rasing the green number would make the reflection appear more green, for example. Under most circumstances, you should make the three numbers equal.

"$bumpmap" "directory/normalmap" - designates the path to your normal map. It also uses the same rules as you did with your base texture. Remember to leave off the .VTF extension!

"$normalmapalphaenvmapmask" 1 - if you have both a normal map and a specular map on your model, you need this line. I don't know why.

You got all that? Save this file in the same directory as your texture files. It will be a .VMT file, and for the sake of organization, give it the same name as your object. So my file is called "officecouch.vmt" and it's in the \sourcesdk_content\tf\materialsrc\officecouch\ directory along with all my .VTF files. When you compile your model, your model files and material files will end up copied into your main Team Fortress 2 directory under \materials and \models. It's useful to note that even after your model is compiled, you can adjust the material settings in the Team Fortress 2\tf\materials directory without having to recompile anything.

Note - If you want your object to have multiple skins, like how I want to have a blue version of my couch, you must make a new .VMT file for the new skin. In this new file, the $basetexture line would point to a different texture file.

Also, just for the sake of reference, here is an example of a bare-bones .VMT file, in case you're doing a material that has no specularity or normal map. This is just the required stuff:


"VertexLitGeneric"
{
"" "officecouch/officecouch"
"" 1
"" "carpet"
}



If you've finished all of this, you're ready to move on to the conversion process for your model.

Hawk
02-03-2008, 02:03 AM
Mod Tool

Softimage|XSI 6 Mod Tool (http://www.softimage.com/products/modtool/) is a crippled and buggy version of the popular 3D package Softimage. Mod tool can't do everything the full package can, but it's free and comes with tools made especially for Source Engine mods and assets.

Import your object models into Mod Tool by selecting File > Import > Obj File. You may import them all into the same scene if you like. This will actually make it easier to handle the textures and materials.*

http://www.alternatedimension.com/post/tftut/inmodtool.jpg

If you want to change your view in the 3D viewport, move your mouse to that viewport, then hold the S button. While holding S, the left mouse button pans, the middle mouse button zooms, and the right mouse button rotates your view. You can turn on textures or shading by clicking on "Wireframe" in the upper-righthand corner of the viewport and changing it to your desired setting (like "Textured", for instance)

When you import an object into Mod Tool, the odds are good that the material settings you imported with it are not compatible with Mod Tool. If so, the object will show up black when you're in Textured mode. This was the case for me, coming from Maya. These broken materials mess up the compile process, so here is how to fix them:
1. Open up the Materials Manager by choosing View > Rendering/Texturing > Material Manager.

http://www.alternatedimension.com/post/tftut/matman1.jpg

2. See those apples? Those are your materials. Click on and then delete any apple that isn't Scene_Material.

http://www.alternatedimension.com/post/tftut/matman2.jpg

3. Now, in the top menu of the Material Manager, select Create > Lambert. It should create a new material for you. Double click it. This will open up your new material dialog box. Down near the bottom you'll see the "Diffuse" settings, with some color sliders and a little plug-in icon next to it. Click on that icon. A little menu will emerge and you should select "Image".

http://www.alternatedimension.com/post/tftut/matman3.jpg

4. A new Image dialog box will pop up. In the "Image" field, choose "New" and select "New from file..." from the menu that pops up. Navigate your way to your texture (the .VTF file). Upon choosing it, you should see your texture appear in the Image dialog box. You may close the Image dialog box now.

5. That little apple in the Material Manager should now have your texture on it. Select your model, then right-click on the lambert material with your texture and choose "Assign to selection".

Hawk
02-03-2008, 02:04 AM
With your 3D view is in "Textured" mode, you should see the texture on your model. If it's too dark to tell, open up that little menu in the upper-righthand corner of your 3D window and choose "Headlight". That will light things up a bit. If your model's texture is distorted or not showing up, it's possible you messed up along the way or you didn't export an OBJ correctly.

http://www.alternatedimension.com/post/tftut/inmodtool2.jpg


*If you import your main model, your low-res model, and your collision model into the same scene, you can delete all of their broken materials and assign them all the same fixed material, thus saving you time. Just make sure you can keep track of the different models, as they should all be in the same exact location. Also, you must be sure to export them from Mod Tool seperately.

If you know the texture is showing up correctly, it's time to export! Select your main full-res model, then in the top menu select ValveSource > Export SMD...

Navigate to your SourceSDK_content folder. You should make a new folder for your model within the "modelsrc" folder of the "tf" folder, so the path looks similar to this:

C:\Program Files\Steam\steamapps\Yoursteamname\sourcesdk_cont ent\tf\modelsrc\Yourmodelname\model.smd

Export all of your models to that directory. I used this naming convention for my couch:
officecouch_1.smd - Full-res model
officecouch_2.smd - low-res model
officecouch_c.smd - collision model

Naturally, how you want to do your naming is your business. Go through the process and export your low-res model too, as well as any additional level-of-detail models. But stop once you get to the collision model. It's special.

Hawk
02-03-2008, 02:08 AM
Collision Model

The collision model must be handled a bit differently than the other models. Not only does it designate how the player bumps into it, but also how it collides with other objects and the floor if it's a dynamic object. It also tells the game what parts block bullets and grenades, so it's important.

First of all, it should be very low-res. Make it have as little detail as you can manage... just the basics.

Second of all, it can only be made of convex shapes, just like brushes in Hammer. This means that there can't be holes or indentations. Cubes and cylinders are good examples of convex objects. This presents a challenge when you're making a model like my couch. After all, it has that bucket shape that allows players to sit down in it (if a TF2 player could sit). Your collision model can be made out of separate shapes to achieve the collision you want, as long as they are separate objects and each object is convex.

http://www.alternatedimension.com/post/tftut/coll1.jpg
Here is my couch's collision. Notice how simplified it is. Also, it is made up of four seperate objects, all of them convex, with UV maps, and a material assigned to them.

When you compile your object, the collision model can end up in three different situations:
a) It works. The collision happens right where you want it to.
b) It doesn't work. An error happens and there is NO collision. Players walk through the object.
c) It decides that your model is not convex and creates a new shell around it. This shell is like a shrink-wrap that cuts off concave areas. The the case of my couch, it would make it so you can't sit down in it.

Your collision model may be simple and only require a cube. Or, that shrink-wrapped shell may be perfectly fine for your collision. If your collision model is one convex object, then just skip to the next section. But I'm going to show you how to make the proper collision work. Here are some examples on what happens with different settings:

http://www.alternatedimension.com/post/tftut/cm_wonk.jpg
This is an example of a collision model made of one big concave shape. This is a bad example. It will result in an error when you compile (more on compiling later) and an improvised shrink-wrapped shell. Look closely at the couch with the red lines around it. Those red lines are showing the collision model. See that line stretching across the front of the couch like that? That means if a player jumps on top of the couch, they'll hover eerily above the couch rather than standing on top of the cushions.

http://www.alternatedimension.com/post/tftut/cm_work.jpg
Here's the right way to do it. See how I have four different convex shapes? When you look at the computed collision model with the red lines, you can see that there is an open cavity through which players can fall into the couch.

Hawk
02-03-2008, 02:10 AM
Properly exporting your collision model:

If your collision model consists of multiple ojbects, there's one more step you need before you export them from Mod Tool. Let's assume you've imported your collision model into Mod Tool, and you fixed its material. Once again, you don't need the UV map or texture to look good on the collision model, they simply must exist. NOW, you need to make sure each object has its own smoothing group.

What's a smoothing group? Well, when your computer shows a 3D object, it makes the shading on polygons blend together if the polygons are in the same smoothing group. Polygons that meet together but are in different smoothing groups look like a sharp corner. Mod Tool doesn't have smoothing groups. At least it doesn't call them that. But you can designate them so that your collision model works. I don't know how smoothing groups relate to objects that will become collision, but Valve has decided to make it a factor for some reason.

In Mod Tool they call it "Geometry Approximation". Select one of the objects. Then, find "Selection" in the upper-right side of the screen, somewhere underneath the big arrow. Click on it and choose "Geometry Approximation". Mod Tool will ask you if you want to make a local copy. Just say no.

http://www.alternatedimension.com/post/tftut/geom.jpg
(if you don't see the same menu in my screenshot with the arrow, from the top menu select View > Layouts > Default.)

You should get a new settings box that pops up.

http://www.alternatedimension.com/post/tftut/geom2.jpg

Choose the "Polygon Mesh" tab and uncheck Automatic, under Discontinuity. Do this for each object in your collision model.

You're ready to export your collision model now. Select all of the pieces by dragging a box around the enter scene, or shift-clicking each piece. From the top menu choose ValveSource > Export SMD... Export it to the same directory as your other models.

Hawk
02-03-2008, 02:22 AM
Compiling

If you've followed all the steps so far, you should have a directory with at least a few .SMD files. There's your main model file, and your collision model, as well as any additional models for levels of detail if you made them. I ended up with three models total. A high-res, a low-res, and a collision model.

One last thing your model needs is a .QC file, which is a text file that designates how the compiler should put your model together.

Here's a plain and basic version of the .QC file for my couch:


/*
----------------
Officecouch QC
----------------
*/

officecouch.mdl
0 0 0 90
1.0
"Body" "officecouch_1.smd"

"carpet"
Z
"officecouch/"

"idle" "officecouch_1.smd" fps 30

"officecouch_c2.smd"
{
//Mass in kilograms
20.0

}


That's just the bare necessities for a QC file. I'll show you some extras you can put in later.

Now, here's a rundown of what each line does, so you know what to change:
The first five lines are just a header to make it look nice, pretty much. It has no bearing on the actual object.
$modelname _________.mdl - this is the official name of your model.
$origin 0 0 0 90
$scale 1.0 - these two lines would allow you to change the size and origin point of the model, but you should do that on your own in your 3D pacakage beforehand.
$body "Body" "___________.smd" - In this line you designate the .SMD file that is your main, full-res model.
$staticprop - your object is a static prop. I'm sure if you're making a dynamic prop this line would be different.
$surfaceprop "_______" - as we did back when we made a material for the object, this lets you designate what the object is made out of. What does it sound like when you walk on it? What do the bullet holes look like? I don't know why we have to set this option in both places (or if we really even have to), but it's easy enough to do. Once again, here (http://developer.valvesoftware.com/wiki/Material_Surface_Property) is that list of different surface properties you can have. You should see my couch getting shot with the "carpet" property. It's great.
$upaxis ___ - Important! Different 3D software packages choose different things for the "up" axis. 3dsMAX, Maya, XSI, and Mod Tool all use Z to denote height. HOWEVER, Hammer uses Y. What that means is if you don't correct it, your models will come in sideways. If you set the up axis to Z here, it will correct the model for you automatically when it's compiled.
$cdmaterials "__________" - This tells it where your objects materials are located (The .VTF and .VMT files). It assumes you're starting in the \materials directory, so since we're putting textures in their own subdirectory under the model name, your path will be "YourModelName/".
$sequence "idle" "___________.smd" fps 30 - If your model were to animate, this is where you would indicate an animated .SMD file. You'd even be able to designate several animation sequences besides "idle" if you wanted. But if your object doesn't animate, you just need the idle animtaion. You can get that from the main fell-res .SMD that you've entered previously. No animation required.

$collisionmodel "___________.smd" - as you may guess, you indicate the collision model in this line. But what follows in the braces is an estimation of the object's weight (in kilograms). I don't know what a couch weighs, so I just guessed 20. Metric weight units are both convenient and scary. $concave means that the collision model is made up of multiple
objects, so the compiler shouldn't just put one shrink-wrapped shell around the collision model.


That's it! That will give you the ability to compile a basic model. But wait, there are a few features you can add if they apply to your object.

What about level-of-detail models?
If you have a low-res model of your object like the one I made for my couch, you add this little section to your file:

50
{
replacemodel "officecouch_1" "officecouch_2"
}


Remember, officecouch_1 was my full-res model and officecouch_2 was my low-res model.
You can also set multiple levels of detail if you have multiple LOD models:


66
{
replacemodel "officecouch_1" "officecouch_2"
}
33
{
replacemodel "officecouch_1" "officecouch_3"
}



And also, what if your model has multiple textures, like a different color set?
When I want to add the blue version of my couch, I add a section immediately after the $body line:

"Body" "officecouch_1.smd"
skinfamilies
{
{ "officecouch" }
{ "officecouch_b" }
}


This sets up two skin families. The first is my default material, officecouch.vmt. The second is the blue version, officecouch_b.vmt

So for reference, here is the .QC file for my couch, with all the extras added:

/*
----------------
Officecouch QC
----------------
*/

officecouch.mdl
0 0 0 90
1.0
"Body" "officecouch_1.smd"
skinfamilies
{
{ "officecouch" }
{ "officecouch_b" }
}

"carpet"
Z
"officecouch/"

"idle" "officecouch_1.smd" fps 30

50
{
replacemodel "officecouch_1" "officecouch_2"
}

"officecouch_c2.smd"
{
//Mass in kilograms
20.0

}


Are you ready to compile?

Valve created a utility called studiomdl.exe that is run via commandline parameters. It's in the source_sdk\bin\oragebox\bin direcotry. If you don't have a guide or any kind of help for this utility, it can become a very frustrating kink in the pipeline. There are alternatives that create a frontend, but the ones I've tried are pre-OrangeBox and don't seem to work properly. I've worked out a system of creating a .BAT file to compile my models and it removes a great deal of the hassle.

In the direcorty with my .SMD files I create a batch file called "officecouch_compile.bat" that looks like this:

cd c:Program FilesSteamsteamappsYourSteamNamesourcesdkbinorange boxbin
studiomdl.exe -nop4 -game "c:Program FilesSteamsteamappsYourSteamNameteam fortress 2tf" "c:Program FilesSteamsteamappsYourSteamNamesourcesdk_contentt fmodelsrcofficecouchofficecouch.qc"
pause


See how that works?

The first line switches to the directory where studiomdl.exe is stored.

The second line executes it with these parameters:
-nop4 - disables functions that make Studiomdl think you're using Valve's asset-sharing network.
-game path - sets the path to your Team Fortress 2 directory where the game info is stored.
path - sets the path to the .QC file for your model
Remember, for those paths, you need to change the paths to reflect how the directories are set up on your machine. That "YourSteamName" will actually be your Steam login ID. And of course you won't put "officecouch" or "officecouch.qc" in your batch file, but change those to your new object and its directory.

The thrid line is just "pause". This keeps the DOS window from shutting down before you can look at the results of your compile.

Now, you can simply execute that batch file any time you want to recompile your model. It sure beats opening up a DOS window and typing all the crap over and over again.

EXECUTE IT! Compile your model! If you have all your files ready and in the correct directories, and if the paths are all correct, Studiomdl will begin to compile your model... and it shouldn't take long. When it's finished, you should be able to look through your compile log and check for any errors. If it worked, you'll be able to find your model files in the Team Fotress 2\tf\models directory.

Here's what files my couch resulted in:
officecouch.mdl
officecouch.phy
officecouch.vvd
officecouch.dx80.vtx
officecouch.dx90.vtx
officecouch.sw.vtx

You'll need to copy your material files over from your SourceSDK_content folder to your Team Fortress 2 folder. Put all those .VTF and .VMT folders in the Team Fortress 2\tf\Materials\Yourmodel\ directory.

Now, did your model work? There's one very convenient way to find out...

Hawk
02-03-2008, 02:26 AM
Testing and Checking

Within the source_sdk\bin\oragebox\bin directory is a useful tool called hlmv.exe, or the "Half Life Model Viewer". Use this to load the .MDL of your object that was just created when you compiled. I just like to execute my .mdl file, and when Windows asks me what program to open it with, I navigate to hlmv.exe and have it ALWAYS open my .mdl files.

http://www.alternatedimension.com/post/tftut/mdl.jpg

Looks like my couch worked! But hold on... What does the collision model look like? Under the Render tab, on the right, you'll see a checkbox for "Physics Model". Check it.

http://www.alternatedimension.com/post/tftut/mdl2.jpg

Success! Those red lines are the collision model and they seem to work. Uncheck "Physics Model" now that we've seen it. So, does my extra Blue skin work? Click on the Model Tab. You'll see "Skin 1". If I change it to "Skin 2" I get this:

http://www.alternatedimension.com/post/tftut/mdl3.jpg

Also a success. Last of all, does the lower-res model work? Also in the Model Tab, you'll see a box for "Auto LOD". Make sure it's unchecked, and change the "0" in the dropdown box to "1".

http://www.alternatedimension.com/post/tftut/mdl4.jpg

It worked! Of course, if you didn't make any extra levels of detail, or if you made several, there will be a different about of options to check out.


Now, A little troubleshooting for this stage:

My model isn't there! - it may not be in view. Try clicking in the view windo and dragging with the left mouse button. This will swivel your view. Also try clicking and dragging with the right mouse button to zoom in and out.
My model has purple/black checkerboards on it! - your textures or .VMT file are not in the correct path. Recheck your paths based an what I've instructed you earlier. Wunderboy has create a great utlitiy called Source MDL Texture info (http://www.wunderboy.org/sourceapps.php) that you can use on your .MDL file to have it show you the texture information. It will tell you where the model is expecting to find the textures.
My physics model is just a shrinkwrapped shell around my model! - there was a problem with your collision model. It probably had one or more concave parts to it. See the collision model section of this tutorial.
My physics model doesn't exist! - there was some other sort of problem with your collision model. It's possible that one or more of its shapes weren't enclosed, or other problems.
My model is sideways! - You didn't set the correct "up" axis in your .QC file. Go back and see the .QC section (in Compiling).

Buuuuuuuut.... if everything worked, you should feel very special. You now have an object that no other map has. Your map has something custom and all its own. And it sets your map apart from all those other maps that just get by with what Valve gave them. Feel good about yourself.

Now, let's put it in your map!

Open up Hammer and get your map open. You should hopefully already know how to place a static prop in your map. Once you've placed that red cube, double click on it and open up your model browser. You should be able to simply type in the name of your object and find it. And if the object looked right in in hlmv.exe, it should look right here. If the object isn't there at all, then either you don't have the model in the proper directory, or you haven't restarted Hammer since the model was put there. But if it shows up, place it where you want it and feel free to compile the level and test it out. Jump all over the object and enjoy it. You've earned it.

Hawk
02-03-2008, 02:30 AM
http://www.alternatedimension.com/post/tftut/ingame.jpg

Embedding and Distribution
- I'll fill this last one out after a good night's rest when I'm not completely tired. It'll talk about how to embed your new object and textures into your map file with Pakrat for distribution. This will finish off the tutorial.



I want to make this tutorial as complete as possible, so I'm open to questions, complaints, and suggestions. If anything is unclear, please ask me about it.

Is this tutorial too long for a message board? I'm new at this, so let me know if I should change anything.

TheBladeRoden
02-03-2008, 02:34 AM
Here, have a karma

Sean of the Dead
02-03-2008, 02:40 AM
Here, have a karma

good idea, i gave him 1 too :D

Snipergen
02-03-2008, 04:10 AM
Incredible hawk. However, could you explain how the collision model works, since I only see a slight difference between the bad and the good collision model, and for some reason my collision models only work sometimes What are the rules for a perfect collision model?

Youme
02-03-2008, 07:02 AM
Grand tutorial, now all we need is a guide to making the model itself :)

Wiebbe
02-03-2008, 08:01 AM
wow, this is one awesome tutorial :>

Rock
02-03-2008, 08:15 AM
Very well done tutorial. Seems like a lot of work for those extra props but I guess that's what makes the difference between a good map and a great map. ;)

http://i81.photobucket.com/albums/j207/skipatc/Atomic-Rock-sig.png

Dox
02-03-2008, 11:42 AM
Dont bother adding in extra xsi tutorials, the guys at Iwannamap already made some great video tutorials for modeling with XSI.
But this was an amazing tutorial, hawk (another +1 :P ). It filled in alot of things for me that I didnt even realize I was doing wrong! Thanks!

http://i4.photobucket.com/albums/y111/ParadoxContemplation/evilpot.jpg
Omg I was going to unleash this to the general Public!!!

Deadeye2007
02-05-2008, 08:51 AM
From someone who has read pretty much every modelling guide out there for Source and STILL has yet to make a successful model, I thank you. Hopefully this will net me my first custom model and get me on the way to REALLY stellar custom mapping.

My modelling problems seem to be stemming from texturing and UV Mapping. The object itself I can make, but texturing (and properly completing the UV map in photoshop) are beyond me at this point.

ZargonX
02-05-2008, 10:02 AM
Fantastic tutorial!

Voztron
02-05-2008, 06:54 PM
Great stuff, alot of detail has gone into this.
I will have to run through it on the weekend and see how I go :)

Deadeye2007
02-06-2008, 09:10 PM
I still cannot get this to work. I have taken a screenshot of the output from the batch file to see if anyone can help. This is the same problem I ran into before and I am at a loss on how to deal with it. I'm on my last nerve with model compiling for steam. What an archaic system.

http://static3.filefront.com/images/personal/r/rsjaded/117290/qbgeupgiko.jpg

Hawk
02-06-2008, 09:21 PM
Ah... I remember my last nerve.

That screenshot for the compile does give me some clues. First of all, I can tell your collision model isn't completely convex. It also looks like the process isn't finishing, so there's no end product to look at. But there's still a little more I need to know.

What software did you export your .SMD files from?
Are testbox_ref and testbox_idle singular objects?
Do all of your models have UVs and textures assigned to them?

Deadeye2007
02-06-2008, 11:47 PM
Ah... I remember my last nerve.

That screenshot for the compile does give me some clues. First of all, I can tell your collision model isn't completely convex. It also looks like the process isn't finishing, so there's no end product to look at. But there's still a little more I need to know.

What software did you export your .SMD files from?
Are testbox_ref and testbox_idle singular objects?
Do all of your models have UVs and textures assigned to them?

1. XSI Mod Tool - used the valve tool for export

2. The object is a one object cube - used for test purposes as the simplest shape I could make.

3. All models have UVs and textures - I followed the Noesis tutorial to the letter in this regard.

I have never manged to compile without the p4lib.dll error. The "check for write enable" error I have received before. I've even gone as far as changing file permission via DOS to solve the problem, to no avail.

I honestly have no clue what is going on. I can easily compile custom textures with spec maps etc., but this is just beyond me.

phatal
02-07-2008, 03:06 PM
Wow. I had considered making some custom objects, but after seeing this...it's just too much work. :D GREAT tutorial all the same... thanks.

Deadeye2007
02-07-2008, 07:17 PM
I FINALLY GOT A MODEL TO COMPILE! HURRAY!

Here's what I was doing wrong.

The error that says p4lib.dll doesn't seem to do anything negative to the model.

However, the error that said "check for write enable" meant that the compiler could not find the directory, and in turn, was not willing to make that directory. So I went and made the directory myself, and voila! Compiled model.

I still have issues with the texture - ie. its not working at all. But I'm still really pumped about actually getting the model to compile, so its not bothering me too much :P

Buddikaman
02-08-2008, 02:01 AM
This is a fantastic tutorial! Ive been looking around for tutorials on importing objects and they all stink, this has helped me alot. I only wish it was 3dsmax. Good luck on your map!

-Buddikaman-

Deadeye2007
02-08-2008, 08:33 AM
After a bunch of work trying to get my texture to show, I'm going to give up on this particular model. I recall when doing the texture I did not follow one important step in making the UV Map. I did this because the UV map was changing the colors for whatever reason. I was using a red corrugated metal texture, and every time I would UV map it would change each side of the cube to purple, green, yellow etc., and the texture changed color as well.

In any event, I'm going to start another one just to make sure I follow everything to the letter this time.

Thanks again for the great work on this tutorial.

Deadeye2007
02-08-2008, 11:51 PM
I gave it another shot tonight. I got a successful compile, but still no texture showing up. Pink and black in model viewer. I double checked the directory structure and everything looks ok.

Can an improper UV map/XSI texture application cause this? I made damn sure I followed your guide very closely. There was one step that you detailed that DID NOT work for me - that is when you said to apply lambert, add your texture, and then apply to selected. I had to take one extra step to get the texture to show., and that was creating a new UV projection. I wonder if something happened there.

Any advice? I can feel I'm so close now.

Hawk
02-09-2008, 01:55 AM
I'm glad you figured out the directory problem. I probably couldn't have figured that one out.

I had to take one extra step to get the texture to show., and that was creating a new UV projection. I wonder if something happened there.


My tutorial assumes that wherever you brought you model from, you had it fully UV mapped. I've never actually needed to project new UVs in Mod Tool, so I'm not sure what that's about.

But I do have some ideas. Did you try Source MDL Texture Info (http://www.wunderboy.org/sourceapps.php)? For the very first model I made, I couldn't figure out how to get the textures set up. Then I downloaded that tool and made a batch file for it. I dragged my model onto and it analyzed it, telling me exactly what directory my model was looking at to find textures.

Deadeye2007
02-09-2008, 10:34 AM
Thanks for the link to the tool, Hawk. I downloaded it and ran it on my model. It is telling me that my texture must be in the following path:

"<modname>\materials\custom_railing_1\railingtexture_diffuse \"

I see there is an extra "\" in there, which would indicate it wants another folder. I'm going to try and make that folder and see what happens.

HAH! Spelling error. "raillingtexture_diffuse" vs. "railingtexture_diffuse". I'm going to have to go check all of the spellings now.

Deadeye2007
02-09-2008, 11:17 AM
TA DA! I got a working, textured model!!!! You can't even imagine how excited I am right now. Thank you so much for all of your help, Hawk. I very much appreciate your time and efforts.

Hawk
02-09-2008, 11:47 AM
No problem. It's thanks to people like Snipergen and spaceweasels that I even figured it out when I did... Just passing along the knowledge.

Gearloose
02-09-2008, 10:05 PM
Awesome tutorial, Hawk - thanks very much. I'll be trying my hand at creating a model soon thanks to you.

oxy
02-23-2008, 11:40 PM
Humm.. great tutorial..

I have tried many different things. I am trying to get a model from Maya to TF2 and I am close using your method...

Here is what is going on.


My QC File:
/*
----------------
Ball QC
----------------
*/

$modelname ball.mdl
$origin 0 0 0 90
$scale 1.0
$body "Body" "ball_ref.smd"
$staticprop
$surfaceprop "solidmetal"
$upaxis Z
$cdmaterials "ball/"

$sequence "idle" "ball_ref.smd" fps 30

$collisionmodel "ball_col.smd"
{
//Mass in kilograms
$mass 5.0
$concave
}


My Error:

C:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\ball>cd c:\Steam\ste
amapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\ball\ball.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\ste amapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sou rcesdk\bin\hl2\
qdir: "c:\steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\ball\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path: "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\ball\ball.
qc"
Building binary model files...
Working on "ball.qc"
SMD MODEL ball_ref.smd
ERROR: c:\steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\ball\ball.qc(
58): - bad command {
ERROR: Aborted Processing on 'ball.mdl'

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>pause
Press any key to continue . . .


Thanks for any help you guys can give me, I can't complete my ambulance if I can't compile.

Hawk
02-24-2008, 12:06 AM
Hmmmm... that's a tough one. Based on what I see there I can't exactly tell what's going on. But I guess the first things I would try would be making sure all the necessary files (like the .smd files) are in the proper directory. Then, I'd try opening up ball_ref.smd in Mod Tool to make sure it loads properly. My best guess would be a problem with the .smd files, because your .qc file looks good.

oxy
02-24-2008, 02:36 PM
Ok.. after moving the VMT / VMF files to the same directory as the .SMD's I loaded the Reference.SMD up in ModTool.

This is what I got.

Not sure why the ball is looking like this?

http://i263.photobucket.com/albums/ii146/oxygencube/Untitled-1-3.jpg


What does it mean when the edges are highlighted like this?

http://i263.photobucket.com/albums/ii146/oxygencube/Untitled-2.jpg

oxy
02-24-2008, 04:40 PM
So.. I have gone through the entire process again, creating a new model in Maya, new materials, new SMD's, new .QC and I am still getting the same error.

Here is the .QC I am trying to use:
/*
----------------
Pilar QC
----------------
*/

$modelname pilar.mdl
$origin 0 0 0 90
$scale 1.0
$body "Body" "pilar_ref.smd"
$staticprop
$surfaceprop "metal"
$upaxis Z
$cdmaterials "pilar/"

$sequence "idle" "pilar_ref.smd" fps 30

$collisionmodel "pilar_col.smd"
{
//Mass in kilograms
$mass 1.0
$concave
}


Here is the error that the prompt is printing:

C:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar>cd c:\Steam\st
eamapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\pilar\pilar.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\ste amapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sou rcesdk\bin\hl2\
qdir: "c:\steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path: "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar\pila
r.qc"
Building binary model files...
Working on "pilar.qc"
SMD MODEL pilar_ref.smd
ERROR: c:\steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar\pilar.q
c(59): - bad command {
ERROR: Aborted Processing on 'pilar.mdl'

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>pause
Press any key to continue . . .



Here is a hint. When I comment out this area of the .QC:
$collisionmodel "pilar_col.smd"
//{
//Mass in kilograms
// $mass 1.0
// $concave
//}


It compiles but completely skips the collision process so my model doesn't show a Physics Model in model viewer. This is the printing:

C:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar>cd c:\Steam\st
eamapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\pilar\pilar.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\ste amapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sou rcesdk\bin\hl2\
qdir: "c:\steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path: "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf \modelsrc\pilar\pila
r.qc"
Building binary model files...
Working on "pilar.qc"
SMD MODEL pilar_ref.smd
---------------------
writing c:\Steam\steamapps\oxygencube\team fortress 2\tf\models/pilar.mdl:
bones 964 bytes (1)
animations 112 bytes (1 anims) (1 frames) [0:00]
sequences 220 bytes (1 seq)
ik/pose 164 bytes
eyeballs 0 bytes (0 eyeballs)
flexes 0 bytes (0 flexes)
textures 72 bytes
keyvalues 0 bytes
bone transforms 0 bytes
collision 0 bytes
total 1712
---------------------
writing c:\Steam\steamapps\oxygencube\team fortress 2\tf\models/pilar.vvd:
vertices 5232 bytes (109 vertices)
tangents 1744 bytes (109 vertices)
total 7040 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.sw.vtx":
body parts: 8 bytes
models: 20 bytes
model LODs: 12 bytes
meshes: 9 bytes
strip groups: 25 bytes
strips: 27 bytes
verts: 981 bytes
indices: 960 bytes
bone changes: 16 bytes
everything: 2082 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.dx80.vtx":
body parts: 8 bytes
models: 20 bytes
model LODs: 12 bytes
meshes: 9 bytes
strip groups: 25 bytes
strips: 27 bytes
verts: 981 bytes
indices: 960 bytes
bone changes: 16 bytes
everything: 2082 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.dx90.vtx":
body parts: 8 bytes
models: 20 bytes
model LODs: 12 bytes
meshes: 9 bytes
strip groups: 25 bytes
strips: 27 bytes
verts: 981 bytes
indices: 960 bytes
bone changes: 16 bytes
everything: 2082 bytes

Completed "pilar.qc"

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orange box\bin>pause
Press any key to continue . . .


I have attached my ...sourcesdk_content/tf and all of it's contents as a .ZIP file. I would love if somebody could help me out.:confused1::sad::bored:

Snipergen
02-25-2008, 12:35 AM
Ok so your collision mesh is bad. You do know that you have to build a very low poly collision mesh and export this as a diffrent .smd right? You can't just use the original model for collisions, that's too complex, build it from some extruded cubes etc.

oxy
02-25-2008, 02:39 AM
Ok.. so I tried to create a simple cube for my collision SMD. Made it in Maya did a simple UV projection. Then exported it as .obj. I brought that into ModTool. Applied the same texture. And then exported as SMD.

Same error.

Ugh.. and to think am I a pretty smart guy. Valve could deff make this easier.

Termaximus
02-25-2008, 03:26 PM
First off, nice tutorial Hawk. I must say though that it has made me realize I do not want to fool with custom objects for my map cp_2skyscraper (http://tf2maps.net/downloads.php?do=file&id=140) as it appears to have a steep learning curve and I have already neglected my TF2 play time learning how to map.

I do have a slightly unrelated question. You had mentioned that textures for objects must be power of two and the same for width and height (that is 256 x 256, 128 x 128, etc). I wanted to see if this applies for reg textures. I have been doing some basic photoshoping for textures for my map and have seemingly succesfully used dimensions of 256 x 128, 512 x 256, etc for textures that are not square in nature (for paintings, posters, etc). This seems to work when I compile and test map. Is their something I am missing and that could cause others problems when I release beta 3?

Youme
02-25-2008, 03:48 PM
I do have a slightly unrelated question. You had mentioned that textures for objects must be power of two and the same for width and height (that is 256 x 256, 128 x 128, etc). I wanted to see if this applies for reg textures. I have been doing some basic photoshoping for textures for my map and have seemingly succesfully used dimensions of 256 x 128, 512 x 256, etc for textures that are not square in nature (for paintings, posters, etc). This seems to work when I compile and test map. Is their something I am missing and that could cause others problems when I release beta 3?
Are you using pakrat to embed the files into the BSP (any custom content has to be inside the BSP file for other players to get it)

Termaximus
02-25-2008, 04:47 PM
Are you using pakrat to embed the files into the BSP (any custom content has to be inside the BSP file for other players to get it)


Yes I am Youme.

Hawk
02-26-2008, 08:43 PM
Ok.. so I tried to create a simple cube for my collision SMD. Made it in Maya did a simple UV projection. Then exported it as .obj. I brought that into ModTool. Applied the same texture. And then exported as SMD.

Same error.

Ugh.. and to think am I a pretty smart guy. Valve could deff make this easier.

Well, I had a good look at the problems you're running into, and I'm baffled as well. It looks kind of like you have double geometry in that ball picture. And I know the color lines mean something, but I don't know what. I'm honestly not too great with XSI, which is why I do the bulk of my modeling in Maya.

However, one of my buddies at work specializes in XSI and I may be able to ask him what's going on.

One of the real problems with taking files between packages is that certain information can linger like ghosts, undected but causing errors. Certain things like deleting the history or script-driven rebuilds can help, but it's all a tricky matter.

Let me see what I can find out, then I'll get back to you.

Hawk
02-26-2008, 08:47 PM
I do have a slightly unrelated question. You had mentioned that textures for objects must be power of two and the same for width and height (that is 256 x 256, 128 x 128, etc). I wanted to see if this applies for reg textures. I have been doing some basic photoshoping for textures for my map and have seemingly succesfully used dimensions of 256 x 128, 512 x 256, etc for textures that are not square in nature (for paintings, posters, etc). This seems to work when I compile and test map. Is their something I am missing and that could cause others problems when I release beta 3?

To my knowledge, those somewhat irregular textures should work. I think the Source engine just chops a 512x256 image into two 256x256 images and uses them just as efficiently. And I've seen textures among the Valve textures that are similarly proportioned. You just have to stick with those magical numbers: 128, 256, 512, 1024, etc.

oxy
02-27-2008, 10:40 PM
Hawk. Thanks a bunch. If you would like the files I am working on. I have followed your tutorial a few times. I am able to get my reference/high poly to compile so worse come to worse I will just build my collision with brushes.
The only thing that has me worried is how rigging and animation my ambulance doors is going to go. :001_huh:

Hawk
02-28-2008, 03:30 PM
Okay, oxy... I talked to my friend at work and he showed me that those discolored lines on your mesh mean that the vertices on that line are not welded. Try welding them and see what that does for you. If all else fails, zip things up for me and I'll see if I can get it working.

It's becoming more evident that the problem lies in the construction of the mesh itself.

Jive Turkey
03-05-2008, 04:00 AM
Just wanted to report a success here. Your tutorial took a lot of the guesswork out of this so I thank you. I'm making a few models for a friend's map and I'll probably eventually be posting them in that oft-neglected content section of this site for anyone who wants more generic stuff with which to tart up their maps. If I can do it anyone can so I hope we get more content to play with and tutorials like this might aid that. Thanks again.

PS. If you're having trouble with "unable to load module" type errors, as I was, then start Source SDK and click "Refresh SDK Content." That should fix it, although I still get an error about p4lib.dll. My models seem to compile fine anyway.

oxy
03-18-2008, 04:04 PM
Thanks for all your help.

I have finished modeling and texturing the ambulance. See this thread http://forums.tf2maps.net/showthread.php?t=1005&page=7

I have also rigged and animated it to the best of my ability.
After compiling it (still without the collision model) the door and headlights disappear. When I imported it they were separate objects. Is there something special I have to to in order for them to be exported correctly?

..oxy..

Buddikaman
04-06-2008, 03:18 PM
I wanted to thank you for writing this tutorial, it has helped me greatly in figuring out how to import my custom stuff into the game, thanks!

-Buddikaman-

Hawk
04-07-2008, 12:59 PM
You're welcome!

I really should just finish the thing off and write up the part about Pakrat. I've just been so distracted with working on my map.

VelvetFistIronGlove
04-07-2008, 02:51 PM
I too found this thread invaluable, after Buddika pointed me in its direction. I spent a couple of hours trying to figure out how to make a concave physmodel in XSI, and the answer was right here all along!

props!

Spike
04-07-2008, 05:25 PM
great tutorial, but I'm having troubles with the collisions.

Can you tell me how I'm supposed to make the collision model of this palm? (just the trunk)

http://img149.imageshack.us/img149/851/palmcollisiondl5.jpg

Hawk
04-09-2008, 10:29 PM
great tutorial, but I'm having troubles with the collisions.

Can you tell me how I'm supposed to make the collision model of this palm? (just the trunk)


You know, I'd just make a single simple cube that tilts up in the direction of the trunk so that it encases it. Something like that doesn't need complicated collision, nor would anybody even notice if it did.

timberghost_paintball
04-20-2008, 06:36 PM
First off great tutorial.

I figured out how to get my model compiled but I get a purple/black error texture.
here is a screen grab of the texture info app.
http://img.photobucket.com/albums/v368/timberghost/textureerror.jpg
the strange thing in the image seems to be the .vmt instead of .vmf in the file. I'm not sure if this is an error or how to change it.

the other strange thing is that the uv's are perfect in maya and softimage mod tool when textured with a .tiff but when a identical .vtf is applied in s.m.t. the textures are slightly off from left to right on the image. I deleted history before going to s.m.t. and the obj does work with tiff just strange with vtf. I'm not sure if this has to do with the error texture.


here is the text from the .qc file
/*
----------------
teledome QC
----------------
*/

$modelname teledome.mdl
$origin 0 0 0 90
$scale 1.0
$body "Body" "teledome.smd"
$staticprop
$surfaceprop "metalpanel"
$upaxis Z
$cdmaterials "teledome/"

$sequence "idle" "teledome.smd" fps 30

$collisionmodel "teledome_coll.smd"
{
//Mass in kilograms
$mass 20.0
$concave
}


So I'm not sure were to go from here, any help would be great

Hawk
04-21-2008, 12:22 PM
Hmmm... I can't tell what the problem is just yet, but I'll give this a deeper look really soon (hopefully tonight). Maybe I can figure out what the problem is.

timberghost_paintball
04-21-2008, 06:26 PM
I figured it out. The texture shader was saved as a .vmf not a .vmt which is what the texture info app said it was looking for. additionally the wierd uv thing in the softimage mod tool is fine in modelviewer so I guess that was just a s.m.t. bug. The other thing I changed was the formating of the .vmt name to match the texture info app's name by changing "teledome.vmf" to teledome color.vmt" I think this was caused by me changing the texture name after I had assigned it to the model in s.m.t. while the new name worked it didn't jive with the model.

Anyways, many thanks for the help and the tutorial. You might want to double check your tutorial though, in it you call the script that accompanies the textures a ".VMF" and from my experience and the other resources I checked I think it might be ".vmt" then again I may be confused but either way it's working so thankyou.

Hawk
04-21-2008, 11:26 PM
I'm glad you got that figured out. It's nice to hear another TF2 map will have some fun custom objects.

And you're totally right about the VMF/VMT deal. I must have mixed up the extension with a Hammer map's extension as I typed this. Thanks for telling me about it. I've gone through and corrected the problem.

TF2Maps.net is proudly hosted by