Difference between revisions of "Studiomdl"

From Valve Developer Community
Jump to: navigation, search
m (See also: Added navbox)
(Specified/Corrected CS:GO's level of support for FBX)
 
(25 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
{{otherlang2|ru=Studiomdl:ru|es=Studiomdl:es}}
 
{{otherlang2|ru=Studiomdl:ru|es=Studiomdl:es}}
 
 
:''For a guide to studiomdl's usage, see [[Compiling a model]].''
 
:''For a guide to studiomdl's usage, see [[Compiling a model]].''
  
 
{{toc-right}}
 
{{toc-right}}
  
'''Studiomdl''' is the [[command-line]] tool used to compile [[model]]s from the intermediate [[Studio Model Data]] format exported from modeling packages to the binary .mdl format that is read by the Source engine.
+
'''Studiomdl''' is the [[command-line]] tool used to compile [[model]]s from intermediate formats exported from modeling packages to the binary .mdl format that is read by the Source engine.
  
It can be found at <code>steam/steamapps/<account>/sourcesdk/bin/[orangebox|ep1]/bin/studiomdl.exe</code>.
+
It can be found at <code>"common\<gamename>\<gamefolder>\bin\studiomdl.exe"</code>.
  
 
{{tip|The name "studio" is a throwback to the development of [[Half-Life 1]], during which Valve used [[3D Studio Max]] to create their models.}}
 
{{tip|The name "studio" is a throwback to the development of [[Half-Life 1]], 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 is specified. However using a shortcut on the desktop still works. This is an issue on Microsoft's end unfortunately.}}
  
 
== Parameters ==
 
== Parameters ==
Line 19: Line 19:
 
=== General ===
 
=== General ===
  
; <code>-game <gamedir></code>
+
;<code>-game <gamedir></code>
: Override system-wide game path.
+
:Override the VProject game path.
 
;<code>-quiet</code>
 
;<code>-quiet</code>
:Theoretically suppresses console output. In practice does nothing.
+
:Suppresses <i>some</i> console output, such as spewing the searchpaths.
 
;<code>-x360</code>
 
;<code>-x360</code>
:Enable Xbox 360 output (OB).
+
:Enable Xbox 360 output, overriding the [[Gameinfo.txt]]
 
;<code>-nox360</code>
 
;<code>-nox360</code>
:Disable Xbox 360 output (Ep1).
+
:Disable Xbox 360 output, overriding the [[Gameinfo.txt]]
 
;<code>-nowarnings</code>
 
;<code>-nowarnings</code>
 
:Disable warnings.
 
:Disable warnings.
 +
;<code>-maxwarnings <[[int]]></code>
 +
:Print no more than the specified number of warnings.
  
 
=== Animation ===
 
=== Animation ===
Line 37: Line 39:
 
: Writes extra bone info to the console.
 
: Writes extra bone info to the console.
 
; <code>-printgraph</code>
 
; <code>-printgraph</code>
: Writes some kind of animation weight graph to the console.
+
: {{Todo|Appears to dump xnode data for each node?}}
 
; <code>-overridedefinebones</code>
 
; <code>-overridedefinebones</code>
 
: Equivalent to specifying [[$unlockdefinebones]] in QC.
 
: Equivalent to specifying [[$unlockdefinebones]] in QC.
 +
; <code>-checklengths</code>
 +
: Prints engine-ready keyframe data for each animation.
  
 
=== Performance ===
 
=== Performance ===
  
 +
; <code>-fastbuild</code>
 +
: Skip processing DX7, DX8, X360, and software VTX variants (use .dx90.vtx only). This speeds up compiling.
 +
; <code>-preview</code>
 +
: Skip splitting quads into tris. This changes the rendering flags for the model, most likely resulting in slower performance or buggier rendering in-engine.
 
; <code>-fullcollide</code>
 
; <code>-fullcollide</code>
 
: Don't truncate really big [[collision mesh]]es (Ep1 only; OB uses [[$maxconvexpieces]]).
 
: Don't truncate really big [[collision mesh]]es (Ep1 only; OB uses [[$maxconvexpieces]]).
Line 49: Line 57:
 
;<code>-minlod <lod></code>
 
;<code>-minlod <lod></code>
 
:Throw away data from LODs above the given one (see [[$minlod]]).
 
:Throw away data from LODs above the given one (see [[$minlod]]).
;<code>-perf</code>
 
:Report performance info in console.
 
 
;<code>-mdlreport <path\model.mdl></code>
 
;<code>-mdlreport <path\model.mdl></code>
 
:Report performance info for an already-compiled model. A QC file is not needed when using this command.
 
:Report performance info for an already-compiled model. A QC file is not needed when using this command.
 +
;<code>-perf <path\model.mdl></code>
 +
:Same as '''-mdlreport'''.
 
;<code>-mdlreportspreadsheet</code>
 
;<code>-mdlreportspreadsheet</code>
:Report performance info as a comma-delimited spreadsheet. {{TODO|Usage}}
+
:Report performance info, per LOD, as a comma-delimited spreadsheet. It will appear in the form:
 +
:<source>Path to VTX, VTX file extension, LOD number (1 is the root lod), tri count, number of batches rendered, number of materials used </source>
 +
:'''Must be used with -mdlreport or -perf!''' {{Note|It doesn't actually <i>write</i> a spreadsheet to disk.}}
  
 
=== Debug ===
 
=== Debug ===
Line 61: Line 71:
 
:Dumps various [[glview]] files (10 per LOD per VTX file),
 
:Dumps various [[glview]] files (10 per LOD per VTX file),
 
;<code>-h</code>
 
;<code>-h</code>
:Dump [[hitbox]]es to console,
+
:Dump [[hitbox]]es to console.
 
;<code>-n</code>
 
;<code>-n</code>
 
:Tag bad normals.
 
:Tag bad normals.
Line 69: Line 79:
 
:Ignore warnings.
 
:Ignore warnings.
 
;<code>-t</code>
 
;<code>-t</code>
: Replaces all materials with the default pink check pattern
+
:Replaces all materials with the default pink check pattern
 +
;<code>-parsecompletion</code>
 +
:Prints an easily parseable message indicating whether the compile was successful or a failure.
 +
;<code>-collapsereport</code>
 +
:Prints info on which bones are being retained and which bones are being collapsed.
  
=== Unknown ===
+
=== Other ===
  
 +
;<code>-nop4</code>
 +
:Disables Valve's Perforce integration. Unless you actually have Perforce set up for your game/mod (a highly unlikely scenario), you should use this.
 +
;<code>-verify</code>
 +
:Compile the model, but don't actually write the results to disk.
 
;<code>-a <normal_blend_angle></code>
 
;<code>-a <normal_blend_angle></code>
:?
+
:Auto-smooth faces equal to or below specified angle. Will override normal data for all meshes.
;<code>-checklengths</code>
 
:?
 
 
;<code>-f</code>
 
;<code>-f</code>
 
:Flip all triangles.
 
:Flip all triangles.
 +
:{{bug|Does not work in Orangebox and later builds of Studiomdl. You can achieve the same behavior with [[$body]], however.}}
 +
;<code>-vsi <path\[QC|MDL]></code>
 +
:Generates a [[VSI]] file from a [[QC]] or [[MDL]].
 +
;<code>-stripmodel <path\model.mdl></code>
 +
:Strips down a model, removing its LOD info.
 +
;<code>-stripvhv <path\sp_hdr_x.vhv></code>
 +
:Strips down hardware verts ([[VHV]]) of their LOD info.
 +
;<code>-makefile</code>
 +
:Generates a simple makefile for later compiling. It also parses the QC for any errors, and runs in <code>-quiet</code> mode.
 +
;<code>-basedir <path></code>
 +
:Runs studiomdl in the context of the provided path.
 +
;<code>-tempcontent <path></code>
 +
:Adds the provided path as a content search path.
 +
 +
=== Nonfunctional ===
 +
 
;<code>-r</code>
 
;<code>-r</code>
:"Tag reversed"..?
+
:"Tag reversed".  
;<code>-vsi <path\[QC|MDL]></code>
+
;<code>-ihvtest</code>
:Generate stripping information .vsi file. Works with QC and MDL. (Some sort of memory optimisation function? Possibly related to Xbox 360.)
+
:Probably meant to test the model collision for any physics errors. Skips whatever argument is provided after it.
;<code>-stripmodel</code>
+
 
:Process binary model files (VSI?) and strip extra lod data.
+
== Input Files ==
;<code>-stripvhv</code>
+
StudioMDL supports a range of input formats. These include [[Studiomdl Data|SMD]], [[DMX model|DMX]], and [[OBJ]] for reference meshes and [[VTA]] files for vertex and flex animation. {{csgo}} [[Counter-Strike: Global Offensive]] also supports [[FBX]], but with limited functionality. [[Flex_animation|Flexes]] are not directly supported, nor are FBX sequences, however an SMD/DMX sequence can be used on an FBX model.
: Strip hardware verts to match the stripped model.
+
 
 +
{{note|While FBX does technically seem to support flex animations, an SMD file is required to generate the VTA file, making the use of an FBX file for flexes redundant.}}
  
 
== Output files ==
 
== Output files ==
  
 
;<code>mymodel.mdl</code>
 
;<code>mymodel.mdl</code>
:[[Skeleton]], animations, bounding/hit boxes, surface materials, [[lod]] index...
+
:[[Skeleton]], animations, bounding/hit boxes, surface materials, [[LOD]] index...
 
;<code>mymodel.sw.vtx</code>
 
;<code>mymodel.sw.vtx</code>
 +
;<code>mymodel.360.vtx</code>
 
;<code>mymodel.dx80.vtx</code>
 
;<code>mymodel.dx80.vtx</code>
 
;<code>mymodel.dx90.vtx</code>
 
;<code>mymodel.dx90.vtx</code>
:Vertex data optimised for DirectX 7, 8 and 9 respectively
+
:Vertex data optimised for software rendering, XBox 360, DirectX 7, 8 and 9 respectively. {{Note|.360.vtx files are just byteswapped .dx90.vtx files.}}
 
;<code>mymodel.vvd</code>
 
;<code>mymodel.vvd</code>
 
:Remaining hardware-agnostic vertex data, including the [[UV map]]
 
:Remaining hardware-agnostic vertex data, including the [[UV map]]
Line 104: Line 138:
  
 
* [[Compiling a model#Common_errors|Common Studiomdl errors]]
 
* [[Compiling a model#Common_errors|Common Studiomdl errors]]
 +
* [[Crowbar]], a popular graphical interface for studiomdl which also supports model decompiling and other advanced features.
 
* [[Studiocompiler]], a graphical interface for studiomdl
 
* [[Studiocompiler]], a graphical interface for studiomdl
 
* [[GUIStudioMDL]], another graphical interface
 
* [[GUIStudioMDL]], another graphical interface
 
* [[Source Model Compiler]], a web based model compiler and QC generator.
 
* [[Source Model Compiler]], a web based model compiler and QC generator.
 +
* [https://gamebanana.com/tuts/12511 Fixing the 5% Weight Bone Link Cull], for SFM
  
 
{{SDKTools}}
 
{{SDKTools}}
  
 
[[Category:Modeling]]
 
[[Category:Modeling]]

Latest revision as of 23:03, 18 July 2019

Español Русский
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.png Tip: The name "studio" is a throwback to the development of Half-Life 1, during which Valve used 3D Studio Max to create their models.
Bug.png 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 is specified. However using a shortcut on the desktop still works. This is an issue on Microsoft's end unfortunately.

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
To do: 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 DX7, DX8, X360, and software VTX variants (use .dx90.vtx only). This speeds up compiling.
-preview
Skip splitting quads into tris. This changes the rendering flags for the model, most likely resulting in slower performance or buggier rendering in-engine.
-fullcollide
Don't truncate really big collision meshes (Ep1 only; OB uses $maxconvexpieces).
-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.png Note: It doesn't actually write a spreadsheet to disk.

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
Replaces all materials with the default pink check pattern
-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. Will override normal data for all meshes.
-f
Flip all triangles.
Bug.png Bug: Does not work in Orangebox and later builds of Studiomdl. You can achieve the same behavior with $body, however.
-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, and OBJ for reference meshes and VTA files for vertex and flex animation. <Counter-Strike: Global Offensive> 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.png Note: While FBX does technically seem to support flex animations, an SMD file is required to generate the VTA file, making the use of an FBX file for flexes redundant.

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 optimised for software rendering, XBox 360, DirectX 7, 8 and 9 respectively.
Note.png 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

See also