Garry's Mod Wiki

Revision Difference

Important_Filetypes#563358

<cat>Dev.Model</cat> <title>Important Filetypes</title> # 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. # Foreword⤶ 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.⤶ # Before compilation⤶ ⤶ ## .SMD These are geometry and animation 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 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, and the "reference" skeleton. 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". It will be usually very simplified version of the reference geometry, for performance purposes. 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. ⤶ <warning>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. </warning>⤶ ⤶ ⤶ ⤶ ⤶ # .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.⤶ ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/SMD)⤶ ⤶ ## .QC⤶ These files act as a set of instructions to be used by default [StudioMdl.exe](https://developer.valvesoftware.com/wiki/StudioMDL_(Source)) compiler in order to determine how the model is "put together".⤶ ⤶ The QC file will control the final output of your model, things like the model name and location, where the materials will be searched in, what SMD files are your reference geometry and physics, etc.⤶ 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⤶ ⤶ Each command is documented in detail in the [Valve Developer Community](https://developer.valvesoftware.com/wiki/Category:QC_Commands)⤶ ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/QC)⤶ ⤶ # After Compilation⤶ ⤶ ## .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. ⤶ ⤶ <warning> 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. </warning>⤶ ⤶ ⤶ the below subheadings are secondary files produced when compiling your MDL file.⤶ This file encompasses most of the information needed by the model for use in game. The main MDL file will include animations, the bounding box, hit boxes, material references, meshes, and LOD information. ⤶ The below subheadings are secondary files produced when compiling your MDL file. They contain more specialized data. ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/MDL)⤶ ## .VVD This file contains data for Bone Weights, Normal, Vertices, Tangents and Texture Coordinates all used by the model This file contains per-vertex data, such as Bone Weights, Normal, Vertices, Tangents and Texture Coordinates all used by the model ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/VVD)⤶ ## .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` This file has multiple variations (all compiled automatically), which will be chosen by the game automatically based on what APIs the game is using. For Garry's 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. ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/VTX)⤶ ## .PHY This file contains the either ridged (props) or jointed (ragdolls) collision model. This file contains the either single (props) or jointed (ragdolls) collision model. ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/PHY)⤶ ## .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. ⤶ # ⤶ <note>This is a visual break in the wall of text to note the change from **Geometry** Filetypes to **Material** Filetypes</note>⤶ ⤶ ⤶ # .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⤶ ⤶ <warning>PNG's with transparency do not work</warning>⤶ ⤶ 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⤶ 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 Garry's Mod, or for models with a huge list of animations, such as NPCs. ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/ANI) ⤶ # Materials⤶ ⤶ ## .VTF⤶ ⤶ This file is a compiled version of an image, also known as a texture. It contains the actual image itself along with any image attributes and the compression information.⤶ ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/VTF), including what tools can generate these and how.⤶ ⤶ ## .VMT⤶ ⤶ This file can either be created by hand (it's just a text file with a special extension) or by using via 3rd party tools. These are what's known as materials. These files act as the handler for one or more 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⤶ ⤶ See more info about this file format on [Valve Developer Community](https://developer.valvesoftware.com/wiki/VMT)