Studiomodel

From Valve Developer Community
Jump to: navigation, search

A Studiomodel is a fully compiled model that can be loaded into the Source Engine, Hammer, HLMV, etc. Although model is often used to refer to a studiomodel, it is also frequently used to refer to uncompiled geometry data contained in an SMD file or any other model editor format. A particular Studiomodel is usually specified by its modelname.mdl, because the MDL file acts as an index of the other data files a Studiomodel needs in order to function (ie its MDL, PHY, VVD, VTX Geometry data and VMT Skins).

  • Blank image.pngTodo: Differences between studiomodel, brush and sprite ...

File Structure

All of a Studiomodel's Geometry and Properties Data are stored in a number of binary files under game_dir/models/, except Skin Data which is stored under game_dir/materials/models/ as VMT and VTF files. The Binaries are compiled by StudioMDL. As binaries they are neither editable nor even readable. To decompile a Studiomodel - to its more human-friendly SMD and QC files - point Crowbar, MdlDecompiler or a similar tool at the model's .mdl file. A number of uncompiled model files are provided as illuminating examples in the various subfolders of .../steamapps/<username>/sourcesdk_content/.

MDL

("Model") The modelname.mdl, contains a range of key/index information:

  • The Studiomodel's Filepath and Filename, used to identify itself and its VTX, VVD, PHY files to the Game Engine, Hammer, etc.
  • The name of every material (VMT) file this model may use as a Skin for the Rendering Engine, Hammer Entity Properties, etc.
  • The name of every sound WAV file used by this model, located in ...?
  • The name of every bone, joint and attachment point of this model's Skeleton.
  • The name of every Animation Activity, Sequence, Gesture, Posture or Library used by this model, located in ...?
  • Any $keyvalues such as propdata attributes this model may have, including
    • The name of every Gib.mdl file used by this model, located in ...?
  • etc

VVD

("Valve Vertex Data") The modelname.vvd stores position independent flat data for the

  • Renderable Mesh(es) geometry (note: the skins are in VMT files)
  • Skeletal Animation data ?

VTX

("Valve Vertex") is currently found in several flavours: modelname.sw.vtx (Software), ~.dx80.vtx (DirectX 8.0) ~.dx90.vtx (DirectX 9.0) and ~.xbox.vtx (XBox). Each stores Rendering data optimized for that particular GPU pipeline, including

PHY

("Physics") modelname.phy stores the model's (rigid or jointed) collision model data including

  • Vertex geometry and Smoothing group data, (no Texturemap used)
  • $jointconstraint configuration,
  • $mass, $volume (calculated), etc
  • all physics prop data except for propdata?

ANI

("Animation Library") An optional modelname.ani or modelname_anim.mdl is an Animation Library, containing a whole bunch of sequences for a specific Skeleton. Whilst sequences can be (and are) stored in the main MDL, external libraries are often used either to prevent the main MDL getting too bloated and/or to allow several (similar) models to share a large number of common animations. For example, a simple machine model like health_charger001.mdl has only two very simple sequences which are stored in the MDL, whereas NPC models tend to use libraries : npc_headcrab has its own npc_headcrab.ani library, and male_shared.mdl is used by at least 45 separate NPC models.

VMT

("Valve Material Type") default_skin.vmt is used to store the Skin's: