Shading

This step resumes how to set and use the texture maps (Diffuse , Normal and alpha ) .

If your model already got a shader assigned, you must be sure that all shaders used on your model are Phong E shader type. Select the object or the polygons Hold on the Right click and Assign New Materials.




Use a TGA format texture map into the Color Channel .

The Color texture maps is a TGA file.


The name of the TGA will become the name of the Materials file ( VMT ), than the SMD Reference file will request. example : here my vmt file will become “cube_diffuse.vmt” the generated VTF will also get the same file name( cube_diffuse.vtf)

If your diffuse texture map is named cube.tga, Vtex will compile the texture and name it respectively “cube.vtf” and “cube.vmt”.
Some improvements at that level will be achieved with the next version of MESA ( after 2.0.1 ) –red

Select your model and display the MESA shelf, and click on the VMT Attributes icon (add attributes).

Add VMT Attributes

This operation will add some attributes on the main node of your object in the attribute editor, into extra attributes section.




Normal Mapping

The normal map must to be added into the Bump Mapping channel of the phongE shader.

To be properly exported as VTF file, the normal map must to contain a suffix ( ex: “materialname_normal.tga” ).




Alpha channel

Best practices in Source engine concerning the use of alpha channel, consist to create a separated materials, that only contains the polygons that must to receive the transparency.
For instance on character model, you would create one material for the main body/cloths/head, and create a second material onto the one you will put the teeth or hair that must to receive this transparency.

You have two choices :

  • Use the alpha channel of the color texture map.
  • Use a Mask texture in the transparency channel.

Don’t forget to check the extra attributes if you are using the transparency.

VertexLitGeneric : the type of shader that source engine handle to display the models materials.
nocull : the polygons will be displayed as Double Sided polygons.
alphatest : will activate the alpha channel of your color texture map, and set the $alphatest command to 1 in the VMT file.
nonice :
nomip : no mipmaps texture when VTEX convert the TGA into the VTF format.