VRAD: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
[[Category:Tools]]
{{toc-right}}
[[Category:Level Design]]
[[Category:Glossary]]
An optional compiling tool provided with the Hammer editor, that calculates the lighting of a map. It gives parts of the level, called patches, a certain amount of brightness depending on how much light it would receive. If VRAD is not used, the level will be lit in ''fullbright'' mode (no lighting).
 


'''VRAD''' is the compile tool that generates a map's [[lightmap]]s and per-leaf ambient lighting. It gives parts of the map, called patches, a certain amount of brightness depending on how much light it calculates it should receive.


==Speed==
==Speed==


This is the generally the slowest of the three compile stages due to the many, many calculations it must perform. Map optimization can reduce the speed of this tool somewhat, especially reducing the number of unique names given to lights (which reduces the number of dynamic light combinations for which radiosity must be calculated).
VRAD is the generally the slowest of the three compilers due to the many, many calculations it must perform. [[Optimization (level design)|Map optimization]] can reduce the speed of this tool somewhat, especially reducing the number of unique names given to lights (which reduces the number of dynamic light combinations for which radiosity must be calculated).


If you are watching the compile dialog and it looks like it has hung at ''<code>9...</code>'' this is usually because Vrad takes longer with each light bounce calculation. Be patient.
If you are watching the compile dialog and it looks like it has hung at ''<code>9...</code>'' this is usually because Vrad takes longer with each light bounce calculation. Be patient.
To speed up VRAD, Win NT/2k/XP/2k3 users can open "Windows Task Manager" (<nowiki><Ctrl>+<Shift>+<Esc> or <Ctrl>+<Alt>+<Del></nowiki> on Windows XP or newer) and set the priority of "vrad.exe" higher. But beware, changing its priority will reduce the amount of resources available to the system itself and may cause freezes until the end of the process!


==Options==
==Options==
Line 123: Line 118:
:Prevents the named material from casting shadows when applied to a [[brush]] face.
:Prevents the named material from casting shadows when applied to a [[brush]] face.
;<code>forcetextureshadow <model name>.mdl</code>
;<code>forcetextureshadow <model name>.mdl</code>
:Enables translucency shadow testing, when VRAD is run with <code>[[#Effects|-TextureShadows]]</code>.
:Enables translucency shadow testing for a model when VRAD is run with <code>[[#Effects|-TextureShadows]]</code>.
;<code><material name> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity></code>
;<code><material name> <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.
: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.
Line 131: Line 126:


==See also ==
==See also ==
* [[lights.rad | Editing the Lights.rad File]]
* [[Map Compiling Theory]]
* [[Map Compiling Theory]]
* [[HDR Lighting Basics]]
* [[HDR Lighting Basics]]
* [[Vbsp|VBSP]]
* [[Vbsp|VBSP]]
* [[Vvis|VVIS]]
* [[Vvis|VVIS]]
[[Category:Tools]]
[[Category:Level Design]]
[[Category:Glossary]]

Revision as of 04:35, 17 September 2008

VRAD is the compile tool that generates a map's lightmaps and per-leaf ambient lighting. It gives parts of the map, called patches, a certain amount of brightness depending on how much light it calculates it should receive.

Speed

VRAD is the generally the slowest of the three compilers due to the many, many calculations it must perform. Map optimization can reduce the speed of this tool somewhat, especially reducing the number of unique names given to lights (which reduces the number of dynamic light combinations for which radiosity must be calculated).

If you are watching the compile dialog and it looks like it has hung at 9... this is usually because Vrad takes longer with each light bounce calculation. Be patient.

Options

Use these in combination with expert compile mode or a batch file:

Effects

-both
Compiles lightmaps for both Low Dynamic Range and High Dynamic Range lighting models. Causes the compiler to run twice.
-ldr
Compile only LDR lightmaps.
-hdr
Compile only HDR lightmaps.
-fast
Quick and dirty lighting. Has been known to leave dark lines around displacements.
-final
Increases the quality of light_environment and indirect lighting by spending more time firing rays.
-lights <file>
Load a custom lights file in addition to lights.rad and map-specific lights file. The file specified must be <filename>.rad.
-bounce #
Set the maximum number of light ray bounces (default: 10).
-smooth #
Set the threshold for smoothing groups, in degrees (default: 45).
-luxeldensity #
Rescale all luxels by the specified amount (default: 1.0). Must not exceed 1.
-softsun <n>
Treat the sun as an area light source of size <n> degrees. Produces soft shadows. Recommended values are between 0 and 5. Default is 0.
-StaticPropLighting
Generate per-vertex prop_static lighting. Now seems to be permanently enabled; disable it per-object with KVs.
Template:Ep2 add
Perform shadow tests of prop_statics at polygon precision. (Very processor-intensive - default is to use collision models.)
Template:Ep2 add
Generates lightmap shadows from $translucent surfaces of models specified in lights.rad (see below) and used with prop_static. Usually requires -StaticPropPolys to have any effect.

Performance

-low
Run as an low-priority process. Allows you to use your computer for other things during compiles.
-threads
Control the number of threads used (defaults to the number of processors on your machine, doubled for CPUs with hyperthreading).
-mpi
Use VMPI to distribute computations.
-mpi_pw <pw>
Use a password to choose a specific set of VMPI workers.
-noextra
Disable supersampling.
-chop
Smallest number of luxel widths for a bounce patch, used on edges.
-maxchop
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 <n>
Compress lightmaps whose color variation is less than n units.

Debugging

-rederror
Emit bright red light from error locations?
-vproject <directory>
-game <directory>
Override the VPROJECT environment variable.
v
-verbose
Turn on verbose output.
-novconfig
Don't bring up graphical UI on vproject errors.
-dump
Write debugging .txt files.
-dumpnormals
Write normals to debug 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 (vrad debug option)
-StaticPropNormals
When lighting static props, just show their normal vector

Lights files

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. light.rad, the global file.
  2. An auto-loaded map light file. It is unclear what filename is needed - perhaps simply <map name>.rad?
  3. Any number of additional lights files that can be added with the -lights parameter.

Rules

Lights files perform these functions, one rule per line:

noshadow <material name>
Prevents the named material from casting shadows when applied to a brush face.
forcetextureshadow <model name>.mdl
Enables translucency shadow testing for a model when VRAD is run with -TextureShadows.
<material name> <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.
ldr:
hdr:
Prefixes to make any rule only apply to LDR or HDR lighting.

See also