Портирование контента из Goldsource в Source

From Valve Developer Community
Jump to navigation Jump to search
English (en)日本語 (ja)Русский (ru)Translate (Translate)
Info content.png
This page needs to be translated.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article tries to comply with the alternate languages guide.

Перенос Goldsource(en) моделей на Source движок является коротким процессом. Для достижения наилучших результатов, все файлы должны быть готовы оригинальный 3D-файл пакета, текстуры, и QC.(en) файл. SMD(en) файлы также могут быть полезны, если исходный файл 3d пакет недоступен.

По большей части, перенос моделей прост: установите свойство VPROJECT(en) должным образом, преобразуйте старые текстуры в VTF(en) формат, настройте QC файл, включив новый синтаксис иSource, а затем скомпилируйте содержание в модель Source.

Set VPROJECT

Основная статья:  Game Directory

The VPROJECT variable is referenced by several Source SDK(en) tools: basically, it directs applications where to find or place compiled models (.MDL) and materials (.VTF). Studiomdl(en) and Vtex(en) both use VPROJECT to place compiled models and materials in the correct directory. Half-Life Model Viewer(en) (HLMV) uses VPROJECT to find model materials. To set the VPROJECT (Current Game), use the Source SDK launcher(en) or VConfig.exe.

Convert old textures to new materials

См. также:  Material system(en)

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(en) to compile materials. Since then, a variety of community produced tools provide Windows-friendly GUIs and interfaces, batch conversions, and texture previewing. VTFEdit(en) is highly recommended; though there are also other tools available. This tutorial will assume that the user is using Vtex.

Основная статья:  Creating a Material

First, convert all old texture files to .TGA format, using Photoshop or a similar image editing application.

  1. Create a shortcut to vtex.exe on your desktop. Vtex.exe is located in the SourceSDK\bin directory.
  2. Right-click the shortcut and select the "Properties" option.
  3. In the "Target" box, add -mkdir -shader vertexlitgeneric after 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.

Note.pngПримечание:The VertexLitGeneric shader is only used for models; it should not be used for sprites or brushes. Check the Materials(en) documentation for more info.

Export .SMD files

См. также:  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

Основная статья:  Qc

While old .QC files will work with the new Studiomdl, there have been syntax changes for Source models to compile correctly.

  • $modelname now 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 $modelname were set to "player\myplayer.mdl", Studiomdl will compile the model and write it to C:\Program Files\Valve\Steam\SteamApps\SourceMods\MyMod\models\player\myplayer.mdl.
  • Replace $cdtexture with $cdmaterials. $cdmaterials also 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 $modelname step above, set $cdmaterials to "models\player" so that the model will look for materials in the directory C:\Program Files\Valve\Steam\SteamApps\SourceMods\MyMod\materials\models\player.

Create a Collision Model (Physbox)

См. также:  Physics and Ragdolls(en)

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.

Phys demo2.jpg

The automatically generated collision hull would connect all the most extended parts directly.

Phys demo3.jpg

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

Основная статья:  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:

  1. Open a Windows Explorer. (Windows Key + E)
  2. At the top of the window, click "Tools", then "Folder Options...".
  3. 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.
  4. Click the QC extension. It should become highlighted.
  5. In the "Details for 'QC' extension" area of the "Folder Options" panel, click the "Change..." button to the right of the text "Opens with:".
  6. Click the "Browse..." button at the bottom right of the "Open With" panel.
  7. Browse to the file "studiomdl.exe" in the SDK tools. Click the "Open" button.
  8. Make sure that "studiomdl.exe" is highlighted in the "Open With" panel. Click the "OK" button.
  9. Close the "Folder Options" panel with the "Close button.

Check the Model with the Half-Life Model Viewer

Find the Half-Life Model Viewer(en) 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.

Портирование моделей через kHED

Icon-Bug.pngБаг:В настоящее время kHED не поддерживает анимацию, поэтому все анимации будут утеряны.  [todo tested in?]

Альтернативный способ портировать старые модели в Source - использовать kHED(en).

  1. Для начала необходимо получить текстуры модели. Это можно сделать двумя способами:
    1. Откройте модель в Jed's Half-life Model Viewer(en)
      1. перейдите на вкладку "textures"
      2. Выберите нужную текстуру и экспортируйте её при помощи функции "Export texture".
    2. Вы также можете получить текстуры, декомпилировав модель.
  2. Откройте kHED и перейдите в File > Import > Half-life Model (.mdl)
  3. В открывшемся окне найдите свою модель и нажмите Открыть.
  4. теперь перейдите в File > Export и выберите подходящий формат для экспорта (Поддерживаемые для жкспорта форматы: .obj, .3ds, .ms3d(en), Half-life .smd(en) и Half-life .mdl(en).
  5. Теперь просто откройте экспортированный файл в 3d-редакторе(en), текстурируйте и экспортируйте в Source.

Портирование карты GoldSRC в Source

Основная статья:  Porting GoldSRC maps to Source

Hammer(en) поддерживает такие форматы файлов, как .rmf(en) и .map(en), поэтому вам нужно лишь декомпилировать(en) карту GolSRC или использовать исходный файл, если он есть. Однако, при использовании этого способа вам придётся вручную исправлять текстуры и сущности на уровне, но это можно сделать автоматически, использовав MapFool(en).

См. также

Портирование GoldSRC контента (карт, моделей и т.д.) в Source Engine(en)