Source Filmmaker

Source Filmmaker

Not enough ratings
MAYA : Export Assets to Source Engine with MESA
By ☠F☺celessMind☠
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 creations.
Note : This guide will be frequently updated to fit the latest version of Mesa.
Level of detail, Ragdoll and Rigging for dynamic model will be added soon..

MESA Website[puppet-master.net]
Youtube Video tutorial :
MESA Installation
MESA Export tutorial

fuZZ
   
Award
Favorite
Favorited
Unfavorite
Introduction
If you haven't installed Mesa, read the Installation[puppet-master.net] page.

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.

Video tutorial
Preparing the scene
This step includes common tasks like to save your Maya Scene and your textures 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.

  • Starts Maya
  • On the top menu File > Set Project


You must set the path for “%GAME_PROJECT_SRC%” project folder.

This is the directory that includes a file named " workspace.mel " that defines the paths of the scenes, the textures and where the smd files will be exported before the compilation process.


Now Open your scene with your textured models.



Note : 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 “%GAME_PROJECT_SRC%\scenes\props\” for this example, which %GAME_PROJECT_SRC% represents the project workspace directory.
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 a Right click and Assign New Materials



Use a TGA format texture map into the Color Channel .


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

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



Shading notes
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)
Note :
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
Normal Mapping
The normal map must to be added into the bumpMapping channel of the phongE shader.

Important : To be properly exported as VTF file the normal map must to contain a suffix ( ex: "materialname_normal.tga" )
Alpha channel
Warning : It's preferable with source engine to have two separated materials 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 diffuse 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 “Layer Editor" icon (Empty Layer with mesa 1.1)


Just click on the “Ref/phy Layer” Button


From the Maya 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 group 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.

Warning :
If the shape node is not included, the geometry will not be exported correctly in SMD Physic format.

Textures maps

Important :
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
Just do the usuals tasks 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 options 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

Now just display the Paths Tab
Click on GENERATE PATHS 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.

WARNING :

1. You can change the name of the smd, it will affected the name of the final MDL file.
2. The folder “/props/” must to exist into “%GAME_PROJECT%/models/” or you will get an error ( check for write enable )
3. 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.

WARNING :
This path must always be “%GAME_PROJECT_SRC%/materialsrc/“ when you click on “Generate Paths”.

If the path does not ended by “/materialsrc/“, you probably have to Set the Maya Project workspace on the right project workspace ( %MESADIR% /projects/SourceFilmMaker/ for that tutorial).

MESA Environment Variables section
The section show the current paths set as environment variables on your system.
If you edit the environment variables , you must to restart Maya.

Note :
If the “%GAME_PROJECT%” and “%VPROJECT%” are not identical , it can be caused by the Authoring tools launcher that is running in background and overide the %VPROJECT% variable path.
The console Output log
So now that everything is properlly setup.

  • 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"
13 Comments
KWVance 15 May, 2020 @ 7:03am 
10 maya units = 1 hammer unit. Does MESA take this scale difference into account when exporting?
Magic 2 Aug, 2019 @ 5:26pm 
Followed it to a T and its not exporting animations or both the reference model instead of the physics model, it gets stuck at writing VMT files even though i turned that off.
󠀡󠀡Lachie 22 Nov, 2018 @ 5:24am 
Every time I compile with Phone E and the Tga file it still gives me debug/debugempty, is it to do with my multi material setup?
Raph! 21 May, 2018 @ 5:36pm 
It does
koko ze 29 Apr, 2018 @ 11:34am 
If only MESA would support Maya 2018 :/
PeaceLock 5 Aug, 2014 @ 8:23am 
Where is TGA file come from?
Ambiant23 2 Jul, 2014 @ 5:15pm 
I am making a game so I would like to know how to make one as well
☠F☺celessMind☠  [author] 2 Jul, 2014 @ 6:29am 
@RealGames, sure it is, but there is no way to simply the tutorial.
It's easier when you got a base of knowledge around source engine default developement workflow (batch compiling, command line to launch the tools etc..)
Having a good understanding about maya project workspace workflow too, understanding the layers tools in your maya scene, is necessary so you don't get stuck asking yourself about the installation of mesa, and how to organize your files. This is the main obstacle for neophytes.
Ambiant23 1 Jul, 2014 @ 12:34pm 
Dis is hard!!!
☠F☺celessMind☠  [author] 6 May, 2014 @ 4:29pm 
@Razarti , sorry for the very late reply and about your question, there will be no plan to add support for the DMX format, i am now developping on the new Unreal Engine 4, and i don't plan to support MESA anymore, cause of a lack of motivation .

red