Difference between revisions of "Compiling a model:ru"

From Valve Developer Community
Jump to: navigation, search
(Stub for russian translation)
 
(QC file)
Line 7: Line 7:
 
{{tip|Слово "studio" в названии отсылает нас к временам создания [[Half-Life 1]], когда для создания моделей Valve использовала пакет [[3D Studio Max]].}}
 
{{tip|Слово "studio" в названии отсылает нас к временам создания [[Half-Life 1]], когда для создания моделей Valve использовала пакет [[3D Studio Max]].}}
  
== QC file ==
+
== Формат QC ==
  
As well as SMD data files, you will need a [[Qc|QC]] file that defines in a manner not too dissimilar to a texture's [[VMT]] how the raw SMD data should be interpreted. This is where you will spend the majority of your time when setting up a compile.
+
Помимо файла в формате SMD с данными о модели, вам понадобится файл формата [[Qc|QC]], который - в чем-то похоже на файл материала [[VMT]] - описывает как нужно интерпретировать данные из SMD-файла. При подготовке к компиляции вы потратите большую часть времени именно на него.
  
A QC file is simply a text file with the <code>.qc</code> extension. You can create it anywhere and name it anything, but it's best to be organised and store it with your SMDs in a folder with the same name as the destination model file.
+
QC - это просто текстовый файл с расширением <code>.qc</code>. Его можно создать где угодно и назвать как вам нравится. Лучше, однако, хранить свои данные организованно, и держать SMD и QC в одной папке, которую разумно будет назвать так же, как будущий файл модели.
  
 
== Compile environment ==
 
== Compile environment ==

Revision as of 11:00, 21 September 2008

Другая вариация на тему, делалась на основе Compiling Model Basics: Compiling_Models:ru. Содержание, в общем и целом, не совпадает. Эта же статья пока не переведена


В статье описано, как компилировать модели с помощью studiomdl для внутриигрового использования. Прежде чем начать, вам понадобятся какие-нибудь файлы SMD, которые вы и будете компилировать. Если у вас их еще нет, прочтите статью об Экспорте моделей.

Tip:Слово "studio" в названии отсылает нас к временам создания Half-Life 1, когда для создания моделей Valve использовала пакет 3D Studio Max.

Формат QC

Помимо файла в формате SMD с данными о модели, вам понадобится файл формата QC, который - в чем-то похоже на файл материала VMT - описывает как нужно интерпретировать данные из SMD-файла. При подготовке к компиляции вы потратите большую часть времени именно на него.

QC - это просто текстовый файл с расширением .qc. Его можно создать где угодно и назвать как вам нравится. Лучше, однако, хранить свои данные организованно, и держать SMD и QC в одной папке, которую разумно будет назвать так же, как будущий файл модели.

Compile environment

The most important step in setting your computer up for a compile is choosing the correct VPROJECT variable. You can do this:

  1. Globally, by selecting your game/mod in the SDK launcher's drop-down list
  2. For studiomdl only, by running it with -game "<full path to your gameinfo.txt folder>"

When it comes to editing your QC, you really, really want to use an advanced text editor which supports syntax highlighting and which can run studiomdl without any command line or batch file fiddling. There are two editors with such support at the moment:

Once you've downloaded the editor and highlighting rules and set up the execution command, you're all set!

The hard way

If you don't want to or can't use either of the above text editors, you will be compiling QCs by dragging them onto studiomdl.exe. You can find it in sourcesdk/bin/orangebox/bin/ (replace orangebox/ with ep1/ if required).

You will find this process easier if you create a .cmd file somewhere more accessible to automate the process. This is simply a renamed .txt file containing something like this:

"%sourcesdk%/bin/orangebox/bin/studiomdl" %1
pause

Drop your QC file on to it as you would with the executable itself - it's essentially a shortcut.

QC commands

For a list of all documented QC commands, see Category:QC Commands.

Here is a QC file for a non-animated, static prop:

$modelname	"props_sdk/myfirstmodel.mdl"
$body mybody	"myfirstmodel-ref.smd"
$staticprop
$surfaceprop	combine_metal
$cdmaterials	"models/props_sdk"

$sequence idle	"myfirstmodel-idle.smd" loop fps 15

$collisionmodel	"myfirstmodel-phys.smd" { $concave }
Tip:The default location for SMDs is the same folder as the QC file. You can specify relative or absolute paths with any command if something is stored in a different folder.

Here is a brief summary of what each of those commands does. For more detail, click on the names.

$modelname
Defines the name and location of the model's core output file relative to <mod folder>/models/. Several other files will be created as well, with variations of this value as their name.
$body
Defines the SMD that contains the vertex, UV map, skeleton and envelope data for the model. Without this, your model will have no physical appearance.
A name ('mybody') is given because it is possible for a model to have several bodies - like the metrocop, who has one with a manhack attached and one without.
Tip:More complex models use $model instead of $body.
$staticprop
Tells studiomdl that the model has no moving parts, allowing it to perform several important optimisations. It is required if the model is to be used with prop_static, but does not prevent it from being used elsewhere! (Indeed, most models that are to be physically-simulated use the command as well.)
$surfaceprop
How the object's surface reacts to other entities in the world. Also helps define the weight of the object, if the QC command to calculate it is used.
Note:An identical command is used in materials. Should they clash on a model, the QC version is chosen. It isn't clear why this functionality is duplicated.
$cdmaterials
The folder to load the model's material(s) from. Remember that the materials must be the same name as the ones you applied in your modelling package. The value is relative to <mod folder>/materials/.
$sequence
Even though this model is $staticprop and therefore not animated, Source needs an empty 'idle' animation to correctly handle it. If the animation is truly idle it will only have one frame, rendering the fps property meaningless (but it's included anyway in demonstration).
$collisionmodel
Defines the SMD that will be used to calculate physics collisions by the engine. Without a collision model, physical objects will simply fly through the model (which in some cases may be what you want).
Tip:If your collision model needs to be animated, use $collisionjoints instead.
$concave
A collision model must be convex, but you can create concave shapes by combining more than one of them into the same model. This command tells studiomdl that this is what you intend - without it, all of your collision SMD's meshes will instead be merged into one shape that wraps them all around.

You will be able to use this sample to compile your own model (minus any animations), so swap in your own SMDs and see what happens.

Compiling more advanced models

Samples

Valve provide numerous sample models in the SDK for you to learn from, including several fully-articulated characters and players. They can be found at:

  • sourcesdk_content\cstrike\modelsrc
  • sourcesdk_content\hl2\modelsrc
  • sourcesdk_content\hl2mp\modelsrc
  • sourcesdk_content\generic\modelsrc (a walking animation for Valve's default skeleton)

Common errors

See also

Template:Otherlang:ru Template:Otherlang:ru:en