StudioMDL (Source)
For a guide to studiomdl's usage, see Compiling a model.
StudioMDL is the command-line tool used to compile models from intermediate formats exported from modeling packages to the binary .mdl format that is read by the Source engine.
It can be found at common\<gamename>\<gamefolder>\bin\studiomdl.exe
.
Tip:The name "studio" is a throwback to the development of Half-Life, during which Valve used 3D Studio Max to create their models.
Bug: Attempting to use Studiomdl or a shortcut of it pinned to the taskbar in Windows 8 will result in an invalid target path, even when
-game
and an associated path are specified. Using a shortcut on the desktop, however, still works. This is an issue on Microsoft's end, unfortunately. [todo tested in?]Parameters
The only parameter required is a QC file. Any others must come before it.
studiomdl [options] <path\QC>
General
-game <gamedir>
- Override the VProject game path.
-quiet
- Suppresses some console output, such as spewing the searchpaths.
-x360
- Enable Xbox 360 output, overriding the
Gameinfo.txt
-nox360
- Disable Xbox 360 output, overriding the
Gameinfo.txt
-nowarnings
- Disable warnings.
-maxwarnings <int>
- Print no more than the specified number of warnings.
Animation
-definebones
- See
$definebone
. -printbones
- Writes extra bone info to the console.
-printgraph
- Todo: Appears to dump xnode data for each node?
-overridedefinebones
- Equivalent to specifying
$unlockdefinebones
in QC. -checklengths
- Prints engine-ready keyframe data for each animation.
Performance
-fastbuild
- Skip processing
.sw.vtx
(DX6/DX7),.dx80.vtx
, and.360.vtx
variants (use.dx90.vtx
only). This speeds up compiling. - Important:In games before , if the
.dx80.vtx
is absent for a static prop, VRAD will fail to generate lighting for that prop! -preview
- Skip splitting quads into tris and building tristrips. This changes the rendering flags for the model, most likely resulting in slower performance or buggier rendering in-engine.
-fullcollide
(only in )- Don't truncate really big collision meshes
- Note:(in all games since ) use
$maxconvexpieces
, as -fullcollide does nothing. -striplods
- Ignore all
$lod
commands. -minlod <lod>
- Throw away data from LODs above the given one (see
$minlod
). -mdlreport <path\model.mdl>
- Report performance info for an already-compiled model. A QC file is not needed when using this command.
-perf <path\model.mdl>
- Same as
-mdlreport
. -mdlreportspreadsheet
- Report performance info, per-LOD, as a comma-delimited spreadsheet. It will appear in the form:
Path to VTX, VTX file extension, LOD number (1 is the root lod), tri count, number of batches rendered, number of materials used
- Must be used with -mdlreport or -perf!
- Note:It doesn't actually write a spreadsheet to disk; use
>
to pipe output to a CSV file.
Debug
-d
- Dumps various glview files (10 per LOD per VTX file),
-h
- Dump hitboxes to console.
-n
- Tag bad normals.
-dumpmaterials
- Dump names of used materials to the console.
-i
- Ignore warnings.
-t <material>
- Replaces all materials with the specified material.
-parsecompletion
- Prints an easily parseable message indicating whether the compile was successful or a failure.
-collapsereport
- Prints info on which bones are being retained and which bones are being collapsed.
Other
-nop4
- Disables Valve's Perforce integration. Unless you actually have Perforce set up for your game/mod (a highly unlikely scenario), you should use this.
-verify
- Compile the model, but don't actually write the results to disk.
-a <normal_blend_angle>
- Auto-smooth faces equal to or below specified angle in degrees. By default, Studiomdl blends normals that are 2 degrees or less apart. Will override normal data for all meshes.
-f
(removed since )- Flip all triangles.
-vsi <path\[QC|MDL]>
- Generates a VSI file from a QC or MDL.
-stripmodel <path\model.mdl>
- Strips down a model, removing its LOD info.
-stripvhv <path\sp_hdr_x.vhv>
- Strips down hardware verts (VHV) of their LOD info.
-makefile
- Generates a simple makefile for later compiling. It also parses the QC for any errors, and runs in
-quiet
mode. -basedir <path>
- Runs studiomdl in the context of the provided path.
-tempcontent <path>
- Adds the provided path as a content search path.
Nonfunctional
-r
- "Tag reversed".
-ihvtest
- Probably meant to test the model collision for any physics errors. Skips whatever argument is provided after it.
Input Files
StudioMDL supports a range of input formats. These include SMD, DMX, OBJ, and VRM for reference meshes, SMD and DMX for skeletal animation, and VTA and DMX files for vertex and flex animation. Counter-Strike: Global Offensive also supports FBX, but with limited functionality. Flexes are not directly supported, nor are FBX sequences, however an SMD/DMX sequence can be used on an FBX model.
Note:While FBX does technically support flex animations, an SMD file is required to generate the VTA file, making the use of an FBX file for flexes redundant.
Format | Mesh | Skeletal animation | Vertex/flex animation |
---|---|---|---|
SMD SMA (in all games since ) PHYS (in all games since ) |
Yes | Yes | Yes |
DMX (in all games since ) XML (in all games since ) MPP (in all games since )[confirm] |
Yes | Yes | Yes |
OBJ | Yes | No | No |
FBX (in all games since ) | Yes | (only in NekoMDL) | (only in NekoMDL) |
VRM | Yes | Yes | No |
VTA | No | No | Yes |
Note:Formats listed in the same row are treated identically by compilers; i.e.
file.xml
will be treated as if it were a DMX file.Output files
mymodel.mdl
- Skeleton, animations, bounding/hit boxes, surface materials, LOD index…
mymodel.sw.vtx
mymodel.360.vtx
mymodel.dx80.vtx
mymodel.dx90.vtx
- Vertex data optimized for DirectX 6/7, Xbox 360, DirectX 8, and DirectX 9 respectively. Note:
.360.vtx
files are just byteswapped.dx90.vtx
files. mymodel.vvd
- Remaining hardware-agnostic vertex data, including the UV map
mymodel.phy
- Collision mesh data. Omitted if no $collisionmodel is defined.
See also
- Common Studiomdl errors
- Crowbar, a popular graphical frontend for studiomdl which also supports model decompiling and other advanced features.
- Studiocompiler, a graphical frontend for studiomdl
- GUIStudioMDL, another graphical frontend
- Source Model Compiler, a web based model compiler and QC generator.
- NekoMDL, a modified fork of StudioMDL with additional features and increased limits
- Fixing the 5% Weight Bone Link Cull, for SFM
|
|