Introduction
This tutorial will try to explain how to set your maya scene to brings your creations to life into the Valve Source Engine and by using MESA to export your models.
The workflow is sectioned by steps
Workflow steps in order | |
---|---|
Preparing the scene | It include save your scene and your texture maps into the right location on your hard drive. MESA is case sensitive and if you do not respect the directories system in place the model will not being exported correctly. |
Shading | Diffuse , Normal and alpha texture maps usage and settings. |
Layering | Organize the scene components by layer to guide the exporter to do the job as well. |
Collision model and ragdoll | Simply attach a collision model and set the layer membership. |
Cleaning the scene | Clean up your scene to prevent any confusion. |
Export the assets | Set up the options of the exporter. |
Preparing the scene
- Start Maya
- On the top menu File > Set Project
You must set the “/ModName_source/” folder as project folder. It includes a workspace.mel file that defines the paths of the MESA scripts, the textures and the scenes.
- Open your scene with your textured models.
This step is important because if your scene is not located into the “/scenes/” folder, the export will not being able to properly export the QC Script and SMD files in “/modelsrc/”
- Now “Save as” the scene in the proper location “\Modname_source\scenes\props\” for example.
Shading
- 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,
- Right holded click and Assign New Materials
- Use a TGA format texture map into the Color Channel .
the name of the TGA will become the name of the VMT file, than the SMD Reference file will request.
example : here my vmt file will become “cube.vmt” the generated VTF will also get the same file name( cube.vtf)

Mesa Shelf Icons
- Select your model and display the MESA shelf, and click on the “Add Att” icon (add attributes).
It will add some attributes on the main node of your object in the attribute editor, extra attributes section.
You can change the name of the vtf file if you modify the content of the material file (vmt) and the name of the vtf in the window explorer. do not rename the vmt files, or the model will not get the textures in the model viewer and ingame.
Normal Mapping
Do not use any normal maps texture with the Bump Mapping channel of the Phong E shader.
It as currently broken.
To remove the bump mapping channel, do a right click on the Bump Mapping label and do a Break connection.
Alpha channel
It preferable with source engine to have two separated material when some part of your model require alpha channel to display the transparency.
You must assign a new shader (phongE) to your selection sets separate a models that need alpha channel on a different material.
You get 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 using 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.
Layering
Display the MESA shelf and click on the “Empty Layer” Icon
- Just click on the “Ref/phy Layer” Button
- From the Layer Editor do a right click on the reference layer and choose “Membership“
- On the left column, select Reference layer
- On the right column, select the model node and the model Shape node.
Note : If the shape node is not included, the geometry will not be exported correctly in SMD Reference format.
Collision and Ragdoll model
Create your physic model, and as you did it for the reference model, you have to do a right click on the “Layer Physics” and then click “Membership”.
- on the left column, select the physics layer
- on the right column, select the physics group node and the shape node that contains the geometry.
Select the object model in the view port, and do a right click on the viewport, choose then assign an existent material, to the physic model, and choose the same shader that the reference model already use.
If the shape node is not included, the geometry will not be exported correctly in SMD Physic format.
Textures maps
The physic model require a shader material too or it will not work in game, here i just duplicated my cube and so the same shader is automatically applied.
Cleaning the scene
Do the usual task to clean up your mesh
- Mesh > cleanup… ( 2 vertex polygons )
- freeze transform ( translate, rotate, scale, normals)
- Edit > Delete all by type > History
- Combine ( if you are using several UV Sets)
- Save your scene.
Export the assets
Configure the components to export
Now in that Stage we will see the most important panels to export a functional prop model.
- Open the SMD Options Panel by click on the icon from the shelf.
We will only Export the SMD Reference and the SMD physic model.
- Check all the option as on the screen below.
Description :
Freeze and Reset Transforms : can be usefull is you forget to freeze , but never use this with animated models or the skin cluster will be deleted.
Combine and Smooth the physics models : Combine will combine all the polysurface from the physics layer into one object group ( don’t forget the shape node)
Export 1 frame Idle Smd : will create an animation sequence with one frame, use this for prop models and donot duplicate the name sequence when you set new animations on the animation tab.
Export Animation SMDs : will export all the animation defined on the Animation tab.
Export Texture (Vtex) : will export the VMT (materials) and VTF ( textures map) , the texture map must be a TGA format file.
Generate a new QC script ( refresh it ) : Will write the QC script on the disk. If you modifying the QC manually into a text editor you can uncheck that option.
Compile QC : will compile the QC script when the full compile button is activated, don’t forget to have steam opens.
Setup the paths
- Display the Paths Tab
- Click on Default button and the paths are updated , if the fields are empty the model will not being exported.
SMD /QC path : The default path is the same path than the scene location, but it will pointed on the “/modelsrc/” folder.
- you can change the name of the smd, it will affected the name of the final MDL file.
- The folder “/props/” must to exist into “/modName/models/” or you will get an error ( check for write enable )
- you must to save your scene when the path is changed, or the export will fail.
Materials / Textures Path : the path of the “/materialsrc/” directory where the TGA files are stored.
This path must always be “/modname_source/materialsrc/” do not edit the path is when you clicking on Default button the path is the right one.
if the path does not terminated by “/materialsrc/“, you probably have to Set the current project on “/modname_source/“.
The mod and sdk bin tools paths
The secondary area of the Paths tab show you what are the current environment variables set into the maya.env file.
If the “Source Mod Name“ and “Source VPROJECT is set to” do not reflect the current project set for maya, it probably because source sdk is running in background and the engine version and Current game are different , so set the current game on “ModName” or close the sourcesdk.
The console Output log
So now that everything is all right
- you must to save your scene again “CTRL+S“
- click on the Full Compile button
- open the script Editor to see the Report.
The log :
g:/steam/steamapps/sourcemods/modname G:/Steam/steamapps/SourceMods/ModName_source/ modelsrc/props/ modelsrc/props/ ---------------------------------------------- Writing SMD file ---------------------------------------------- exporting to G:/Steam/steamapps/SourceMods/ModName_source/modelsrc/props/cube_idle.smd Extracting animation data frames 0 to 1 ---------------------------------------------- Writing SMD file ---------------------------------------------- exporting to G:/Steam/steamapps/SourceMods/ModName_source/modelsrc/props/cube_phy.smd pCubeShape2 getting triangles from pCubeShape2 ---------------------------------------------- Writing .VMT files ---------------------------------------------- writing :phongE1SG exporting shader phongE1 exported g:/steam/steamapps/sourcemods/modname/materials/models/props/cube.vmt OK TO WRITE vtf export for G:/Steam/steamapps/SourceMods/ModName_source/materialsrc/models/props/cube.txt base texture map vtf creation normal map vtf creation ---------------------------------------------- Writing SMD file ---------------------------------------------- exporting to G:/Steam/steamapps/SourceMods/ModName_source/modelsrc/props/cube.smd pCubeShape1 getting triangles from pCubeShape1 ---------------------------------------------- Writing .VMT files ---------------------------------------------- writing :phongE1SG exporting shader phongE1 exported g:/steam/steamapps/sourcemods/modname/materials/models/props/cube.vmt OK TO WRITE vtf export for G:/Steam/steamapps/SourceMods/ModName_source/materialsrc/models/props/cube.txt base texture map vtf creation normal map vtf creation qdir: "g:\steam\steamapps\sourcemods\modname_source\modelsrc\props\" gamedir: "g:\steam\steamapps\SourceMods\modname\" g_path: "G:/Steam/steamapps/SourceMods/ModName_source/modelsrc/props/cube.qc" Building binary model files... Working on "cube.qc" SMD MODEL cube.smd SMD MODEL cube_idle.smd SMD MODEL cube_phy.smd Model has 1 convex sub-parts Collision model completed. --------------------- writing g:\steam\steamapps\SourceMods\modname\models/props/cube.mdl: bones 964 bytes (1) animations 112 bytes (1 anims) (1 frames) [0:01] sequences 220 bytes (1 seq) ik/pose 164 bytes eyeballs 0 bytes (0 eyeballs) flexes 0 bytes (0 flexes) textures 72 bytes keyvalues 0 bytes bone transforms 0 bytes Collision model volume 64000.00 in^3 collision 0 bytes total 1704 --------------------- writing g:\steam\steamapps\SourceMods\modname\models/props/cube.vvd: vertices 4608 bytes (96 vertices) tangents 1536 bytes (96 vertices) total 6208 bytes --------------------- Generating optimized mesh "g:\steam\steamapps\SourceMods\modname\models/props/cube.sw.vtx": body parts: 8 bytes models: 20 bytes model LODs: 12 bytes meshes: 9 bytes strip groups: 25 bytes strips: 27 bytes verts: 864 bytes indices: 264 bytes bone changes: 16 bytes everything: 1269 bytes --------------------- Generating optimized mesh "g:\steam\steamapps\SourceMods\modname\models/props/cube.dx80.vtx": body parts: 8 bytes models: 20 bytes model LODs: 12 bytes meshes: 9 bytes strip groups: 25 bytes strips: 27 bytes verts: 864 bytes indices: 264 bytes bone changes: 16 bytes everything: 1269 bytes --------------------- Generating optimized mesh "g:\steam\steamapps\SourceMods\modname\models/props/cube.dx90.vtx": body parts: 8 bytes models: 20 bytes model LODs: 12 bytes meshes: 9 bytes strip groups: 25 bytes strips: 27 bytes verts: 864 bytes indices: 264 bytes bone changes: 16 bytes everything: 1269 bytes Completed "cube.qc"