This article's documentation is for anything that uses the Source engine. Click here for more information.

VRAD: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fixing links)
 
(226 intermediate revisions by 68 users not shown)
Line 1: Line 1:
{{LanguageBar}}
{{Tabs|VRAD|source=1|source2=1|main=source}}
{{src topicon}}
{{map compile pipeline|source1}}
{{toc-right}}
{{toc-right}}


'''VRAD''' is the [[command-line]] tool that compiles 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.
{{vrad|4}} is the [[command-line]] tool for {{source|4|}} that takes a compiled BSP map and embeds lighting data into it. VRAD's static and pre-compiled light is bounced around the world with a {{Wikipedia|Radiosity (3D computer graphics)|radiosity}} algorithm.
 
'''VRAD will:'''
 
* Generate [[lightmap]]s
* Generate [[Ambient light|ambient samples]]
* Generate per-vertex [[prop_static]] lighting
* Generate per-object [[detail prop]] lighting
 
VRAD is generally the slowest of the three compilers due to the many, many calculations it must perform. [[Lighting optimization]] can help, as can ensuring your map is free of [[leak]]s.


==Speed==
== Syntax ==


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).
{{codeblock|vrad [options...] <bsp file>}}


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.
For example, a regular compile would look like thus:
 
{{codeblock|"Half-Life 2\bin\vrad.exe" -both -StaticPropLighting -StaticPropPolys -TextureShadows sdk_trainstation_01}}
 
This will generate and embed both Standard and [[High Dynamic Range]] lighting data, at per-vertex detail for [[prop_static]] entities. It also generates shadows based on transparency for prop_static entities [[Texture Shadows|that have been flagged as casting texture shadows]].


==Options==
==Options==
Use these in combination with [[expert compile mode]] or a batch file:
 
Use these in combination with [[expert compile mode]], a batch file, or a frontend such as {{compilepal|2}}.
{{Todo|Fix CLParam template. This template does not work properly with gallery and bug  template.}}
{{todo|Add line breaks (<nowiki><br></nowiki>) in the larger descriptions where appropriate, to improve legibility.}}


=== Effects ===
=== Effects ===
{{CLParam|-ldr}}
{{CLParam|-hdr}}
{{CLParam|-both|Whether to compile Standard Dynamic Range lighting (''referred to as "Low Dynamic Range lighting" in Source''), [[HDR|High Dynamic Range]] lighting, or both respectively.
:{{note|Since {{l4d}}, SDR support was deprecated.  Thus making {{mono|-ldr}} and {{mono|-both}} obsolete in engine branches made on or after {{l4d}}. Instead, {{mono|-hdr}} is required in order to produce proper lighting for your map.{{note|{{bms}}{{slamminsrc}} default to compiling only HDR automatically.}}}}}}
:{{important|In engine branches prior to {{l4dbranch}} (including {{src13}}), loading a map compiled with {{code|-hdr}} only when HDR is disabled will result in {{cmd|mat_fullbright|1}} being forced on, which applies to all subsequent maps until cheats are enabled. This does not affect maps compiled with {{code|-ldr}} only. As such, final distributables for pre-{{l4d}} multiplayer games should be compiled in {{code|-both}} or {{code|-ldr}} to prevent giving fullbright cheats to users with HDR enabled; {{code|-hdr}} can still be useful for faster iteration in development compiles.}}
{{CLParam|-fast|Compiles quick low quality lighting.  Used for quick previewing.
:{{Note|{{mono|-fast}} will cause random and discolored splotching to appear in darker areas, as well as shadowed edges around Displacements.  It is advised to not ship your map using {{mono|-fast}}. {{Tip|If you have a relatively modern CPU, you can try using other parameters to reduce the standard compile time instead.  For example:{{mono|-fastambient -bounce 1 -noextra -nodetaillight -noskyboxrecurse}} instead of {{mono|-fast}}}}}}}}
{{CLParam|-final|Increases the quality of {{Ent|light_environment}} and indirect lighting by spending more time firing rays.}}
:{{csgo}},{{gmod}} Sets{{mono|-StaticPropSampleScale}} to 16.
:{{slamminsrc}} Sets{{mono|-aosamples}} to 32, {{mono| -extrasky}} to 16, and {{mono| -extrapasses}} to 8.
{{CLParam|-extrasky|param=int|Trace N times as many rays for indirect light and sky ambient. {{clr}}({{mono|-final}} is equivalent to {{mono|-extrasky 16}}; normal is equivalent to {{mono|-extrasky 1}})}}
{{CLParam|-lights <filename>.rad|Load a custom [[RAD file]] in addition to {{mono|lights.rad}} and the map-specific lights file. Include the file extension in the parameter.}}
{{CLParam|-bounce|param=int|Set the ''maximum'' number of light ray bounces. (default: 100).}}
{{CLParam|-smooth|param=int|Set the threshold for automatic phong smoothing of lightmaps between edges, in degrees (default: 45). Use [[smoothing group]]s to explicitly define faces as phonged together.}}
{{CLParam|-luxeldensity|param=normal|Scale down all luxels. Default (and maximum) value is 1. {{warning|Setting too low of a value will cause lighting errors.}}}}
{{CLParam|-softsun|param=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 for {{mono|light_environment}}, use that instead.}}
{{CLParam|-StaticPropLighting|Generate per-vertex lighting on [[prop_static]]s. Causes {{code|[[info_lighting|lightingorigin]]}} on static props props without [[$bumpmap]] or [[$phong]] to not affect lighting (only affecting chosen [[env_cubemap]]), unless the {{code|disablevertexlighting}} KV is set for the prop. This '''will''' increase your map's compile times substantially, based on the amount of props that you have! Disable vertex lighting for props that don't need it to keep compile times down. Static props which are close to bright {{ent|light_spot}} entities will still appear as if they were lit per-vertex, due to the lights creating directional [[elight]]s.<br>{{only|{{src13mp}} {{tf2branch}} {{gmod}}}} It also generates lightmaps for static props that have {{code|[[prop_static#Keyvalues|generatelightmaps]]}} enabled in supported engines.
: {{bug|hidetested=1|In all games prior to {{csgo}}, VRAD uses a faulty algorithm for calculating indirect vertex lighting on props. In games based on {{src13mp}} and {{tf2branch}}, the lighting tends to be unnaturally dark or harsh, while in games based on older branches ({{src13sp}} & {{orangebox}}) it's too bright. A [http://github.com/ValveSoftware/source-sdk-2013/pull/1345 pull request to address this] has been submitted.}}
: {{warning|In {{bms|4}}, you should use {{code|-StaticPropLighting3}} instead.}}
: {{important| Does not work on props with bump maps, except in {{csgo|4}}. {{note|In {{csgo}}, in order to get proper lighting on your static props, you will need to run VRAD with this command.}}}}|game={{since|{{Src07}}}}}}
{{CLParam|-StaticPropPolys|Use the actual meshes of static props to generate shadows instead of using their [[collision mesh]]es. This results in far more accurate shadowing.|game={{since|{{Src07}}}}}}
:{{expand|title=-StaticPropPolys - Examples|<gallery mode=nolines widths=320px heights=192px>
File:Polys1.jpg|Disabled.
File:Polys2.jpg|Enabled.
</gallery>
}}
{{CLParam|-textureshadows|Casts [[texture shadows]] from {{cmd|$alphatest}} and {{cmd|$translucent}} surfaces of {{ent|prop_static}} models that are specified in a [[RAD file]] or were compiled with {{cmd|$casttextureshadows}}. Usually requires {{mono|-StaticPropPolys}} to have any effect. A surface will need a low [[lightmap]] scale for most texture shadows to be recognizable. Nonetheless, textures such as grate fences, foliage, and barbed wire will still cast noticeably more accurate shadows with this command enabled compared to disabled. {{gmod}}{{mapbase}} Also casts shadows from model materials with {{cmd|%alphatexture}}.
:{{expand|title=-textureshadows - Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:Polys2.jpg|Disabled.
File:Polys3.jpg|Enabled.
</gallery>
}}
: {{note|{{bms|only}} Also generates lightmap shadows from brushes (but not displacements) using {{cmd|$alphatest}}.{{bug|tested={{bms}}|Not compatible with {{cmd|$envmap|env_cubemap}}; manually define the {{cmd|$envmap}} path instead.}}}}
: {{bug|tested={{dods}}{{src13mp}}|Static props with multiple [[skin]]s will always use the alpha channel(s) from the default skin's texture(s), even though the alternative skins' alpha textures are loaded by VRAD.<br> This will not work if a translucent texture's $basetexture parameter in the VMT contains the .vtf file extension; file extensions should be omitted from texture paths in VMTs.}}|game={{since|{{Src07}}}}}}


;<code>-both</code>
=== Game/Compiler Specific Parameters ===
:Compiles lightmaps for both Low Dynamic Range and [[HDR|High Dynamic Range]] lighting models. Causes the compiler to run twice.
=== {{csgo|4}} ===
;<code>-ldr</code>
 
:Compile only LDR lightmaps.
{{CLParam|-aoscale|param=float|Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default.
;<code>-hdr</code>
: {{Tip|Valve uses 1.5 for Dust 2.}}|game={{since|{{csgo}}}}{{also|{{slamminsrc}}{{gmod}}}}}}
:Compile only HDR lightmaps.
:{{expand|title=-aoscale - Examples|<gallery mode=nolines widths=320px heights=192px>
;<code>-fast</code>
File:VRAD AO Scale 0.25.jpg|{{code|-aoscale}} set to {{code|0.25}}
: Quick and dirty lighting. Has been known to leave dark lines around displacements.
File:VRAD AO Scale 2.0.jpg|{{code|-aoscale}} set to {{code|2.0}}
;<code>-final</code>
</gallery>
: Increases the quality of [[light_environment]] and indirect lighting by spending more time firing rays.
}}
;<code>-lights <filename></code>
{{CLParam|-StaticPropBounce|param=int|Number of static prop light bounces to simulate. The default is 0.
: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>.
: {{Tip|Valve uses 3 static prop bounces for Dust 2.}}
;<code>-bounce #</code>
: {{Note|Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.}}|game={{only|{{csgo}}}}{{also|{{gmod}}}}
: Set the maximum number of light ray bounces (default: 10).
}}
;<code>-smooth #</code>
{{CLParam|-StaticPropLightingFinal|{{obs}} Merged with {{mono|-final}}.|game={{only|{{csgo}}}}}}
:Set the threshold for [[smoothing group]]s, in degrees (default: 45).
{{CLParam|-StaticPropLightingOld|Will use the old lighting algorithm on props, light affects them much more.|game={{only|{{csgo}}}}}}
;<code>-luxeldensity #</code>
{{CLParam|-ambient|param=color1|Sets the ambient term. Can be used to tweak lightmap color. Appears to just mix the color into all lightmaps.<br>Also available in {{src13|2}} if VRAD is [[#Debug mode options|compiled in debug mode]]|game={{only|{{csgo}}{{Dmmm}}{{slamminsrc}}}}}}
:Scale down all luxels. Default (and maximum) value is 1.
{{CLParam|-unlitdetail|Disables lighting for detail props.|game={{only|{{csgo}}}}}}
;<code>-softsun <n></code>
{{CLParam|-ambientfromleafcenters|Samples ambient lighting from the center of the leaf.|game={{only|{{csgo}}}}}}
: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.
{{CLParam|-StaticPropSampleScale|param=float|Extra sampling factor for indirect lighting on prop_static.
;<code>-StaticPropLighting</code>
: slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
:Generate per-vertex <code>[[prop_static]]</code> lighting. This is always enabled for [[light_spot]] entities.
: {{note|-final is the equivalent of having -StaticPropSampleScale 16.}}|game={{only|{{CSGO}}}}{{also|{{gmod}}}}}}
:{{note|Depending on the number of static props in the level, this can dramatically increase the size of the .bsp file and the length of time needed for vrad to finish.}}
{{CLParam|-LeafAmbientSampleReduction|param=float|Reduction factor for ambient samples. Defaults to 1.0.|game={{only|{{CSGO}}}}}}
:{{note|When using this setting, it disables all [[info_lighting]] entities in your level and it will light models as if there wasn't one linked to them.}}
 
;{{EP2 add|<code>-StaticPropPolys</code>}}
=== {{gmod|4}} ===
:Perform shadow tests of <code>prop_static</code>s at polygon precision. ''('''Very''' processor-intensive - default is to use collision models.)''
{{CLParam|-aofacesamples|param=int|Adjust number of AO face samples for brushes. Default is 32, -final is 128, -fast is 16. |game={{only|{{gmod}}}}}}
;{{EP2 add|<code>-TextureShadows</code>}}
{{CLParam|-aopropsamples|param=int|Adjust number of AO face samples for props. Default is 16, -final is 32, -fast is 12. |game={{only|{{gmod}}}}}}
:Generates lightmap shadows from [[$translucent]] surfaces of models that are specified in a [[#Lights_files|lights file]] and being used with [[prop_static]]. Usually requires <code>-StaticPropPolys</code> to have any effect.
{{CLParam|-aoNoSquare|Disables squaring of ambient occlusion, making it look less harsh. Default is on (more harsh). |game={{only|{{gmod}}}}}}
:{{note|A surface will need a low [[lightmap]] scale for most texture shadows to be recognisable.}}
{{CLParam|-bounceFromNamed|Forces named and styled lights to cast bounced lighting. Note that this will increase lightmap usage! |game={{only|{{gmod}}}}}}
:{{note|-TextureShadows will cast shadows from models using a [[$translucent]] material, this however does not work when a [[$translucent]] material is placed on a brush surface. As for now this only applies to models, hopefully this will change in the near future.}}
 
=== {{bms|4}} ===
 
{{CLParam|-StaticPropLighting3|This is a more precise and less buggy version of {{code|-StaticPropLighting}}.|game={{only|{{BMS}}}}}}
{{CLParam|-choptexlights|Enables chopping of texture lights generated from a lights file. Control texture light quality with lightmap density in Hammer. Dramatically increases both texture light quality and compile time.|game={{only|{{BMS}}}}}}
{{CLParam|-extratransfers|Enable overscaling of light transfers.|game={{only|{{BMS}}}}}}
{{CLParam|-transferscale|param=float|This is the scale factor of light transfers. Increased values make surfaces transfer extra light (scale of 2-4 suggested). Default 1.0.|game={{only|{{BMS}}}}}}
{{CLParam|-satthresh|param=float|This is the threshold that checks how saturated a material color is. Used with {{mono|-satthreshscale}}. Default 0.4.|game={{only|{{BMS}}}}}}
{{CLParam|-satthreshscale|param=float|The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.|game={{only|{{BMS}}}}}}
{{CLParam|-ambientocclusion|Enable lightmapped ambient occlusion.
: {{tip|Use very low lightmap scale for small stairs or add additional light sources to light them, otherwise stairs will be completely black.}}|game={{only|{{BMS}}}}{{also|{{slamminsrc}}{{gmod}}}}}}
:{{expand|title=-ambientocclusion Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:NOAO.jpg|Disabled.
File:AO.jpg|Enabled.
</gallery>
}}
{{CLParam|-experimentalambientocclusion|Uses an improved algorithm for ambient occlusion.
:{{obs}}Broken. Don't use.|game={{only|{{BMS}}}}}}
:{{expand|title=-experimentalambientocclusion Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:AO.jpg|Ambient occlusion.
File:EAO.jpg|Experimental ambient occlusion.
</gallery>
}}
{{CLParam|-cascadeshadows|Indicates that lightmap alpha data is interleved in the lighting lump, required for CSM.
:Must be used with <code>-StaticPropLighting3</code> to have proper lighting of static props.
:{{expand|title=-cascadeshadows Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:CSMlSkyLight1.jpg|With <code>-cascadeshadows</code> only.
File:CSMlSkyLight2.jpg|With <code>-cascadeshadows</code> and <code>-staticproplighting3</code>.
</gallery>
}}
|game={{only|{{BMS}}}}}}
{{CLParam|-realskylight|Enables VRAD to compute skylight ambient color by using actual values from skybox.<br> This option was originally designed only for levels in Xen, to make lighting for islands more natural. With earthbound outdoor levels this option makes level lighting weird, especially if level uses a skybox with an open, clear sky.
:{{expand|title=-realskylight Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:RealSkyLight1.jpg|Without <code>-realskylight</code>.
File:RealSkyLight2.jpg|With <code>-realskylight</code>.
</gallery>
}}
|game={{only|{{BMS}}}}}}
{{CLParam|-realskylightscale|param=float|Scale factor of -realskylight intensity. Default: 1.0|game={{only|{{BMS}}}}}}
{{CLParam|-directsunlightisforadditivemode|Toggles direct sunlight for additive mode.
:{{bug|tested={{bms}}|This option is not compatible with cascaded shadows.}}
:{{expand|title=-directsunlightisforadditivemode Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:cascadeshadowsbug.jpg|Example with <code>dm_pro_crossfire__twilight_r2</code>.
</gallery>
}}
|game={{only|{{BMS}}}}}}
=== {{strata|4}} ===
{{CLParam|-aoradius|param=float|Set the radius of VRAD's simulated ambient occlusion. 36 is default.|game={{only|{{Strata}}{{Nwi_games}}}}}}
{{CLParam|-aosamples|param=int|How many samples to use for VRAD's simulated ambient occlusion.|game={{only|{{Strata}}{{Nwi_games}}}}{{also|{{slamminsrc}}}}}}
{{CLParam|-PortalTraversalLighting|Enables static lights to go through {{ent|linked_portal_door}}, if <code>Static Portal</code> value is <code>Yes</code>.|game={{only|{{Strata}}}}}}
:{{expand|title=-PortalTraversalLighting Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:PortalTraversalLighting1.jpg|Without <code>-PortalTraversalLighting</code>.
File:PortalTraversalLighting2.jpg|With <code>-PortalTraversalLighting</code>.
</gallery>
}}
{{CLParam|-PortalTraversalAO|Enables static light [[Ambient Occlusion]] to go through {{ent|linked_portal_door}}, if <code>Static Portal</code> value is <code>Yes</code>.|game={{only|{{Strata}}}}}}
:{{expand|title=-PortalTraversalAO Examples|
<br>
<gallery mode=nolines widths=320px heights=192px>
File:PortalTraversalLightingAO1.jpg|Without <code>-PortalTraversalLightingAO</code>.
File:PortalTraversalLightingAO2.jpg|With <code>-PortalTraversalLightingAO</code>.
</gallery>
}}
=== {{slamminsrc|4}} ===
{{CLParam|-softenCosine|Softens coloured lighting so it blends more accurately.|game={{only|{{slamminsrc}}}}{{also|{{gmod}}}}}}
{{CLParam|-worldtextureshadows|Allows world polys to cast texture shadows, much like models can.
:{{bug|tested={{src13}}|Doesn't work with displacements, and certain [https://knockout.chat/thread/992/5#post-2531724 file formats] might not cast shadows!}}|game={{only|{{slamminsrc}}}}}}
:{{expand|title=-worldtextureshadows Examples|
<gallery mode=nolines widths=320px heights=192px>
File:WorldTex1.jpg|Disabled.
File:WorldTex2.jpg|Enabled.
</gallery>
}}
{{CLParam|-translucentshadows|Enables -worldtextureshadows on {{Command|$translucent}} surfaces. As by default only {{ent|$alphatest}} surfaces cast baked shadows.
:{{bug|tested={{src13}}|Doesn't work with displacements, and certain [https://knockout.chat/thread/992/5#post-2531724 file formats] might not cast shadows!}}
|game={{only|{{slamminsrc}}}}}}
:{{expand|title=-translucentshadows Examples|<gallery mode=nolines widths=320px heights=192px>
File:Translu2.jpg|Disabled.
File:Translu1.jpg|Enabled.
</gallery>
}}
{{CLParam|-coring|param=float|Luxels with values dimmer than this are treated as completely black, and don't get supersampled.<br>Also available in {{src13|2}} if VRAD is [[#Debug mode options|compiled in debug mode]]|game={{only|{{slamminsrc}}}}}}
{{CLParam|-reflectivityScale|param=float|Scale the [[$reflectivity]] of all textures. Default 1.0|game={{only|{{slamminsrc}}}}}}
 
=== {{mapbase|4}} ===
 
{{CLParam|-ultrafast|Merges '-fast -fastambient -noextra -bounce 1' commands into one, reduces compile time, useful for testing large maps.|game={{only|{{mapbase}}}}}}
{{CLParam|-extrapasses|Lets you scale how many extra passes you want your map to go through for supersampling, useful for making the lightmaps more rgb constant.|game={{only|{{mapbase}}}}}}
=== {{hl2|4}} 20th and {{portal|4}} (May 20 update) ===
{{Note|Also available in {{hls|1}} (since {{hl2|1}} 20th Anniversary Update) and {{portal|1}} (May 20, 2025 update).}}
{{CLParam|-HL2LDRAmbientClassic|Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)|game={{only|{{hl2}}}} 20th|also={{hls}}{{portal}}}}
{{CLParam|-HL2LDRAmbientFix|Use adjusted LDR ambient lighting constant for HDR re-lit maps (Post Xbox 360/Orange Box HL2 VMFs only)|game={{only|{{hl2}}}} 20th|also={{hls}}{{portal}}}}


=== Performance ===
=== Performance ===


;<code>-low</code>
{{ColumnBox|count=1|{{CLParam|-low|Run as a low-priority process.}}
:Run as an low-priority process. Allows you to use your computer for other things during compiles.
{{CLParam|-threads|param=int|Override the number of CPU threads used. Maximum is 16 threads (32 in {{csgo}}{{slamminsrc}}{{mapbase}}, unlimited in {{tf2}})
;<code>-threads</code>
:{{Workaround|With a [[Increased_Thread_Limit_for_Compile_Tools|patched vrad_dll]] you can use 32 threads. {{l4d2}} [https://github.com/ficool2/fixtoolthreads fixtoolthreads] is a patch for [[VRAD]] (and [[VVIS]]) that supports ''unlimited'' threads and fixes a thread scaling issue.}}
:Control the number of threads used (defaults to the number of processors on your machine, doubled for CPUs with hyperthreading).
::{{Note|The above mentioned thread scaling issue has been fixed in {{tf2}},{{csgo}},{{l4d2}},{{gmod}}.}}
;<code>-mpi</code>
:{{Tip|If you know that the compile time will be very long and would rather do something else while waiting, it may be useful to specify a number of threads 1 or 2 lower than what your CPU has. This allows the computer to allocate some more power to other applications, making it less choppy while lighting is being compiled. Keep in mind that this may slightly extend your compile time.}}
:Use [[Vmpi|VMPI]] to distribute computations.
}}
;<code>-mpi_pw <pw></code>
{{CLParam|-mpi|Use [[Vmpi|VMPI]] to distribute computations.}}
:Use a password to choose a specific set of VMPI workers.
{{CLParam|-mpi_pw|param=string|Use a password to choose a specific set of VMPI workers.}}
;<code>-noextra</code>
{{CLParam|-noextra|Disable supersampling. This will lead to blockier, less accurate lighting.}}
:Disable supersampling.
{{CLParam|-chop|param=int|Smallest number of [[luxel]] widths for a bounce patch, used on edges. (Default: 4)}}
;<code>-chop</code>
{{CLParam|-maxchop|param=int|Coarsest allowed number of luxel widths for a patch, used in face interiors. (Default: 4)}}
:Smallest number of [[luxel]] widths for a bounce patch, used on edges.
{{CLParam|-dispchop|param=int|Smallest acceptable [[luxel]] width of displacement patch face. (Default: 8)}}
;<code>-maxchop</code>
{{CLParam|-LargeDispSampleRadius|This can be used if there are (dark) splotches of bounced light on terrain. The compile will take longer, but it will gather light across a wider area.}}
:Coarsest allowed number of luxel widths for a patch, used in face interiors.
{{CLParam|-compressconstant|param=int|Compress [[lightmap]]s whose color variation is less than this many units.}} {{todo|Find out if this is branch specific, as it doesn't work with TF2.}}
;<code>-LargeDispSampleRadius</code>
{{CLParam|-fastambient|Uses low quality per-leaf ambient sampling to save compute time.}}
: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.
{{CLParam|-noao|Disables compiling simulated ambient occlusion for lightmaps.|game={{only|{{Nwi_games}}}}}}
;<code>-compressconstant <n></code>
{{CLParam|-disppatchradius|param=float|Sets the maximum radius allowed for displacement patches. If you get "Patch Sample Radius Clamped", you can try increasing this limit.}}
:Compress [[lightmap]]s whose color variation is less than n units.
}}


=== Debugging ===
=== Debugging ===


;<code>-rederror</code>
{{ColumnBox|count=1|{{CLParam|-rederrors|Emit red light when "a luxel has no samples".}}
:Emit bright red light from error locations?
{{CLParam|-vproject <directory>}}
;<code>-vproject <directory></code>
{{CLParam|-game <directory>|Override the VPROJECT environment variable.}}
;<code>-game <directory></code>
{{CLParam|-insert_search_path <directory>|Includes an extra base directory for mounting additional content (like [[Gameinfo.txt]] entries). Useful if you want to separate some assets from the mod for whatever reason.}}
:Override the VPROJECT environment variable.
{{CLParam|-v}}
;<code>v</code>
{{CLParam|-verbose|Turn on verbose output.}}
;<code>-verbose</code>
{{CLParam|-novconfig|Don't bring up graphical UI on vproject errors.}}
: Turn on verbose output.
{{CLParam|-dump|Dump patches to debug files.}}
;<code>-novconfig</code>
{{CLParam|-dumpnormals|Write normals to debug .txt files.}}
:Don't bring up graphical UI on vproject errors.
{{CLParam|-debugextra|Places debugging data in lightmaps to visualize supersampling.}}
;<code>-dump</code>
{{CLParam|-dlightmap|Force direct lighting into different lightmap than radiosity.}}
:Write debugging .txt files.
{{CLParam|-stoponexit|Wait for a keypress on exit.}}
;<code>-dumpnormals</code>
{{CLParam|-nodetaillight|Don't light detail props.}}
:Write normals to debug files.
{{CLParam|-centersamples|Move sample centers.}}
;<code>-debugextra</code>
{{CLParam|-loghash|Log the sample hash table to samplehash.txt.}}
:Places debugging data in lightmaps to visualize supersampling.
{{CLParam|-onlydetail|Only light detail props and per-leaf lighting.}}
;<code>-dlightmap</code>
{{CLParam|-maxdispsamplesize|param=int|Set max displacement sample size (default: 512).}}
:Force direct lighting into different lightmap than radiosity.
{{CLParam|-FullMinidump|Write large minidumps on crash.}}
;<code>-stoponexit</code>
{{CLParam|-OnlyStaticProps|Only perform direct static prop lighting.}}
:Wait for a keypress on exit.
{{CLParam|-StaticPropNormals|When lighting static props, just show their normal vector.}}
;<code>-nodetaillight</code>
{{CLParam|-noskyboxrecurse|Turn off recursion into 3d skybox (skybox shadows on world).}}
:Don't light detail props.
{{CLParam|-nossprops|Globally disable self-shadowing on static props.}}
;<code>-centersamples</code>
{{CLParam|-dumppropmaps|Dump computed static prop lightmaps as [[TGA]] files.{{tip|This can be used to create lightmaps for dynamic props, using the {{ent|$lightmap}} shader parameter.}}{{tip|To pair static props in a map with their dumped lightmaps, use {{Cmd|r_staticpropinfo|2}} to show static prop IDs on screen.}}{{bug|hidetested=1|The resulting TGAs are written with the wrong color space {{fixed|{{gmod}}}}; convert the resulting [[PPL]] files instead. This command can be useful for indicating which model and at what location each prop is, which the PPL filenames lack.}} |game={{since|{{src13mp}}}}{{also|{{gmod}}}}}}
:Move sample centers.
}}
;<code>-loghash</code>
 
:Log the sample hash table to samplehash.txt.
=== Debug mode options ===
;<code>-onlydetail</code>
If VRAD is compiled in debug mode or the <code>#if ALLOWDEBUGOPTIONS</code> preprocessor is removed, additional options are available.
:Only light detail props and per-leaf lighting.
{{CLParam|-scale|param=float|Scale lighting by this value.}}
;<code>-maxdispsamplesize #</code>
{{CLParam|-ambient|param=color1|Apply a minimum ambient lighting value to the map.}}
:Set max displacement sample size (default: 512).
{{CLParam|-sky|param=float|{{clarify}}}}
;<code>-FullMinidump</code>
{{CLParam|-notexscale|param=|{{clarify}}}}
:Write large minidumps on crash.
{{CLParam|-coring|param=float|Luxels with values dimmer than this are treated as completely black, and don't get supersampled.}}
;<code>-OnlyStaticProps</code>
:Only perform direct static prop lighting (vrad debug option)
;<code>-StaticPropNormals</code>
:When lighting static props, just show their normal vector


==Lights files==
==Lights files==
{{main|RAD file#Source 1}}
<!-- This section is kept here due to having a lot of links to it, including from external sites -->
==Console output ==
{{todo|Add description about missing outputs output (BuildVisLeafs, other)}}
== Bugs and caveats ==
{{warning|VRAD does not compile shadows based on transparent/translucent brushes or displacements. If you must have shadows made by a brush (such as a fence texture), you can turn the brush into a prop via {{sourceio|4.1}}, {{crafty|4.1}} or [[Hammer++/Propper++|Propper++]] and put it into the [[RAD file]] or compile with {{ent|$casttextureshadows}}. Alternatively, use an existing fence prop or the "blocklight" [[tool texture]].
{{tip|{{slamminsrc|only}} You can use -worldtextureshadows to make vrad compile shadows based on brush alpha channels (but not displacements).}}}}
{{warning|VRAD will use 100% of your CPU unless specified otherwise with the -threads # launch option.}}


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]].
{{bug|hidetested=1|In {{src06}} and {{l4d}}, users seeing crashes when VRAD compiles HDR lighting should read [[VRAD HDR Crash Fix]].}}


There are:
{{bug|tested={{src13}}|In games before {{l4d}}, {{mono|.mdl}} files that don't have {{mono|.dx80.vtx}} files with them will lead to VRAD skipping lighting for that prop. Copying the {{mono|.dx90.vtx}} file and renaming it to a {{mono|.dx80.vtx}} will fix the issue.{{Tip|A windows batch file to do this automatically has been created [https://github.com/Jacobdeanr/L4D-Dx80-PropFix/releases here], extract the zip contents into your game's models folder and run the included .ps1 file.}}{{Note|{{Dmmm}} is exempt from this issue.}} }}


#'''<code>lights.rad</code>''', the global file.
{{bug|hidetested=1|{{mono|.mdl}} files that have the {{mono|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 {{mono|IDST0}} in a Hex Editor, or by recompiling the prop in a non-L4D branch [[Studiomdl]] application such as Source 2013.}}
#'''An auto-loaded map light file''', using the format <code><map name>.rad</code>.
#'''Any number of additional lights files''' that can be added with [[#Effects|the <code>-lights</code> parameter]].


=== Rules ===
{{bug|tested={{src13}}|Since the release of Source SDK 2013 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]. This issue is fixed in {{csgo}}, {{l4d2}}, {{tf2}}, {{gmod}} and {{mapbase}}.
{{todo|Is this fixed in {{slamminsrc}}? Also in Source 2007 and earlier, and Alien Swarm SDK, {{code|raytrace.cpp}} isn't present so check if these versions also have the bug or not.
}}}}


Lights files perform these functions, one rule per line:


;<code><material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity></code>
{{bug|hidetested=1|Randomly causes corrupt lightmaps that look like "ink spills" or light splotches. These can be mostly avoided by not using very long or diagonal brushes, as well as not having too low of a light level in your indoor areas.
: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.}}
: {{tip|[https://github.com/Enderlux/sourcelightmap Source Engine BSP Lightmap Editor] can be used to manually correct a {{mono|.bsp}} lightmap data.}}}}
;<code>noshadow <material name></code>
 
:Prevents the named material from casting shadows.
{{note|If you are watching the compile dialog and it looks like it has hung at ''{{mono|9...}}'' this is usually because VRAD takes longer with each calculation.{{clarify|1=This isn't due to bounce calculations.<sup>[https://developer.valvesoftware.com/w/index.php?title=VRAD/en&diff=389410&oldid=389397]</sup>}} }}
;<code>forcetextureshadow <model name>.mdl</code>
 
:Enables translucency shadow testing for a model when VRAD is run with <code>[[#Effects|-TextureShadows]]</code>.
{{bug|tested={{hl2dm}}|VRAD is unable to calculate texture shadows for textures using DXT3 compression. Use DXT5 instead.}}
;<code><nowiki>ldr:</nowiki></code>
 
;<code><nowiki>hdr:</nowiki></code>
{{note|Super sampling is not implemented on [[displacements]] (before {{csgo}}) and [[lightmapped props]]. The former is fixed in {{slammin|2}}. }}
:Prefixes to make any rule only apply to LDR or HDR lighting.


==See also ==
==See also ==
* [[QRAD]] and [[HLRAD]] - {{gldsrc|4}} counterparts.
* [[VRAD_(Source 2)|VRAD2 & VRAD3]] - {{source2|4}} counterparts.
* [[Map Compiling Theory]]
* [[Map Compiling Theory]]
* [[HDR Lighting Basics]]
* [[HDR Lighting Basics]]
* [[VBSP]]
* [[VVIS]]
* [[VRAD HDR Crash Fix]]
* [[VRAD HDR Crash Fix]]
* [[Static Props show up black]]
{{SDKTools}}


[[Category:Tools]]
[[Category:Official Source Tools]]
[[Category:Level Design]]
[[Category:Source 1 BSP compilers]]
[[Category:Glossary]]
[[Category:RAD]]

Latest revision as of 16:54, 30 August 2025

English (en)Español (es)Русский (ru)中文 (zh)Translate (Translate)

VBSPVVISVRADBSPZIP

VRAD VRAD is the command-line tool for Source Source that takes a compiled BSP map and embeds lighting data into it. VRAD's static and pre-compiled light is bounced around the world with a Wikipedia icon radiosity algorithm.

VRAD will:

VRAD is generally the slowest of the three compilers due to the many, many calculations it must perform. Lighting optimization can help, as can ensuring your map is free of leaks.

Syntax

vrad [options...] <bsp file>

For example, a regular compile would look like thus:

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

This will generate and embed both Standard and High Dynamic Range lighting data, at per-vertex detail for prop_static entities. It also generates shadows based on transparency for prop_static entities that have been flagged as casting texture shadows.

Options

Use these in combination with expert compile mode, a batch file, or a frontend such as Compile Pal Compile Pal.

Todo: Fix CLParam template. This template does not work properly with gallery and bug template.
Todo: Add line breaks (<br>) in the larger descriptions where appropriate, to improve legibility.

Effects

-ldr
-hdr
-both
Whether to compile Standard Dynamic Range lighting (referred to as "Low Dynamic Range lighting" in Source), High Dynamic Range lighting, or both respectively.
Note.pngNote:Since Left 4 Dead, SDR support was deprecated. Thus making -ldr and -both obsolete in engine branches made on or after Left 4 Dead. Instead, -hdr is required in order to produce proper lighting for your map.
Note.pngNote:Black MesaSlammin' Source Map Tools default to compiling only HDR automatically.
Icon-Important.pngImportant:In engine branches prior to Left 4 Dead engine branch (including Source 2013), loading a map compiled with -hdr only when HDR is disabled will result in mat_fullbright 1 being forced on, which applies to all subsequent maps until cheats are enabled. This does not affect maps compiled with -ldr only. As such, final distributables for pre-Left 4 Dead multiplayer games should be compiled in -both or -ldr to prevent giving fullbright cheats to users with HDR enabled; -hdr can still be useful for faster iteration in development compiles.
-fast
Compiles quick low quality lighting. Used for quick previewing.
Note.pngNote:-fast will cause random and discolored splotching to appear in darker areas, as well as shadowed edges around Displacements. It is advised to not ship your map using -fast.
Tip.pngTip:If you have a relatively modern CPU, you can try using other parameters to reduce the standard compile time instead. For example:-fastambient -bounce 1 -noextra -nodetaillight -noskyboxrecurse instead of -fast
-final
Increases the quality of light_environment and indirect lighting by spending more time firing rays.
Counter-Strike: Global Offensive,Garry's Mod Sets-StaticPropSampleScale to 16.
Slammin' Source Map Tools Sets-aosamples to 32, -extrasky to 16, and -extrapasses to 8.
-extrasky <integer>
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 RAD file in addition to lights.rad and the map-specific lights file. Include the file extension in the parameter.
-bounce <integer>
Set the maximum number of light ray bounces. (default: 100).
-smooth <integer>
Set the threshold for automatic phong smoothing of lightmaps between edges, in degrees (default: 45). Use smoothing groups to explicitly define faces as phonged together.
-luxeldensity <normal>
Scale down all luxels. Default (and maximum) value is 1.
Warning.pngWarning:Setting too low of a value will cause lighting errors.
-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 for light_environment, use that instead.
-StaticPropLighting  (in all games since Source 2007)
Generate per-vertex lighting on prop_statics. Causes lightingorigin on static props props without $bumpmap or $phong to not affect lighting (only affecting chosen env_cubemap), unless the disablevertexlighting KV is set for the prop. This will increase your map's compile times substantially, based on the amount of props that you have! Disable vertex lighting for props that don't need it to keep compile times down. Static props which are close to bright light_spot entities will still appear as if they were lit per-vertex, due to the lights creating directional elights.
(only in Source 2013 Multiplayer Team Fortress 2 branch Garry's Mod) It also generates lightmaps for static props that have generatelightmaps enabled in supported engines.
Icon-Bug.pngBug:In all games prior to Counter-Strike: Global Offensive, VRAD uses a faulty algorithm for calculating indirect vertex lighting on props. In games based on Source 2013 Multiplayer and Team Fortress 2 branch, the lighting tends to be unnaturally dark or harsh, while in games based on older branches (Source 2013 Singleplayer & Orange Box branch) it's too bright. A pull request to address this has been submitted.
Warning.pngWarning:In Black Mesa Black Mesa, you should use -StaticPropLighting3 instead.
Icon-Important.pngImportant: Does not work on props with bump maps, except in Counter-Strike: Global Offensive Counter-Strike: Global Offensive.
Note.pngNote: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 Source 2007)
Use the actual meshes of static props to generate shadows instead of using their collision meshes. This results in far more accurate shadowing.
-StaticPropPolys - Examples
-textureshadows  (in all games since Source 2007)
Casts texture shadows from $alphatest and $translucent surfaces of prop_static models that are specified in a RAD file or were compiled with $casttextureshadows. Usually requires -StaticPropPolys to have any effect. A surface will need a low lightmap scale for most texture shadows to be recognizable. Nonetheless, textures such as grate fences, foliage, and barbed wire will still cast noticeably more accurate shadows with this command enabled compared to disabled. Garry's ModMapbase Also casts shadows from model materials with %alphatexture.
-textureshadows - Examples


Note.pngNote:(only in Black Mesa) Also generates lightmap shadows from brushes (but not displacements) using $alphatest.
Icon-Bug.pngBug:Not compatible with $envmap env_cubemap; manually define the $envmap path instead.  (tested in: Black Mesa)
Icon-Bug.pngBug:Static props with multiple skins will always use the alpha channel(s) from the default skin's texture(s), even though the alternative skins' alpha textures are loaded by VRAD.
This will not work if a translucent texture's $basetexture parameter in the VMT contains the .vtf file extension; file extensions should be omitted from texture paths in VMTs.  (tested in: Day of Defeat: SourceSource 2013 Multiplayer)

Game/Compiler Specific Parameters

Counter-Strike: Global Offensive Counter-Strike: Global Offensive

-aoscale <float> (in all games since Counter-Strike: Global Offensive)(also in Slammin' Source Map ToolsGarry's Mod)
Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default.
Tip.pngTip:Valve uses 1.5 for Dust 2.
-aoscale - Examples
-StaticPropBounce <integer> (only in Counter-Strike: Global Offensive)(also in Garry's Mod)
Number of static prop light bounces to simulate. The default is 0.
Tip.pngTip:Valve uses 3 static prop bounces for Dust 2.
Note.pngNote:Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.
-StaticPropLightingFinal  (only in Counter-Strike: Global Offensive)
Obsolete Merged with -final.
-StaticPropLightingOld  (only in Counter-Strike: Global Offensive)
Will use the old lighting algorithm on props, light affects them much more.
-ambient <color1> (only in Counter-Strike: Global OffensiveDark Messiah of Might and MagicSlammin' Source Map Tools)
Sets the ambient term. Can be used to tweak lightmap color. Appears to just mix the color into all lightmaps.
Also available in Source 2013 Source 2013 if VRAD is compiled in debug mode
-unlitdetail  (only in Counter-Strike: Global Offensive)
Disables lighting for detail props.
-ambientfromleafcenters  (only in Counter-Strike: Global Offensive)
Samples ambient lighting from the center of the leaf.
-StaticPropSampleScale <float> (only in Counter-Strike: Global Offensive)(also in Garry's Mod)
Extra sampling factor for indirect lighting on prop_static.
slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
Note.pngNote:-final is the equivalent of having -StaticPropSampleScale 16.
-LeafAmbientSampleReduction <float> (only in Counter-Strike: Global Offensive)
Reduction factor for ambient samples. Defaults to 1.0.

Garry's Mod Garry's Mod

-aofacesamples <integer> (only in Garry's Mod)
Adjust number of AO face samples for brushes. Default is 32, -final is 128, -fast is 16.
-aopropsamples <integer> (only in Garry's Mod)
Adjust number of AO face samples for props. Default is 16, -final is 32, -fast is 12.
-aoNoSquare  (only in Garry's Mod)
Disables squaring of ambient occlusion, making it look less harsh. Default is on (more harsh).
-bounceFromNamed  (only in Garry's Mod)
Forces named and styled lights to cast bounced lighting. Note that this will increase lightmap usage!

Black Mesa Black Mesa

-StaticPropLighting3  (only in Black Mesa)
This is a more precise and less buggy version of -StaticPropLighting.
-choptexlights  (only in Black Mesa)
Enables chopping of texture lights generated from a lights file. Control texture light quality with lightmap density in Hammer. Dramatically increases both texture light quality and compile time.
-extratransfers  (only in Black Mesa)
Enable overscaling of light transfers.
-transferscale <float> (only in Black Mesa)
This is the scale factor of light transfers. Increased values make surfaces transfer extra light (scale of 2-4 suggested). Default 1.0.
-satthresh <float> (only in Black Mesa)
This is the threshold that checks how saturated a material color is. Used with -satthreshscale. Default 0.4.
-satthreshscale <float> (only in Black Mesa)
The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.
-ambientocclusion  (only in Black Mesa)(also in Slammin' Source Map ToolsGarry's Mod)
Enable lightmapped ambient occlusion.
Tip.pngTip:Use very low lightmap scale for small stairs or add additional light sources to light them, otherwise stairs will be completely black.
-ambientocclusion Examples


-experimentalambientocclusion  (only in Black Mesa)
Uses an improved algorithm for ambient occlusion.
ObsoleteBroken. Don't use.
-experimentalambientocclusion Examples


-cascadeshadows  (only in Black Mesa)
Indicates that lightmap alpha data is interleved in the lighting lump, required for CSM.
Must be used with -StaticPropLighting3 to have proper lighting of static props.
-cascadeshadows Examples


-realskylight  (only in Black Mesa)
Enables VRAD to compute skylight ambient color by using actual values from skybox.
This option was originally designed only for levels in Xen, to make lighting for islands more natural. With earthbound outdoor levels this option makes level lighting weird, especially if level uses a skybox with an open, clear sky.
-realskylight Examples


-realskylightscale <float> (only in Black Mesa)
Scale factor of -realskylight intensity. Default: 1.0
-directsunlightisforadditivemode  (only in Black Mesa)
Toggles direct sunlight for additive mode.
Icon-Bug.pngBug:This option is not compatible with cascaded shadows.  (tested in: Black Mesa)
-directsunlightisforadditivemode Examples


Strata Source Strata Source

-aoradius <float> (only in Strata SourceInsurgency Day of Infamy)
Set the radius of VRAD's simulated ambient occlusion. 36 is default.
-aosamples <integer> (only in Strata SourceInsurgency Day of Infamy)(also in Slammin' Source Map Tools)
How many samples to use for VRAD's simulated ambient occlusion.
-PortalTraversalLighting  (only in Strata Source)
Enables static lights to go through linked_portal_door, if Static Portal value is Yes.
-PortalTraversalLighting Examples


-PortalTraversalAO  (only in Strata Source)
Enables static light Ambient Occlusion to go through linked_portal_door, if Static Portal value is Yes.
-PortalTraversalAO Examples


Slammin' Source Map Tools Slammin' Source Map Tools

-softenCosine  (only in Slammin' Source Map Tools)(also in Garry's Mod)
Softens coloured lighting so it blends more accurately.
-worldtextureshadows  (only in Slammin' Source Map Tools)
Allows world polys to cast texture shadows, much like models can.
Icon-Bug.pngBug:Doesn't work with displacements, and certain file formats might not cast shadows!  (tested in: Source 2013)
-worldtextureshadows Examples
-translucentshadows  (only in Slammin' Source Map Tools)
Enables -worldtextureshadows on $translucent surfaces. As by default only $alphatest surfaces cast baked shadows.
Icon-Bug.pngBug:Doesn't work with displacements, and certain file formats might not cast shadows!  (tested in: Source 2013)
-translucentshadows Examples
-coring <float> (only in Slammin' Source Map Tools)
Luxels with values dimmer than this are treated as completely black, and don't get supersampled.
Also available in Source 2013 Source 2013 if VRAD is compiled in debug mode
-reflectivityScale <float> (only in Slammin' Source Map Tools)
Scale the $reflectivity of all textures. Default 1.0

Mapbase Mapbase

-ultrafast  (only in Mapbase)
Merges '-fast -fastambient -noextra -bounce 1' commands into one, reduces compile time, useful for testing large maps.
-extrapasses  (only in Mapbase)
Lets you scale how many extra passes you want your map to go through for supersampling, useful for making the lightmaps more rgb constant.

Half-Life 2 Half-Life 2 20th and Portal Portal (May 20 update)

Note.pngNote:Also available in Half-Life: Source (since Half-Life 2 20th Anniversary Update) and Portal (May 20, 2025 update).
-HL2LDRAmbientClassic  (only in Half-Life 2) 20th
Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)
-HL2LDRAmbientFix  (only in Half-Life 2) 20th
Use adjusted LDR ambient lighting constant for HDR re-lit maps (Post Xbox 360/Orange Box HL2 VMFs only)

Performance

-low
Run as a low-priority process.
-threads <integer>
Override the number of CPU threads used. Maximum is 16 threads (32 in Counter-Strike: Global OffensiveSlammin' Source Map ToolsMapbase, unlimited in Team Fortress 2)
PlacementTip.pngWorkaround:With a patched vrad_dll you can use 32 threads. Left 4 Dead 2 fixtoolthreads is a patch for VRAD (and VVIS) that supports unlimited threads and fixes a thread scaling issue.
Note.pngNote:The above mentioned thread scaling issue has been fixed in Team Fortress 2,Counter-Strike: Global Offensive,Left 4 Dead 2,Garry's Mod.
Tip.pngTip:If you know that the compile time will be very long and would rather do something else while waiting, it may be useful to specify a number of threads 1 or 2 lower than what your CPU has. This allows the computer to allocate some more power to other applications, making it less choppy while lighting is being compiled. Keep in mind that this may slightly extend your compile time.
-mpi
Use VMPI to distribute computations.
-mpi_pw <string>
Use a password to choose a specific set of VMPI workers.
-noextra
Disable supersampling. This will lead to blockier, less accurate lighting.
-chop <integer>
Smallest number of luxel widths for a bounce patch, used on edges. (Default: 4)
-maxchop <integer>
Coarsest allowed number of luxel widths for a patch, used in face interiors. (Default: 4)
-dispchop <integer>
Smallest acceptable luxel width of displacement patch face. (Default: 8)
-LargeDispSampleRadius
This can be used if there are (dark) splotches of bounced light on terrain. The compile will take longer, but it will gather light across a wider area.
-compressconstant <integer>
Compress lightmaps whose color variation is less than this many units.
Todo: Find out if this is branch specific, as it doesn't work with TF2.
-fastambient
Uses low quality per-leaf ambient sampling to save compute time.
-noao  (only in Insurgency Day of Infamy)
Disables compiling simulated ambient occlusion for lightmaps.
-disppatchradius <float>
Sets the maximum radius allowed for displacement patches. If you get "Patch Sample Radius Clamped", you can try increasing this limit.

Debugging

-rederrors
Emit red light when "a luxel has no samples".
-vproject <directory>
-game <directory>
Override the VPROJECT environment variable.
-insert_search_path <directory>
Includes an extra base directory for mounting additional content (like Gameinfo.txt entries). Useful if you want to separate some assets from the mod for whatever reason.
-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 <integer>
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 2013 Multiplayer)(also in Garry's Mod)
Dump computed static prop lightmaps as TGA files.
Tip.pngTip:This can be used to create lightmaps for dynamic props, using the $lightmap shader parameter.
Tip.pngTip:To pair static props in a map with their dumped lightmaps, use r_staticpropinfo 2 to show static prop IDs on screen.
Icon-Bug.pngBug:The resulting TGAs are written with the wrong color space (fixed in Garry's Mod); convert the resulting PPL files instead. This command can be useful for indicating which model and at what location each prop is, which the PPL filenames lack.

Debug mode options

If VRAD is compiled in debug mode or the #if ALLOWDEBUGOPTIONS preprocessor is removed, additional options are available.

-scale <float>
Scale lighting by this value.
-ambient <color1>
Apply a minimum ambient lighting value to the map.
-sky <float>
[Clarify]
-notexscale
[Clarify]
-coring <float>
Luxels with values dimmer than this are treated as completely black, and don't get supersampled.

Lights files

Main article:  RAD file#Source 1

Console output

Todo: Add description about missing outputs output (BuildVisLeafs, other)

Bugs and caveats

Warning.pngWarning:VRAD does not compile shadows based on transparent/translucent brushes or displacements. If you must have shadows made by a brush (such as a fence texture), you can turn the brush into a prop via SourceIO SourceIO, Crafty Crafty or Propper++ and put it into the RAD file or compile with $casttextureshadows. Alternatively, use an existing fence prop or the "blocklight" tool texture.
Tip.pngTip:(only in Slammin' Source Map Tools) You can use -worldtextureshadows to make vrad compile shadows based on brush alpha channels (but not displacements).
Warning.pngWarning:VRAD will use 100% of your CPU unless specified otherwise with the -threads # launch option.
Icon-Bug.pngBug:In Source 2006 and Left 4 Dead, users seeing crashes when VRAD compiles HDR lighting should read VRAD HDR Crash Fix.
Icon-Bug.pngBug:In games before Left 4 Dead, .mdl files that don't have .dx80.vtx files with them will lead to VRAD skipping lighting for that prop. Copying the .dx90.vtx file and renaming it to a .dx80.vtx will fix the issue.
Tip.pngTip:A windows batch file to do this automatically has been created here, extract the zip contents into your game's models folder and run the included .ps1 file.
Note.pngNote:Dark Messiah of Might and Magic is exempt from this issue.
  (tested in: Source 2013)
Icon-Bug.pngBug:.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.
Icon-Bug.pngBug:Since the release of Source SDK 2013 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. This issue is fixed in Counter-Strike: Global Offensive, Left 4 Dead 2, Team Fortress 2, Garry's Mod and Mapbase.
Todo: Is this fixed in Slammin' Source Map Tools? Also in Source 2007 and earlier, and Alien Swarm SDK, raytrace.cpp isn't present so check if these versions also have the bug or not.
  (tested in: Source 2013)


Icon-Bug.pngBug:Randomly causes corrupt lightmaps that look like "ink spills" or light splotches. These can be mostly avoided by not using very long or diagonal brushes, as well as not having too low of a light level in your indoor areas.
Tip.pngTip:Source Engine BSP Lightmap Editor can be used to manually correct a .bsp lightmap data.
Note.pngNote: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 calculation.
Clarify: This isn't due to bounce calculations.[1]
Icon-Bug.pngBug:VRAD is unable to calculate texture shadows for textures using DXT3 compression. Use DXT5 instead.  (tested in: Half-Life 2: Deathmatch)
Note.pngNote:Super sampling is not implemented on displacements (before Counter-Strike: Global Offensive) and lightmapped props. The former is fixed in Slammin' Source Map Tools Slammin' Source Map Tools.

See also