Difference between revisions of "VRAD:ru"

From Valve Developer Community
Jump to: navigation, search
(Undo revision 215423 by LoKkdoKk (talk))
(Undo revision 215420 by LoKkdoKk (talk))
Line 1: Line 1:
 +
{{otherlang2
 +
|title=VRAD
 +
|zh-cn = Vrad:zh-cn
 +
|en = VRAD}}
 +
{{toc-right}}
  
 +
{{finishtranslation:ru}}
 +
 +
'''VRAD''' - это [[command-line|инструмент командной строки]], который берет скомпилированную BSP карту и встраивает в неё данные освещения. Он генерирует статическое и прекомпилированное освещение используя алгоритм [[Wikipedia:Radiosity (3D computer graphics)|radiosity]].
 +
 +
Что делает VRAD:
 +
 +
* Сгенерирует [[lightmap|карты освещения]]
 +
* Сгенерирует [[Ambient light|окружающее освещение]]
 +
* Сгенерирует по-объектное или по-вершинное [[prop_static]] и [[detail prop]] освещение
 +
 +
VRAD это, скорее всего, самый медленный из трех компиляторов, так как он производит огромное количество вычислений. [[Lighting optimization|Оптимизация освещения]] может помочь также как и проверка карты на отсутствие [[leak:ru|утечек]].
 +
 +
{{tip:ru|Если ваше окно компиляции выглядит так будто оно зависло на ''<code>9...</code>'', скорее всего это произошло из-за того, что с каждым отражением света, расчеты VRAD занимают больше времени.}}
 +
{{warning:ru|VRAD будет использовать большую часть процессорного времени в попытках просчитать свет.}}
 +
{{bug:ru|Пользователям Ep1 и L4D испытывающим вылеты VRAD, когда он компилирует HDR, следует прочитать [[VRAD HDR Crash Fix]].}}
 +
 +
{{bug:ru|В ветке не-L4D игр, <code>.mdl</code> файлы не имеют с собой <code>.dx80.vtx</code> файлов, что приведет к тому, что VRAD будет пропускать расчет освещения для этих пропов. Копирование <code>.dx90.vtx</code> файла и переименование его в <code>.dx80.vtx</code> решит проблему. }}
 +
{{bug:ru|Additionally, <code>.mdl</code> files that have the <code>IDST1</code> header will fail to load for [[VBSP]], and will give a error message stating the prop failed to load; this can be fixed by changing the header to <code>IDST0</code> in a Hex Editor, or by recompiling the prop in a non-L4D branch [[Studiomdl]] application such as Source 2013.}}
 +
{{bug:ru|As of around 5-10 years ago up until at least October, 2017 all known copies of VRAD have a thread sharing bug which causes performance to scale poorly to multiple threads, particularly on outdoor scenes with -final set (despite showing 100% CPU usage). The fix to this bug for Source 2013 is available [https://github.com/ValveSoftware/source-sdk-2013/pull/436 here] and edited DLLs are available [http://www.content.tophattwaffle.com/Content/modded_vrad_dll.zip here]. Valve also released a patch for CSGO's VRAD that fixes this issue.}}
 +
 +
== Синтаксис ==
 +
 +
vrad [options...] <bsp file>
 +
 +
Например:
 +
 +
"Half-Life 2\bin\vrad.exe" -both -StaticPropLighting sdk_trainstation_01
 +
 +
Это сгенерирует и встроит стандартное и [[HDR]] освещение для каждого вертекса статичных пропов.
 +
 +
== Параметры ==
 +
 +
Используйте их в комбинации с [[expert compile mode]] или пакетным файлом.
 +
 +
=== Эффекты ===
 +
 +
{{ColumnBox|count=2|
 +
; <code>-ldr</code>
 +
; <code>-hdr</code>
 +
; <code>-both</code>
 +
: Whether to compile standard or [[HDR|High Dynamic Range]] lighting, or both.
 +
: {{note|In {{insurgency}}{{csgo}}, you need to compile with -hdr in order have proper lighting since LDR isn't supported.}}
 +
;<code>-fast</code>
 +
: Quick and dirty lighting. Don't ship with this.
 +
;<code>-final</code>
 +
: Increases the quality of [[light_environment]] and indirect lighting by spending more time firing rays.
 +
;<code>-extrasky <[[int]]></code>
 +
: Trace N times as many rays for indirect light and sky ambient. {{clr}}(-final is equivalent to -extrasky 16; normal is equivalent to -extrasky 1)
 +
;<code>-lights <filename>.rad</code>
 +
:Load a custom [[#Lights_files|lights file]] in addition to <code>lights.rad</code> and map-specific lights file. Include the file extension in the parameter.
 +
;<code>-bounce <[[int]]></code>
 +
: Set the maximum number of light ray bounces (default: 100).
 +
;<code>-smooth <[[int]]></code>
 +
:Set the threshold for [[smoothing group]]s, in degrees (default: 45).
 +
;<code>-luxeldensity <[[normal]]></code>
 +
:Scale down all luxels. Default (and maximum) value is 1.
 +
;<code>-softsun <[[float]]></code>
 +
:Treat the sun as an area light source of this many degrees. Produces soft shadows. Recommended values are 0-5, default is 0. Identical to the SunSpreadAngle parameter in [[light_environment]].
 +
;<code>-StaticPropLighting</code>
 +
:Generate per-vertex [[prop_static]] lighting; always enabled for [[light_spot]] entities. Disables [[info_lighting]] entities on props WITHOUT normal maps. Does not work on props with Phong Enabled, except in {{csgo}}.
 +
{{note|In {{csgo}}, in order to get proper lighting on your static props, you will need to run VRAD with this command.}}
 +
;{{EP2 add|<code>-StaticPropPolys</code>}}
 +
:Perform shadow tests of <code>prop_static</code>s at polygon precision. Default is to use [[collision mesh]]es.
 +
;{{EP2 add|<code>-TextureShadows</code>}}
 +
:Generates lightmap shadows from [[$translucent]] surfaces of models (NOT brushes) that are specified in a [[#Lights_files|lights file]] and being used with [[prop_static]]. Usually requires <code>-StaticPropPolys</code> to have any effect.
 +
:{{note|A surface will need a low [[lightmap]] scale for most texture shadows to be recognisable.}}
 +
;{{CSGO add|<code>-aoscale <[[float]]></code>}}
 +
:Scales the intensity of VRAD's simulated ambient occlusion. 1.0 is default.
 +
:{{Tip|Valve uses 1.5 for the new Dust 2.}}
 +
;{{CSGO add|<code>-StaticPropBounce <[[int]]></code>}}
 +
:Number of static prop light bounces to simulate. The default is 0.
 +
:{{Tip|Valve uses 3 static prop bounces for the new Dust 2.}}
 +
:{{Note|Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.}}
 +
}}
 +
 +
=== Производительность ===
 +
 +
{{ColumnBox|count=2|
 +
;<code>-low</code>
 +
:Run as a low-priority process.
 +
;<code>-threads <[[int]]></code>
 +
:Override the number of CPU threads used. Maximum is 16 threads. With a [[Increased_Thread_Limit_for_Compile_Tools|patched vrad_dll]] you can use 32 threads.
 +
;<code>-mpi</code>
 +
:Use [[Vmpi|VMPI]] to distribute computations.
 +
;<code>-mpi_pw <[[string]]></code>
 +
:Use a password to choose a specific set of VMPI workers.
 +
;<code>-noextra</code>
 +
:Disable supersampling.
 +
;<code>-chop <int></code>
 +
:Smallest number of [[luxel]] widths for a bounce patch, used on edges.
 +
;<code>-maxchop <int></code>
 +
:Coarsest allowed number of luxel widths for a patch, used in face interiors.
 +
;<code>-LargeDispSampleRadius</code>
 +
:This can be used if there are splotches of bounced light on terrain. The compile will take longer, but it will gather light across a wider area.
 +
;<code>-compressconstant <int></code>
 +
:Compress [[lightmap]]s whose color variation is less than this many units.
 +
;<code>-fastambient <int></code>
 +
:{{Todo|What is this?}}
 +
;{{CSGO add|<code>-StaticPropSampleScale x</code>}}
 +
:Regulates the generated per-vertex prop_static lighting.
 +
:slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
 +
:{{note|-final is the equivalent of having -StaticPropLightingScale 16.}}
 +
}}
 +
 +
=== Отладка ===
 +
 +
{{ColumnBox|count=2|
 +
;<code>-rederrors</code>
 +
:Emit red light when "a luxel has no samples".
 +
;<code>-vproject <directory></code>
 +
;<code>-game <directory></code>
 +
:Override the VPROJECT environment variable.
 +
;<code>-insert_search_path <directory></code>
 +
:{{Todo|What does this do?}}
 +
;<code>-v</code>
 +
;<code>-verbose</code>
 +
: Turn on verbose output.
 +
;<code>-novconfig</code>
 +
:Don't bring up graphical UI on vproject errors.
 +
;<code>-dump</code>
 +
:Dump patches to debug files.
 +
;<code>-dumpnormals</code>
 +
:Write normals to debug .txt files.
 +
;<code>-debugextra</code>
 +
:Places debugging data in lightmaps to visualize supersampling.
 +
;<code>-dlightmap</code>
 +
:Force direct lighting into different lightmap than radiosity.
 +
;<code>-stoponexit</code>
 +
:Wait for a keypress on exit.
 +
;<code>-nodetaillight</code>
 +
:Don't light detail props.
 +
;<code>-centersamples</code>
 +
:Move sample centers.
 +
;<code>-loghash</code>
 +
:Log the sample hash table to samplehash.txt.
 +
;<code>-onlydetail</code>
 +
:Only light detail props and per-leaf lighting.
 +
;<code>-maxdispsamplesize #</code>
 +
:Set max displacement sample size (default: 512).
 +
;<code>-FullMinidump</code>
 +
:Write large minidumps on crash.
 +
;<code>-OnlyStaticProps</code>
 +
:Only perform direct static prop lighting.
 +
;<code>-StaticPropNormals</code>
 +
:When lighting static props, just show their normal vector.
 +
;<code>-noskyboxrecurse</code>
 +
:Turn off recursion into 3d skybox (skybox shadows on world).
 +
;<code>-nossprops</code>
 +
:Globally disable self-shadowing on static props.
 +
;{{2013 add|<code>-dumppropmaps</code>}}
 +
:Dump computed prop lightmaps.
 +
 +
}}
 +
 +
== Файлы освещения ==
 +
 +
A light file is a plain text file that can be used to manipulate the way [[Vrad|VRAD]] handles given [[material]]s when compiling static lighting. All lights files must have the .rad file extension and must be in the same folder as your [[gameinfo.txt]].
 +
 +
There are:
 +
 +
#'''<code>lights.rad</code>''', the global file.
 +
#'''An auto-loaded map light file''', using the format <code><map name>.rad</code>. The file must be placed in the same folder as <code><map name>.vmf</code>.
 +
#'''Any number of additional lights files''' that can be added with [[#Effects|the <code>-lights</code> parameter]].
 +
 +
=== Правила ===
 +
 +
Lights files perform these functions, one rule per line:
 +
 +
;<code><material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity></code>
 +
:Makes the material emit the given light value when applied to a [[brush]] face (<code>hdr_</code> values are optional). Texture scale has an effect on final intensity. {{note|materials that aren't in a folder must have a slash before their name.}}
 +
{{note|The material itself doesn't emit anything, it instead creates light entities on its face.}}
 +
{{warning|A [[func_detail]] with an emissive material applied on any face will automatically cause VRAD to fail!}}
 +
;<code>noshadow <material name></code>
 +
:Prevents the named material from casting shadows.
 +
;<code>forcetextureshadow <model path>.mdl</code>
 +
:Enables translucency shadow testing for a model when VRAD is run with <code>[[#Effects|-TextureShadows]]</code>. Path is relative to the models folder.
 +
;<code><nowiki>ldr:</nowiki></code>
 +
;<code><nowiki>hdr:</nowiki></code>
 +
:Prefixes to make any rule only apply to LDR or HDR lighting.
 +
;<code><nowiki>hdr:ldr:</nowiki></code>
 +
:Lines beginning with both tags (in that order) will always be ignored by VRAD. Can be used to add comments or quickly disable some entries.
 +
 +
== См. также ==
 +
* [[Map Compiling Theory:ru|Теория компиляции карт]]
 +
* [[HDR Lighting Basics]]
 +
* [[VRAD HDR Crash Fix]]
 +
* [[Static Props show up black]]
 +
 +
{{SDKTools:ru}}
 +
 +
[[Category:Level Design:ru]]
 +
[[Category:Glossary:ru]]
 +
[[Category:Russian]]

Revision as of 08:23, 18 July 2018

English 简体中文


VRAD - это инструмент командной строки, который берет скомпилированную BSP карту и встраивает в неё данные освещения. Он генерирует статическое и прекомпилированное освещение используя алгоритм radiosity.

Что делает VRAD:

VRAD это, скорее всего, самый медленный из трех компиляторов, так как он производит огромное количество вычислений. Оптимизация освещения может помочь также как и проверка карты на отсутствие утечек.

Tip.png Совет: Если ваше окно компиляции выглядит так будто оно зависло на 9..., скорее всего это произошло из-за того, что с каждым отражением света, расчеты VRAD занимают больше времени.
Warning.png Предупреждение: VRAD будет использовать большую часть процессорного времени в попытках просчитать свет.
Bug.png Ошибка: Пользователям Ep1 и L4D испытывающим вылеты VRAD, когда он компилирует HDR, следует прочитать VRAD HDR Crash Fix.
Bug.png Ошибка: В ветке не-L4D игр, .mdl файлы не имеют с собой .dx80.vtx файлов, что приведет к тому, что VRAD будет пропускать расчет освещения для этих пропов. Копирование .dx90.vtx файла и переименование его в .dx80.vtx решит проблему.
Bug.png Ошибка: Additionally, .mdl files that have the IDST1 header will fail to load for VBSP, and will give a error message stating the prop failed to load; this can be fixed by changing the header to IDST0 in a Hex Editor, or by recompiling the prop in a non-L4D branch Studiomdl application such as Source 2013.
Bug.png Ошибка: As of around 5-10 years ago up until at least October, 2017 all known copies of VRAD have a thread sharing bug which causes performance to scale poorly to multiple threads, particularly on outdoor scenes with -final set (despite showing 100% CPU usage). The fix to this bug for Source 2013 is available here and edited DLLs are available here. Valve also released a patch for CSGO's VRAD that fixes this issue.

Синтаксис

vrad [options...] <bsp file>

Например:

"Half-Life 2\bin\vrad.exe" -both -StaticPropLighting sdk_trainstation_01

Это сгенерирует и встроит стандартное и HDR освещение для каждого вертекса статичных пропов.

Параметры

Используйте их в комбинации с expert compile mode или пакетным файлом.

Эффекты

-ldr
-hdr
-both
Whether to compile standard or High Dynamic Range lighting, or both.
Note.png Note: In InsurgencyCounter-Strike: Global Offensive, you need to compile with -hdr in order have proper lighting since LDR isn't supported.
-fast
Quick and dirty lighting. Don't ship with this.
-final
Increases the quality of light_environment and indirect lighting by spending more time firing rays.
-extrasky <int>
Trace N times as many rays for indirect light and sky ambient.
(-final is equivalent to -extrasky 16; normal is equivalent to -extrasky 1)
-lights <filename>.rad
Load a custom lights file in addition to lights.rad and map-specific lights file. Include the file extension in the parameter.
-bounce <int>
Set the maximum number of light ray bounces (default: 100).
-smooth <int>
Set the threshold for smoothing groups, in degrees (default: 45).
-luxeldensity <normal>
Scale down all luxels. Default (and maximum) value is 1.
-softsun <float>
Treat the sun as an area light source of this many degrees. Produces soft shadows. Recommended values are 0-5, default is 0. Identical to the SunSpreadAngle parameter in light_environment.
-StaticPropLighting
Generate per-vertex prop_static lighting; always enabled for light_spot entities. Disables info_lighting entities on props WITHOUT normal maps. Does not work on props with Phong Enabled, except in Counter-Strike: Global Offensive.
Note.png Note: In Counter-Strike: Global Offensive, in order to get proper lighting on your static props, you will need to run VRAD with this command.

-StaticPropPolys (in all games since Half-Life 2: Episode TwoHalf-Life 2: Episode Two)

Perform shadow tests of prop_statics at polygon precision. Default is to use collision meshes.

-TextureShadows (in all games since Half-Life 2: Episode TwoHalf-Life 2: Episode Two)

Generates lightmap shadows from $translucent surfaces of models (NOT brushes) that are specified in a lights file and being used with prop_static. Usually requires -StaticPropPolys to have any effect.
Note.png Note: A surface will need a low lightmap scale for most texture shadows to be recognisable.
-aoscale <float> (in all games since Counter-Strike: Global Offensive)
Scales the intensity of VRAD's simulated ambient occlusion. 1.0 is default.
Tip.png Tip: Valve uses 1.5 for the new Dust 2.
-StaticPropBounce <int> (in all games since Counter-Strike: Global Offensive)
Number of static prop light bounces to simulate. The default is 0.
Tip.png Tip: Valve uses 3 static prop bounces for the new Dust 2.
Note.png Note: Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.

Производительность

-low
Run as a low-priority process.
-threads <int>
Override the number of CPU threads used. Maximum is 16 threads. With a patched vrad_dll you can use 32 threads.
-mpi
Use VMPI to distribute computations.
-mpi_pw <string>
Use a password to choose a specific set of VMPI workers.
-noextra
Disable supersampling.
-chop <int>
Smallest number of luxel widths for a bounce patch, used on edges.
-maxchop <int>
Coarsest allowed number of luxel widths for a patch, used in face interiors.
-LargeDispSampleRadius
This can be used if there are splotches of bounced light on terrain. The compile will take longer, but it will gather light across a wider area.
-compressconstant <int>
Compress lightmaps whose color variation is less than this many units.
-fastambient <int>
To do: What is this?
-StaticPropSampleScale x (in all games since Counter-Strike: Global Offensive)
Regulates the generated per-vertex prop_static lighting.
slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
Note.png Note: -final is the equivalent of having -StaticPropLightingScale 16.

Отладка

-rederrors
Emit red light when "a luxel has no samples".
-vproject <directory>
-game <directory>
Override the VPROJECT environment variable.
-insert_search_path <directory>
To do: What does this do?
-v
-verbose
Turn on verbose output.
-novconfig
Don't bring up graphical UI on vproject errors.
-dump
Dump patches to debug files.
-dumpnormals
Write normals to debug .txt files.
-debugextra
Places debugging data in lightmaps to visualize supersampling.
-dlightmap
Force direct lighting into different lightmap than radiosity.
-stoponexit
Wait for a keypress on exit.
-nodetaillight
Don't light detail props.
-centersamples
Move sample centers.
-loghash
Log the sample hash table to samplehash.txt.
-onlydetail
Only light detail props and per-leaf lighting.
-maxdispsamplesize #
Set max displacement sample size (default: 512).
-FullMinidump
Write large minidumps on crash.
-OnlyStaticProps
Only perform direct static prop lighting.
-StaticPropNormals
When lighting static props, just show their normal vector.
-noskyboxrecurse
Turn off recursion into 3d skybox (skybox shadows on world).
-nossprops
Globally disable self-shadowing on static props.
-dumppropmaps (in all games since Source 2013Source 2013)
Dump computed prop lightmaps.


Файлы освещения

A light file is a plain text file that can be used to manipulate the way VRAD handles given materials when compiling static lighting. All lights files must have the .rad file extension and must be in the same folder as your gameinfo.txt.

There are:

  1. lights.rad, the global file.
  2. An auto-loaded map light file, using the format <map name>.rad. The file must be placed in the same folder as <map name>.vmf.
  3. Any number of additional lights files that can be added with the -lights parameter.

Правила

Lights files perform these functions, one rule per line:

<material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity>
Makes the material emit the given light value when applied to a brush face (hdr_ values are optional). Texture scale has an effect on final intensity.
Note.png Note: materials that aren't in a folder must have a slash before their name.
Note.png Note: The material itself doesn't emit anything, it instead creates light entities on its face.
Warning.png Warning: A func_detail with an emissive material applied on any face will automatically cause VRAD to fail!
noshadow <material name>
Prevents the named material from casting shadows.
forcetextureshadow <model path>.mdl
Enables translucency shadow testing for a model when VRAD is run with -TextureShadows. Path is relative to the models folder.
ldr:
hdr:
Prefixes to make any rule only apply to LDR or HDR lighting.
hdr:ldr:
Lines beginning with both tags (in that order) will always be ignored by VRAD. Can be used to add comments or quickly disable some entries.

См. также