Compiling a model: Difference between revisions
mNo edit summary |
(cleaned up formatting, links) |
||
Line 1: | Line 1: | ||
[[Category:Modeling]] | [[Category:Modeling]]__NOTOC__ | ||
This article explains how to use the Source SDK tool <code>[[Studiomdl|studiomdl.exe]]</code>, located in the <code>sourcesdk/bin</code> directory. Studiomdl is used to compile source [[SMD|.SMD]] files exported from a [[:category:Modeling|modeling]] package, combined with a [[Qc|.QC]] script file, into a [[MDL|.MDL]] file that can be used by the engine. | |||
== Exporting and Compiling Models == | |||
For example, for a Counter-Strike Source model: | Follow these steps to export a model from [[XSI]] and compile it with the Source SDK tools: | ||
# Export the .SMD files somewhere under the SDK's <code>modelsrc</code> directory for the game you're compiling for. | |||
#: For example, for a Counter-Strike Source model: | |||
#: <code>C:\Program Files\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc</code> | |||
#: or | |||
#: <code>C:\Program Files\Valve\Steam\SteamApps\username\sourcesdk_content\cstrike\modelsrc</code> | |||
#: Where <i>username</i> is your Steam Login name. | |||
# Create a [[Qc|.QC]] file in the same place as your .SMD files. You can refer to the QC files that are already in the <code>sourcesdk_content\cstrike\modelsrc</code> directory for examples. | |||
# Make sure you have the proper '''Current Game''' selected on the '''SDK Launcher''' panel (eg. Counter-Strike: Source). | |||
# Run <code>studiomdl.exe</code> on your .QC file. To do this, open a Windows command prompt, and type: | |||
#: <code>cd "%sourcesdk%"</code> | |||
#: <code>bin\studiomdl ..\sourcesdk_content\cstrike\modelsrc\mymodel.qc</code> | |||
#: <br> | |||
#: {{note|This makes use of an environment variable called "sourcesdk" to simplify things. This environment variable is created upon installation of the Source SDK.}} | |||
# 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 <code>$modelname</code> key in the .QC file. | |||
# You can now run '''[[Half-Life Model Viewer|Model Viewer]]''' in the '''SDK launcher''' and open your model file. | |||
== Placing models == | |||
=Placing models= | |||
You can place a model with the Hammer level editor to see it inside the game. | You can place a model with the Hammer level editor to see it inside the game. | ||
To place a compiled model in Hammer: | To place a compiled model in Hammer: | ||
#Open the Hammer Editor from the SDK Launcher. | # Open the [[Hammer|Hammer Editor]] from the SDK Launcher. | ||
#Add a prop entity with the Entity Tool (<code>prop_static</code>, <code>prop_dynamic</code> or <code>prop_physics_multiplayer</code>, 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]]'''. | # Add a prop entity with the Entity Tool (<code>prop_static</code>, <code>prop_dynamic</code> or <code>prop_physics_multiplayer</code>, 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== | == Sample Models == | ||
There are a number of Counter-Strike: Source and Half-Life 2 sample models in the <code>sourcesdk_content</code> 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: | There are a number of Counter-Strike: Source and Half-Life 2 sample models in the <code>sourcesdk_content</code> 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%" | |||
cd "%sourcesdk%" | bin\studiomdl ..\sourcesdk_content\cstrike\modelsrc\lamp\it_lampholder1.qc | ||
bin\studiomdl ..\sourcesdk_content\cstrike\modelsrc\lamp\it_lampholder1.qc | |||
== See also == | |||
* [[Qc|.QC File Basics]] | |||
* [[Studiocompiler]] | |||
* [[GUIStudioMDL]] |
Revision as of 17:35, 24 March 2006
This article explains how to use the Source SDK tool studiomdl.exe
, located in the sourcesdk/bin
directory. Studiomdl is used to compile source .SMD files exported from a modeling package, combined with a .QC script file, into a .MDL file that can be used by the engine.
Exporting and Compiling Models
Follow these steps to export a model from XSI and compile it with the Source SDK tools:
- 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.
- 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. - Make sure you have the proper Current Game selected on the SDK Launcher panel (eg. Counter-Strike: Source).
- 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.
- 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. - 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.
To place a compiled model in Hammer:
- Open the Hammer Editor from the SDK Launcher.
- Add a prop entity with the Entity Tool (
prop_static
,prop_dynamic
orprop_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