Compiling a model: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Forgot to edit one -- but I do believe C:\Program Files\Steam has been the default directory for some time now)
m (Oh, I see what you did.)
Line 13: Line 13:
or
or


<code>C:\Program Files\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc</code>
<code>C:\Program Files\Valve\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc</code>


Where <i>username</i> is your Steam Login name.
Where <i>username</i> is your Steam Login name.

Revision as of 18:33, 28 August 2005


Exporting and Compiling Models

Follow these steps to export a model from XSI and compile it with the Source SDK tools:

1. Export the SMD files somewhere under the SDK's modelsrc directory for the game you're compiling for.

For example, for a Counter-Strike Source model:

C:\Program Files\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc

or

C:\Program Files\Valve\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc

Where username is your Steam Login name.

2. Create a .QC file in the same place as your .SMD files. You can refer to the QC files that are already in the sourcesdk_content\cstrike\modelsrc directory for examples. See QC Commands for a detailed list of commands you can use in .QC files.

3. Make sure you have the proper Current Game selected on the SDK Launcher panel (eg. Counter-Strike: Source).

4. Run studiomdl.exe on your .QC file. To do this, open a Windows command prompt, and type:

      cd "%sourcesdk%"
      bin\studiomdl ..\sourcesdk_content\cstrike\modelsrc\mymodel.qc

Note: This makes use of an environment variable called "sourcesdk" to simplify things. This environment variable is created upon installation of the Source SDK.

5. If there are no errors with the .QC file or your .SMD files, then you will have a .MDL file in the location specified by the $modelname key in the .QC file.

6. You can now run Model Viewer in the SDK launcher and open your model file.

Placing models

You can place a model with the Hammer level editor to see it inside the game.

Note: This copying step will not be required in the full SDK release.

To place a compiled model in Hammer:

1. Open the Hammer Editor from the SDK Launcher.

2. Add a prop entity with the Entity Tool (prop_static, prop_dynamic or prop_physics_multiplayer, depending on your model type). In the Object Properties for the entity, browse the model tree to view and place the model. See the Hammer documentation for information on how to use the Entity Tool.

Sample Models

There are a number of Counter-Strike: Source and Half-Life 2 sample models in the sourcesdk_content directory that you can refer to for examples. They are compiled in the same way as models you create yourself. For example, you can type these commands at a command prompt to compile the lamp holder sample:

cd "%sourcesdk%"
bin\studiomdl ..\sourcesdk_content\cstrike\modelsrc\lamp\it_lampholder1.qc