Garry's Mod Wiki

Revision Difference

Important_Filetypes#561654

<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.⤶ ⤶ 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. ⤶ ⤶ # .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.⤶ ⤶ 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.⤶ ⤶ # ⤶ ⤶ <note>This is a visual break in the wall of text to note the change from **Geometry** Filetypes to **Material** Filetypes</note>⤶ ⤶ # .TGA⤶ This is a non-valve specific image format. Any Additional information needed can be found online with google.⤶ ⤶ ⤶ # .VTF⤶ This file is a compiled version of a TGA image using `studiocompiler`. It contains the actual image itself along with any image attributes and the compression information.⤶ ⤶ These will also sometimes contain the pre-compressed texture itself⤶ ⤶ if it helps this fills the same role as the SMD filetype does for the geometry part of the model. except this file type is for images⤶ ⤶ # .VMT⤶ This file can either be created by hand or by using `studiocompiler`. This specifies 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⤶ ⤶ again this can be seen as the QC file but for materials instead of geometry.⤶ ⤶ # .JPG⤶ These are not valve-specific files, but are optionally created images that appear in the tools file browser making it easier to identify which model is which. Preview images must be at least 96x72 in size, anything larger will be scaled down. ⤶ ⤶