From Valve Developer Community
Jump to: navigation, search

In Source, the Skin (sometimes called the surface, texture or material of the model) defines how the visible surface of the model is Rendered. The Rendered Skin is projected over the Mesh which envelopes the Skeleton.

In order to be visible in game, each model requires at least one skin (the default skin). It may also use multiple skins and/or have additional alternative skins. Each skin may also have a number of versions optimised for LOD-substitution.

The actual pixel matrices (colors, normals, etc) (generally known as "textures") are not included in the Mesh, and are not compiled by StudioMDL. Instead, they must be compiled as VTF texture files and included in a VMT material file The model's Skinnames are the filenames of VMT files. As well as referencing which VTF files to use as the model's colormap, bumpmap, specularmap, luminositymap and/or opacity map, the Skin.vmt specifies which Shader Parameters to use when rendering the model. The Skin's $surfaceproperties specify which decals and sounds to use for collisions or damage to the surface.

Default Skin

The Default Skin is the name of the image file used when creating the UV map in the Reference.smd model. (the extension - .tga, .bmp, etc - is recorded but not used in compiling). By default, the compiled model expects to find a VMT with the same name as the Default Skin in the game_dir/materials/models directory. If it's not there, the model will be rendered with the "pink check" error material.

Multiple Skins

Some models may use more than one Skin.vmt at the same time, in order to specify different material properties for different parts of the model. This should be avoided wherever possible, as it generally makes the model more "expensive" to render. Multiple Default Skins occur when the Mesh is UV mapped to more than one image file, and each "triangle" in the model's Reference.smd will specify by name which Default Skin is required to texture it. In order to render properly, all the correctly named Default Skins must be found in the game_dir/materials/models directory.

Alternative Skins

If the model has Alternative Skins, the Level Designer may select (skin options) which Skin will be rendered in that particular model. Alternative Skins can be changed at runtime, with the input Skin (this will show up as broken, however it will still work)
  • Alternative skins are also VMT files in the game_dir/materials/models directory. The filenames of the optional skins must be specified in the QC file's $texturegroup configuration in order to be available to the model.
  • An alternative skin can differ from the default skin in many ways, but it cannot change the UV map in the model's Mesh. The alternative skin textures must follow the same layout as the Default Skin.
  • Alternative Skins might be used on a model to represent a dusting of snow, or splatters of mud, etc. to help the model blend in better in certain environments.

LOD Skins

Source's LOD system allows a "cheaper" (simplified) version of a Skin to be rendered at a distance where the loss of "expensive" detail is not noticeable to the Viewer. LOD_Skin.VMTs are usually created from pared-down versions of the Default_Skin.VMT, but their Skinnames are compiled into the main MDL's VVD and VTX files via the QC $lod configuration. The Default Skin is used when no LOD_Skin is active, we could say it amounts to an "lod0" Skin.