Garry's Mod Wiki

Important Filetypes

Frontmatter

Creating any sort of model requires you to be familiar with a handful of filetypes specific to source development. This page will attempt to cover all the relevant file types you may encounter, what they do, and how to view / edit them

.SMD

These are geometry files. These files will be what you need to create in Blender or any other 3D modeling software that can export to this filetype.

There are three "types" of these files:

  • Reference Geometry
  • Physics Geometry
  • Animation Data

All of these "types" are of differentiated in name. these are all compiled in the same manor but the data contained within is different.

The Reference Geometry is the mesh that you will visually see within the game, everything included in this SMD should just be polygons that you want to see in game.

The Physics Geometry is the mesh that will be used in the physics engine to calculate all the physics for the model. This is sometimes denoted with terms such as "phys" or "physbox".

The Animation Data SMD only contains two things within it; enough skeleton data for StudioMdl to match the skeleton to the one in the Reference Geometry, and the actual animation data itself.

SMD Files can only store up to maximum of 10,000 polygons, 17,433 Vertices, 4,096 texture resolution, and 128 bones. These should not be your "goal" numbers, these are the limits of what the engine can handle, looking at half life 2 your average humanoid model should be about 5,000 polygons.

.QC

These files act as a set of instructions to be used by StudioMdl compiler in order to determine how the model is "put together".

The QC file will control the final output of your model, things the models name and location, however this will also be how you will define your SMD files to the StudioMdl program. The compiler will look to this file to determine which SMD file to use for your reference geometry and physics

It will also include more complex "innate" logic, like where to place sprites, particles, and even what animations should be playing.

This file uses commands prefixed with a $ to tell the compiler what information to use for that part of the model.

Here is an example of the most common QC commands:

$modelname "props_sdk\myfirstmodel.mdl" $body mybody "myfirstmodel-ref.smd" $surfaceprop combine_metal $cdmaterials "models\props_sdk" $sequence idle "myfirstmodel-ref.smd" // no animation wanted, so re-using the reference mesh $collisionmodel "myfirstmodel-phys.smd" { $concave }

Don't worry if you don't understand what these specific QC commands do yet, just get familiar with their structure. Understand that every line starts with a QC Command indicated by the $ then is followed by the parameters for the command.

.MDL

This is your final, compiled, binary model. This is what will be outputted by the StudioMdl program and what will be used in the game.

This file Encompass nearly all the information needed by the model for use in game. The main MDL file will include Animations, The Bounding Box, Hit Box, Material, Meshes, and LOD information.

Some NPC's or Similar Models make use multiple MDL files to hold animation data. Usually this is the class name of the NPC followed by the animation name.

MDL Files have a maximum of 63,828 vertices and 127,474 triangles. These are notably higher than the SMD limits because MDL files can reference and use multiple SMD files at once. Remember these are engine limit numbers, any MDL that exceeds these numbers will result in a broken model.

the below subheadings are secondary files produced when compiling your MDL file.

.VVD

This file contains data for Bone Weights, Normal, Vertices, Tangents and Texture Coordinates all used by the model

.VTX

This fille has multiple variations that all depend on what software the game is using to run. There are often multiple instances of these files making the model more accessible on all hardware.

For Garrys Mod that runs on DirectX 9.0 the most important variation of these files will be named *.dx90.vtx

These files store hardware optimized material, skinning and triangle strip/fan information for each LOD of the model.

.PHY

This file contains the either ridged (props) or jointed (ragdolls) collision model.

.ANI

This file is sometimes created for on-demand loading of animation sequences defined in the QC file with the command $animblocksize. However these are not that common and typically reserved for Source Cinematic Physics not commonly found in Garrys Mod.

This is a visual break in the wall of text to note the change from Geometry Filetypes to Material Filetypes

.VTF

This file is a compiled version of an image using studiocompiler. It contains the actual image itself along with any image attributes and the compression information. any image format (besides PNG) can be used as along as it can be compiled into a .VTF

PNG's with transparency do not work

These will also sometimes contain the pre-compressed texture itself

.VMT

This file can either be created by hand or by using studiocompiler. These files act as the handler for VTF files to provide metadata needed by the source engine for using the material. It includes information about how the material should be rendered, shader parameters, other textures, and misc render settings