Porting Goldsource content to Source:ru
Перенос Goldsource моделей на Source движок является коротким процессом. Для достижения наилучших результатов, все файлы должны быть готовы оригинальный 3D-файл пакета, текстуры, и QC. файл. SMD файлы также могут быть полезны, если исходный файл 3d пакет недоступен.
По большей части, перенос моделей прост: установите свойство VPROJECT должным образом, преобразуйте старые текстуры в VTF формат, настройте QC файл, включив новый синтаксис иSource, а затем скомпилируйте содержание в модель Source.
- Main article: Game Directory
The VPROJECT variable is referenced by several Source SDK tools: basically, it directs applications where to find or place compiled models (.MDL) and materials (.VTF). Studiomdl and Vtex both use VPROJECT to place compiled models and materials in the correct directory. Half-Life Model Viewer (HLMV) uses VPROJECT to find model materials. To set the VPROJECT (Current Game), use the Source SDK launcher or VConfig.exe.
Convert old textures to new materials
- See also: Material system
In the Goldsource engine, .BMP textures were compiled into the .MDL file. However in the Source engine, developers export textures as .VTF files, which are simply referenced and not actually compiled into the .MDL file.
Originally, in the preliminary release of the Source SDK, developers were confined to using the included command-line exporter Vtex to compile materials. Since then, a variety of community produced tools provide Windows-friendly GUIs and interfaces, batch conversions, and texture previewing. VTFEdit is highly recommended; though there are also other tools available. This tutorial will assume that the user is using Vtex.
- Main article: Creating a Material
First, convert all old texture files to .TGA format, using Photoshop or a similar image editing application.
- Create a shortcut to vtex.exe on your desktop. Vtex.exe is located in the SourceSDK\bin directory.
- Right-click the shortcut and select the "Properties" option.
- In the "Target" box, add
-mkdir -shader vertexlitgenericafter vtex.exe with a space between them. Click OK.
Use this shortcut when converting new materials by dragging each .TGA file onto the desktop shortcut itself. The argument "-mkdir" will automatically create the materialsrc directory. The argument
-shader VertexLitGeneric tells Vtex to automatically make a new .VMT that points to the .VTF as the diffuse texture.
Export .SMD files
- See also: Model Creation Overview
If the original 3D model file is lost, use an SMD plug-in (e.g. Valve Addon for Softimage|XSI) and import the .smd directly for editing.
Modify .QC file
- Main article: Qc
While old .QC files will work with the new Studiomdl, there have been syntax changes for Source models to compile correctly.
$modelnamenow works in conjunction with VPROJECT and automatically assumes a directory output location of VPROJECT + a 'models' directory. For example:
C:\Program Files\Valve\Steam\SteamApps\SourceMods\MyMod\models. So if
$modelnamewere set to "player\myplayer.mdl", Studiomdl will compile the model and write it to
$cdmaterialsalso uses VPROJECT and assumes the output directory to be VPROJECT + 'materials' directory. For example:
C:\Program Files\Valve\Steam\SteamApps\SourceMods\MyMod\materials. Break the material directory tree up based on context - in this case, a model. Keeping the same example as in the
$modelnamestep above, set
$cdmaterialsto "models\player" so that the model will look for materials in the directory
Create a Collision Model (Physbox)
- See also: Physics and Ragdolls
A "collision model" is the simplified mesh that defines how the model will interact with the world when it is being physically simulated. This document will not cover the details of creating a physbox. While Studiomdl will create a physics hull if one is not specified, the result will be extremely simple. It will not "vacuum seal" the model; it will simply connect all the furthest points of the model together directly. To demonstrate, imagine looking down on a model and that it is shaped like a plus sign.
The most correct collision hull would resemble the plus sign.
The automatically generated collision hull would connect all the most extended parts directly.
In some cases, it is acceptable if the object is insignificant or does not interact with the player or the game world. However, if the example object were a revolving door, then this physbox would be unacceptable.
Compile the Model
- Main article: Compiling Models
The actual process of compiling hasn't changed outside of Studiomdl using VPROJECT. To associate .QC files with Studiomdl for double-click compiling:
- Open a Windows Explorer. (Windows Key + E)
- At the top of the window, click "Tools", then "Folder Options...".
- Click the "File Types" tab then scroll down to QC. If you do not have a QC extension in your list, you can add it by hitting the "New" button below the list, and enter "QC" in the box. Hit "OK" to enter the extension into the list.
- Click the QC extension. It should become highlighted.
- In the "Details for 'QC' extension" area of the "Folder Options" panel, click the "Change..." button to the right of the text "Opens with:".
- Click the "Browse..." button at the bottom right of the "Open With" panel.
- Browse to the file "studiomdl.exe" in the SDK tools. Click the "Open" button.
- Make sure that "studiomdl.exe" is highlighted in the "Open With" panel. Click the "OK" button.
- Close the "Folder Options" panel with the "Close button.
Check the Model with the Half-Life Model Viewer
Find the Half-Life Model Viewer in the "Bin" directory with the rest of the Source SDK tools, and open the model. Some common problems:
- A black and pink checkerboard texture: the materials are not in the location specified by the .QC file or the materials did not compile correctly (you can check that with hammer for example).
- Incorrect collision hull: select the "Render" tab and click the "Physics Model" checkbox to view the model's collision hull.
Hammer 4.1 has backwards compatibility for both .map files and .rmf files.