VRAD: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Whoops again, shesh!)
Line 57: Line 57:


===Other options===
===Other options===
{| cellpadding=4
 
!align=left| Name
==== Effects ====
!align=left| Description and Notes
 
|-
;<code>-lights <file></code>
| <code>-novconfig</code>
:Load a custom [[#Lights_files|lights file]] in addition to <code>lights.rad</code> and map-specific lights file. The file specified must be <code>filename.rad</code>.
| Don't bring up graphical UI on vproject errors.
;<code>-smooth #</code>
|-
:Set the threshold for smoothing groups, in degrees (default: 45).
| <code>-dump</code>
;<code>-luxeldensity #</code>
| Write debugging .txt files.
:Rescale all luxels by the specified amount (default: 1.0). Must not exceed 1.
|-
;<code>-softsun <n></code>
| <code>-dumpnormals</code>
: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.
| Write normals to debug files.
;<code>-StaticPropLighting</code>
|-
:Generate per-vertex static prop lighting. Permanently enabled in Orange Box VRAD.
| <code>-threads</code>
;{{ep2 add|<code>-StaticPropPolys</code>}}
| Control the number of threads vbsp uses (defaults to the number of processors on your machine, doubled for CPUs with hyperthreading).
:Perform shadow tests of static props at polygon precision. ''('''Very''' processor-intensive - default is to use collision models.)''
|-
;{{ep2 add|<code>-TextureShadows</code>}}
| <code>-lights <file></code>
:Generates shadows from the [[$translucent]] surfaces of models specified in lights.rad (see below). Usually requires <code>-StaticPropPolys</code> to have any effect.
| Load a [[#Lights_files|lights file]] in addition to lights.rad and the level lights file. A file specified must have the .rad extension. ''IE: lights_exec.rad''.
 
|-
==== Performance ====
| <code>-mpi</code>
 
| Use VMPI to distribute computations.
;<code>-threads</code>
|-
:Control the number of threads used (defaults to the number of processors on your machine, doubled for CPUs with hyperthreading).
| <code>-noextra</code>
;<code>-mpi</code>
| Disable supersampling.
:Use [[VMPI]] to distribute computations.
|-
;<code>-mpi_pw <pw></code>
| <code>-debugextra</code>
:Use a password to choose a specific set of VMPI workers.
| Places debugging data in lightmaps to visualize supersampling.
;<code>-noextra</code>
|-
:Disable supersampling.
| <code>-smooth #</code>
;<code>-chop</code>
| Set the threshold for smoothing groups, in degrees (default: 45).
:Smallest number of luxel widths for a bounce patch, used on edges.
|-
;<code>-maxchop</code>
| <code>-dlightmap</code>
:Coarsest allowed number of luxel widths for a patch, used in face interiors.
| Force direct lighting into different lightmap than radiosity.
;<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>-stoponexit</code>
;<code>-compressconstant <n></code>
| Wait for a keypress on exit.
:Compress lightmaps whose color variation is less than n units.
|-
 
| <code>-mpi_pw <pw></code>
==== Debugging ====
| Use a password to choose a specific set of VMPI workers.
 
|-
;<code>-novconfig</code>
| <code>-nodetaillight</code>
:Don't bring up graphical UI on vproject errors.
| Don't light detail props.
;<code>-dump</code>
|-
:Write debugging .txt files.
| <code>-centersamples</code>
;<code>-dumpnormals</code>
| Move sample centers.
:Write normals to debug files.
|-
;<code>-debugextra</code>
| <code>-luxeldensity #</code>
:Places debugging data in lightmaps to visualize supersampling.
| Rescale all luxels by the specified amount (default: 1.0). Must not exceed 1.
;<code>-dlightmap</code>
|-
:Force direct lighting into different lightmap than radiosity.
| <code>-loghash</code>
;<code>-stoponexit</code>
| Log the sample hash table to samplehash.txt.
:Wait for a keypress on exit.
|-
;<code>-nodetaillight</code>
| <code>-onlydetail</code>
:Don't light detail props.
| Only light detail props and per-leaf lighting.
;<code>-centersamples</code>
|-
:Move sample centers.
| <code>-maxdispsamplesize #</code>
;<code>-loghash</code>
| Set max displacement sample size (default: 512).
:Log the sample hash table to samplehash.txt.
|-
;<code>-onlydetail</code>
| <code>-softsun <n></code>
:Only light detail props and per-leaf lighting.
| 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.
;<code>-maxdispsamplesize #</code>
|-
:Set max displacement sample size (default: 512).
| <code>-FullMinidump</code>
;<code>-FullMinidump</code>
| Write large minidumps on crash.
:Write large minidumps on crash.
|-
;<code>-OnlyStaticProps</code>
| <code>-chop</code>
:Only perform direct static prop lighting (vrad debug option)
| Smallest number of luxel widths for a bounce patch, used on edges.
;<code>-StaticPropNormals</code>
|-
:When lighting static props, just show their normal vector
| <code>-maxchop</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 <n></code>
| compress lightmaps whose color variation is less than n units.
|-
| <code>-[[StaticPropLighting]]</code>
| generate backed static prop vertex lighting. ''(Processor-intensive)''
|-
| <code>-[[StaticPropPolys]]</code>
| Perform shadow tests of static props at polygon precision. ''('''Very''' processor-intensive - default is to use collision models for shadows)''
|-
| <code>-OnlyStaticProps</code>
| Only perform direct static prop lighting (vrad debug option)
|-
| <code>-StaticPropNormals</code>
| when lighting static props, just show their normal vector
|-
| <code>-[[textureshadows]]</code>
| Generates shadows based on alpha textures. ''(editing of the lights.rad file is required.)''
|}


==Lights files==
==Lights files==

Revision as of 04:04, 17 September 2008

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).


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).

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.

To speed up VRAD, Win NT/2k/XP/2k3 users can open "Windows Task Manager" (<Ctrl>+<Shift>+<Esc> or <Ctrl>+<Alt>+<Del> 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

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

Common options

Name Description and Notes
v (or -verbose) Turn on verbose output.
-bounce # Set max number of bounces (default: 10).
-fast Quick and dirty lighting. (Has been known to leave dark lines around displacments)
-both Compiles lightmaps for both Low Dynamic Range and High Dynamic Range lighting models. (Cycles twice)
-final Increases the quality of skylight and indirect light by spending more CPU time firing rays.
-ldr Turn on verbose output.
--hdr Compiles only HDR lightmaps.
-low Run as an idle-priority process.
-rederror Run as an idle-priority process.
-vproject <directory> Override the VPROJECT environment variable.
-game <directory> Same as -vproject.

Other options

Effects

-lights <file>
Load a custom lights file in addition to lights.rad and map-specific lights file. The file specified must be filename.rad.
-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 static prop lighting. Permanently enabled in Orange Box VRAD.
Template:Ep2 add
Perform shadow tests of static props at polygon precision. (Very processor-intensive - default is to use collision models.)
Template:Ep2 add
Generates shadows from the $translucent surfaces of models specified in lights.rad (see below). Usually requires -StaticPropPolys to have any effect.

Performance

-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

-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 lights file contains rules for glowing textures and model and material shadowing control. The lights file, usually with a .rad extension, must be placed in your game directory for Vrad to find it. It is a plain text file with one rule per line.

Lights file rules
Rule Explanation
noshadow materials/name Forces the named material to cast no shadows.
forcetextureshadow models/name.mdl Forces shadows for the given model to take into account any alpha textures.
materials/name red green blue intensity The named material will give off light of the given colour and intensity.
materials/name red green blue intensity hdr_red hdr_green hdr_blue hdr_intensity The named material will give off light of the given colour and intensity, with separate LDR and HDR settings.
ldr: prefix to make any rule only apply to LDR lighting.
hdr: prefix to make any rule only apply to HDR lighting.

See also