Purpose: To export our prop into Source Engine useable files.

Objective: To understand and exercise the principles involved in exporting our prop into Engine.

Exporting Overview

XSI MOD Tool + SOURCE SDK = Custom Prop (in game)

Our prop is broken in to 2 parts

  • Models
  • Textures

In order to compile a Model:

  • We first must make a prop in the MOD Tool
  • We then export our SMD files of our prop from the MOD Tool
  • We then have to make a text document (the .QC file) that contains a bit of code
  • The .QC file goes in to the STUDIOMDL.exe program (part of the SDK)
  • The .QC file then tells STUDIOMDL where all the SMD files are
  • The .QC file also contains the properties of our prop (explosive range, prop damage limit, etc)
  • STUDIOMDL then compiles all of this information and creates a MDL file
  • The MDL is our final Model file – what we need to load our prop into HL2


In order to compile a Texture

  • Create our texture in the XSI MOD Tool
  • Export it as a .TGA
  • Take our TGA into the VTEX.exe program (part of the SDK)
  • VTEX will export a VTF
  • We also will have to create a VMT
  • A VMT is a small amount of code that tells the source engine how to light our object

Definitions

  • SDK = Software Developers Kit
  • SMD = Studio Model Data
  • MDL = Game Ready Model File
  • VTF = Valve Texture Format
  • VMT = Valve Material Texture

Now that understand the workflow involved with getting the 2 parts of our prop compiled and ready for the Source Engine, let’s get started.


Exporting SMD’s

Now we are ready to export our prop.

Create Reference SMD

  • Make sure the prop is selected in Object Select Mode
  • Under the Main Menu, select ValveSource > Export SMD
  • In the dialogue window that opens, create a folder by clicking on the three dots (…) – under the Advanced 3D Design Project – called SMD
  • Name the file TimeBomb and press OK

You will be returned to the original dialogue window

  • Under File, rename TimeBomb to TimeBomb_Ref.smd

Note: the full path under File should read as follows:

C:\Softimage\Softimage_Mod_Tool_7.5\Addons\Advanced 3D Design\SMD\TimeBomb_Ref.smd

  • Under options make sure the File Type is: Model (.SMD)
  • Press OK to export this SMD

Create Physics SMD

  • Select the prop again in Object Select Mode
  • Under the Main Menu, select ValveSource > Export SMD
  • In the dialogue box under File, rename TimeBomb_Ref.smd to TimeBomb_Phys
  • Under options change the File Type to: Physbox (.SMD)
  • Press OK to export this SMD

Create Skeletal Animation SMD

  • Select the prop again in Object Select Mode
  • Under the Main Menu, select ValveSource > Export SMD
  • In the dialogue box under File, rename TimeBomb_Phys.smd to TimeBomb_Idle
  • Under options change the File Type to: Skeletal Animation (.SMD)
  • Press OK to export this SMD
  • Close the MOD Tool program!

Note: If a student was not able to complete his/her prop (for whatever reason) by the end of Module 15 or 16, they can use the sample .smd files included in the Advanced 3D Design Project/SMD_Samples_Files folder and continue along.

WE ARE NOW FINISHED WITH THE XSI MOD TOOL


Launch Steam

If steam is not already running in the bottom right system tray, launch it from the shortcut on your desktop.

  • Browse the C: drive and locate the SMD folder you created under the Softimage directory:

C:\Softimage\Softimage_Mod_Tool_7.5\Addons\Advanced 3D Design\SMD

  • Shrink this window down and keep it open.
  • On your desktop, locate the modelsrc folder shortcut and open it
  • Create a New folder inside modelsrc named Advanced3DDesign
  • Copy the .smd files from the SMD folder you already have opened in to this directory
  • Now from the SMD folder you have open, navigate up one folder and open the Source_SDK_Sample_Files directory (or open the Source_SDK_Sample_Files shortcut from your desktop)
  • In the Source_SDK_Sample_Files folder open the modelsrc folder
  • Here you will find the TimeBomb.qc file
  • Copy the QC file into the modelsrc folder alongside the .smd files.

The .QC File Explained

Note: Reviewing the contents of the QC file is not critical as we wont be making any modifications to it. If the instructor is pressed for time, the following description of its contents can be skipped safely.

The .qc file is really just a text file document that can be opened with notepad.

  • Right click the TimeBomb.qc file and select Open With > Choose “Select the program from a list” > select Notepad > and press OK

The first line of code tells STUDIOMDL.exe where we are going to save our .mdl file (relative to the HL2 Game directory, which we will navigate to soon):

$modelname Advanced3DDesign/TimeBomb.mdl

The next line tells us where the final Valve Textures for our prop will be located in the relative HL2 Game Directory:

$cdmaterials models/Advanced3DDesign

The third line tells us that this is a Static Prop, as most models in HL2 are. Static indicates that by default this prop will not respond to physics or physically interact with our player or the world in game (but more on this later)

$staticprop

The fourth line indicates that the scale will be 1 times the original size of our exported .smd files. 1 times of course means no change in scale. Normally you would not want to change the size of your model this way, but you can.

$scale 1.0

The next three lines reference the exact file names of the .smd files we copied into the modelsrc directory earlier. Make sure the file names exactly match those in the modelsrc directory.

$body studio "TimeBomb_Ref.smd"
$sequence idle "TimeBomb_Idle.smd" fps 15
$collisionmodel "TimeBomb_phys.smd"

The last lines under prop_data explain to STUDIOMDL what our prop will do in game. We are assigning a Wooden.small object property type (which will give our prop wood-like sounds and gibs in game). We are setting the health of our prop to 1 which means if it takes more than 1 point of damage the prop will be “killed.” And finally we are setting the explosion damage and radius if our prop is killed.

"base" "Wooden.Small"
"health" "1"
"dmg.bullets" ".1"
"explosive_damage" "200"
"explosive_radius" "200"


Create the .MDL File

  • Drag the TimeBomb.qc file on to the studiomdl.exe shortcut on your desktop.

This may take a few minutes to compile the model. You will see a DOS window pop up during this time.

Verify the Compile was Successful

  • Open the SDKLauncher.exe from your desktop
  • When the Source SDK window opens, double click on the Model Viewer program.
  • Go to File > Load Model > Advanced3DDesign and double click on the TimeBomb.mdl

If you see the following black and purple model, success!

Note: we have not added a texture yet, so the purple and black is perfectly normal at this stage.


Troubleshooting

If you DO NOT see ANY model, perform the following checks:

  1. Check that the file path/names referenced in the QC file match the .smd file names in the modelsrc directory.

If they do, either there was an issue in exporting the .smd files from the MOD Tool, or there was another unknown problem during the optimizing stage of the prop before the model was exported. In either case, direct the students to copy the sample .smd files located in C:\Softimage\Softimage_Mod_Tool_7.5\Addons\Advanced 3D Design\SMD_Sample_Files directory to the modelsrc directory shortcut on their desktop (overwrite the previous student versions) – and attempt to recompile the MDL file and load it in the Model Viewer again.


Model Viewer 101

Once you have the prop loaded, use the following hotkeys to observe the prop in the Model Viewer.

LMB = rotate and move around

RMB = Zoom

  • Once we are done marveling at our near finished prop, exit the model viewer.

Create the Valve Texture File (VTF)

  • Open the C: drive and locate the TimeBomb.tga rendermap we created earlier:

C:\Softimage\Softimage_Mod_Tool_7.5\Addons\Advanced 3D Design\Render_Pictures

  • Copy the TimeBomb.tga file
  • Open the materialsrc directory shortcut on your desktop and paste the TimeBomb.tga into this folder
  • Drag the TimeBomb.tga on to the VTEX.exe program shortcut on your desktop

If all goes well, at the bottom of the compile window it will say: “Hit a key to continue” (exit the dos window).

Note: This will create a TimeBomb.txt blank text file in the materialsrc directory. This is normal and can be ignored.

  • Open the Materials directory shortcut on your desktop. This is a HL2 game content folder (as opposed to a materialsrc folder – which houses the raw texture format).
  • Sitting in this folder you will see a TimeBomb.vtf file. This is the Valve Texture Format of our compiled .tga file
  • You will also see a models folder inside this materials folder
  • Open this models folder and create a new folder named Advanced3DDesign
  • Open the Advanced3DDesign folder and leave it open. This is where we are going to place our .VMT file in a moment.
  • Close any other browser/explorer windows you may have open

Create the Texture Material File (VMT)

  • Open the Source_SDK_Sample_Files shortcut on your desktop
  • Inside this folder open the materialsrc\Advanced3DDesign folder and copy the Timebomb.vmt file
  • Paste the Timebomb.vmt file into the other folder we left open (materials/models/Advanced3DDesign)

Note: The .vmt file is similar to the .qc file, but simpler and can be opened with a notepad. As we won’t be changing any values in it, we will skip any further explanation on the .vmt.


View Completed Model in Source Engine

  • Launch the SDKLauncher.exe shortcut from your desktop (if the Source SDK window has been closed already)
  • From the Source SDK menu launch the Model Viewer
  • Go to File > Load Model > Advanced3DDesign and double click on the TimeBomb.mdl

If you see the following completely textured model, you are now ready to place your prop in game!!!!

  • Feel free to save your work in the Scenes Directory under Haus of Mapping Curriculum Project Path.

« Module 15 | Module 16 | Module 17 »