Troubleshooting Modeling

From Valve Developer Community
Jump to: navigation, search


Trouble with Importing

XSI can't read my decompiled SMD, it says the file is invalid or corrupt
XSI's smd importer doesn't work if there is a space within a texture name(e.g. "crossbow dirtmap.bmp"). To fix it, open the smd file in text editor, and check texture names. If you find one with a space, replace the space with underscore(e.g. "crossbow dirtmap.bmp" to "crossbow_dirtmap.bmp"), and save. Now XSI can import it.

Trouble with Exporting

The export process currently works for XSI 4+ and is reported to work for 5.0, but not 5.0.1 or 5.1. There is currently no available fix for the Valve addon using the latest version of XSI.

Trouble with Compiling Models

Prop

I don't know how to make physics models.
Add prop_data section to your .qc. See Prop_Data and Physics Entities on Server & Client
I added prop_data, but still it doesn't work.
If you have $staticprop in your .qc, drop it.
Error_Access_Violation.

The reason the problem is occuring is simply because your QC file is not written correctly, or rather that the SDK isn't understanding it. The key to fixing the problem is to specify all of the paths to your model's source files. (IE where you're keeping them on your hard drive)

$modelname warzone/ships/enemy_ship.mdl
$cdmaterials models/warzone/ships
$staticprop
$surfaceprop "metal"
$scale 0.5
$body studio "Z:/warzone/models/smds/enemy_ship_ref.smd"
$sequence idle "Z:/warzone/models/smds/enemy_ship_ref.smd" loop fps 15
$collisionmodel "Z:/warzone/models/smds/enemy_ship_ref.smd" {
   $Mass 2000
   $concave
}


In the first line ($modelname warzone/ships/enemy_ship.mdl), you specify the directory you want the compiled model to be placed in. warzone/ships/ means that the compiled model will be placed in the models directory of your mod in the sub folders warzone/ships. As such, you need to create the same directory structure in the models/materials/ folder of your mod and place the model's vtf and vmt files there which is what the next line is. ($cdmaterials models/warzone/ships)

The next 3 lines should be self explanitory;

$staticprop - use this line to specify that the model has no moving parts (IE no animation) if you want to make an animated model, simply remove this line.

$surfaceprop "metal" - this specifies the overall material of the model. Don't worry if some parts of the model are a different material (my ship has glass windows) this is more for the physics than anything else.

$scale 0.5 - this is the scale of the model. I wanted my ship to be compiled at half the normal size.

Now this is where you need to specify the paths of the source files on your hard drive. In my case, I store the files on my Z:\ drive (yeah its weird) under the folders models and then smds.

$body studio "Z:/warzone/models/smds/enemy_ship_ref.smd" - Absolutely required for the model to compile. I even specify the extension because I ran into an error where the sdk was looking for an obj file when I did not specify. Doesn't hurt to be precise.

$sequence idle "Z:/warzone/models/smds/enemy_ship_ref.smd" loop fps 15 - this is the idle sequence for the model. With a static model, you can simply use your reference smd. For an animated model, you would want to use the "skeletal animation" smd. You can also specify as many sequences as you like here. [i]$sequence flaps_down "Z:/warzone/models/smds/enemy_ship_flaps_down_ani.smd" loop fps 30[/i] would be how I would name an animation for the wing flaps of my ship moving down.

$collisionmodel "Z:/warzone/models/smds/enemy_ship_ref.smd" { - this is the collision model. $Mass 2000 - this is the mass in kilograms of the model (for physics) $concave - all collision models MUST be concave. Which means they must be built from several boxes if you're making something like an archway model that the player can walk under/through.

If you have a custom collision model, then you would specify it above. If, like in my example, you don't have a custom collision model, simply specify your reference smd and the SDK will generate one for you automatically.


After creating this QC I run studiomdl from the command prompt:

Start - Run - cmd [enter] - don't type anything in the [ ] just press the key

now inside the command prompt window I type:

cd "%studiomdl%" [enter] - yes you need the quotes

cd g: [enter] - this switches to the hard drive you have steam installed in. If you installed steam on your C: drive which is the default location, then you would type cd c: instead of cd g:

cd bin [enter] cd ep1 [enter] cd bin [enter]

now you are in the proper directory for running studiomdl

studiomdl - Z:\warzone\models\smds\enemy_ship.qc [enter]

A little trick that I have to save time is that I open the directory where my smd and qc file is located in My Computer, copy the "address" and then after typing studiomdl - I right click on the command prompt window and choose paste from the drop down. Then I only have to type \enemy_ship.qc

After waiting a few seconds, your model should compile and place itself in the correct location for viewing in Hammer or the model viewer.

Collision Models

Collision models are truncated if there are over 20 convex pieces, however this limit may be bypassed with the -fullcollide command line parameter. See the Compiling Models article.

In-HLMV problems

I can't find my .MDL file
See model compile log, and check if the compile was successful.
My model won't show up in HLMV
Try wireframe mode. If you see your model in wireframe mode, it's possibly your texture that has a problem. See "My textures won't show up. It's just black" below. If you can't see anything in wireframe, open your reference .SMD with Notepad. Make sure it contains mesh information.
My model shows up, but size/shape is not right
Go back to the 3D program. If you are using XSI, freeze the model using Freeze and Transform > Freeze All Transforms commands. If you are using 3DsMax, apply the Reset XForm modifier. Then export your .SMD and compile it again.
My textures won't show up. I see pink/black checkers. | Black Counter-Strike: Global Offensive
If you see pink/black checkers, it means that HLMV couldn't find textures. There are two possibilities. Case one, .MDL's texture path is incorrect, so HLMV can't find .vmt files. Use Source MDL Texture Info and check your .MDL's texture path. Case two, HLMV could find .vmt, but .vtf texture path in .vmt is incorrect. This often happens when you have moved .vmt/.vtf file location. Open your .vmt, and check $basetexture value.
My textures won't show up. It's just black | Invisible Counter-Strike: Global Offensive
Open .VMT file. If you use LightmappedGeneric, change it to VertexLitGeneric. LightmappedGeneric is for brush geometry, not for model geometry (The problem will also occur if you use other shaders that don't work on models or don't exist outright). It is also possible that your model is pointing to a material that doesn't exist.

In-game problems

My model won't show up
Open the console, check the error log. Make sure your model is of the proper type (prop_physics, prop_static, etc.)

See also