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
No edit summary
Line 33: Line 33:
=== Effects ===
=== Effects ===
{{Todo|Split some of the game-specific options into their own page section.}}
{{Todo|Split some of the game-specific options into their own page section.}}
{{ColumnBox|count=1|1={{IO|-ldr}}
{{ColumnBox|count=1|1={{CLIO|ldr}}
{{IO|-hdr}}
{{CLIO|hdr}}
{{IO|-both|Whether to compile Standard Dynamic Range lighting (''referred as'' "Low Dynamic Range lighting" in Source), [[HDR|High Dynamic Range]] lighting, or both respectively.
{{CLIO|both|Whether to compile Standard Dynamic Range lighting (''referred 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|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.}}}}
: {{note|{{bms}}{{slamminsrc}} default to compiling only HDR automatically.}}}}
{{IO|-fast|Compiles quick low quality lighting.  Used for quick previewing.
{{CLIO|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}}}}}}}}
: {{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}}}}}}}}
{{IO|-final|Increases the quality of {{Ent|light_environment}} and indirect lighting by spending more time firing rays.<br>{{csgo}} Sets{{mono|-StaticPropSampleScale}} to 16.}}
{{CLIO|final|Increases the quality of {{Ent|light_environment}} and indirect lighting by spending more time firing rays.<br>{{csgo}} Sets{{mono|-StaticPropSampleScale}} to 16.}}
{{IO|-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}})}}
{{CLIO|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}})}}
{{IO|-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.}}
{{CLIO|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.}}
{{IO|-bounce|param=int|Set the ''maximum'' number of light ray bounces. (default: 100).}}
{{CLIO|bounce|param=int|Set the ''maximum'' number of light ray bounces. (default: 100).}}
{{IO|-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.
{{CLIO|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.
{{IO|-luxeldensity|param=normal|Scale down all luxels. Default (and maximum) value is 1. {{warning|Setting too low of a value will cause lighting errors.}}}}
{{CLIO|luxeldensity|param=normal|Scale down all luxels. Default (and maximum) value is 1. {{warning|Setting too low of a value will cause lighting errors.}}}}
{{IO|-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.}}
{{CLIO|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.}}
{{IO|-StaticPropLighting|Generate per-vertex lighting on {{Ent|prop_static}}s; always enabled for {{Ent|light_spot}} entities. Disables {{Ent|info_lighting}} entities on props without [[$bumpmap]] or [[$phong]], unless the {{code|disablevertexlighting}} KV is set for the prop. Does not work on props with bump maps, except in {{csgo}}.  
{{CLIO|StaticPropLighting|Generate per-vertex lighting on {{Ent|prop_static}}s; always enabled for {{Ent|light_spot}} entities. Disables {{Ent|info_lighting}} entities on props without [[$bumpmap]] or [[$phong]], unless the {{code|disablevertexlighting}} KV is set for the prop. Does not work on props with bump maps, except in {{csgo}}.  
: {{note|{{only|{{src13mp}} {{tf2branch}}}}{{gmod|also}} Also generates lightmaps for static props that have {{code|[[prop_static#Keyvalues|generatelightmaps]]}} enabled.}}
: {{note|{{only|{{src13mp}} {{tf2branch}}}}{{gmod|also}} Also generates lightmaps for static props that have {{code|[[prop_static#Keyvalues|generatelightmaps]]}} enabled.}}
: {{Warning|This can increase your map's compile times substantially. Disable vertex lighting for props that don't need it to keep compile times down.}}
: {{Warning|This can increase your map's compile times substantially. Disable vertex lighting for props that don't need it to keep compile times down.}}
: {{note|In {{csgo}}, in order to get proper lighting on your static props, you will need to run VRAD with this command.}}|since={{Src07}}}}
: {{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}}}}}}
: {{bug|Not compatible with [[env_cascade_light|Cascade Shadow Mapping]] in {{bms|4}}, doesn't work properly with static prop if vertex lighting is enabled.{{workaround|Use {{code|-StaticPropLighting3}} instead.}}}}
: {{bug|Not compatible with [[env_cascade_light|Cascade Shadow Mapping]] in {{bms|4}}, doesn't work properly with static prop if vertex lighting is enabled.{{workaround|Use {{code|-StaticPropLighting3}} instead.}}}}
{{IO|-StaticPropLighting3|This is a more precise and less buggy version of {{code|-StaticPropLighting}}.|only=BMS}}
{{CLIO|StaticPropLighting3|This is a more precise and less buggy version of {{code|-StaticPropLighting}}.|game={{only|{{BMS}}}}}}
{{IO|-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.|since={{Src07}}}}
{{CLIO|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>
{{expand|title=-StaticPropPolys - Examples|<gallery mode=nolines widths=320px heights=192px>
File:Polys1.jpg|Disabled.
File:Polys1.jpg|Disabled.
Line 60: Line 60:
}}
}}
}}
}}
{{IO|-textureshadows|Generates lightmap shadows from {{cmd|$alphatest}} and {{cmd|$translucent}} surfaces of {{ent|prop_static}} models that are specified in a [[RAD file]] or were compiled with {{ent|$casttextureshadows}}. Usually requires {{mono|-StaticPropPolys}} to have any effect.
{{CLIO|textureshadows|Generates lightmap shadows from {{cmd|$alphatest}} and {{cmd|$translucent}} surfaces of {{ent|prop_static}} models that are specified in a [[RAD file]] or were compiled with {{ent|$casttextureshadows}}. Usually requires {{mono|-StaticPropPolys}} to have any effect.
{{expand|title=-textureshadows - Examples|
{{expand|title=-textureshadows - Examples|
<br>
<br>
Line 71: Line 71:
: {{note|A surface will need a low [[lightmap]] scale for most texture shadows to be recognizable.<br>Nonetheless, textures such as grate fences, foliage, and barbed wire will still cast noticeably more accurate shadows with this command enabled compared to disabled.}}
: {{note|A surface will need a low [[lightmap]] scale for most texture shadows to be recognizable.<br>Nonetheless, textures such as grate fences, foliage, and barbed wire will still cast noticeably more accurate shadows with this command enabled compared to disabled.}}
: {{warning|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.}}
: {{warning|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.}}
: {{bug|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. |tested={{dods}}}}|since={{Src07}}}}
: {{bug|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. |tested={{dods}}}}|game={{since|{{Src07}}}}}}
{{IO|-aoscale|param=float|Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default.
{{CLIO|aoscale|param=float|Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default.
: {{Tip|Valve uses 1.5 for the new Dust 2.}}|since=CSGO|also={{slamminsrc}},{{gmod}}}}
: {{Tip|Valve uses 1.5 for the new Dust 2.}}|game={{since|{{csgo}}}}{{also|{{slamminsrc}}{{gmod}}}}}}
{{expand|title=-aoscale - Examples|<gallery mode=nolines widths=320px heights=192px>
{{expand|title=-aoscale - Examples|<gallery mode=nolines widths=320px heights=192px>
File:VRAD AO Scale 0.25.jpg|{{code|-aoscale}} set to {{code|0.25}}
File:VRAD AO Scale 0.25.jpg|{{code|-aoscale}} set to {{code|0.25}}
Line 79: Line 79:
</gallery>
</gallery>
}}
}}
{{IO|-aoradius|param=float|Set the radius of VRAD's simulated ambient occlusion. 36 is default.|only={{Nwi_games}}{{Strata}}}}
{{CLIO|aoradius|param=float|Set the radius of VRAD's simulated ambient occlusion. 36 is default.|game={{only|{{Nwi_games}}{{Strata}}}}}}
{{IO|-aosamples|param=int|How many samples to use for VRAD's simulated ambient occlusion.|only={{Nwi_games}}|also={{slamminsrc}}{{Strata}}}}
{{CLIO|aosamples|param=int|How many samples to use for VRAD's simulated ambient occlusion.|game={{only|{{Nwi_games}}{{slamminsrc}}{{Strata}}}}}}
{{IO|-StaticPropBounce|param=int|Number of static prop light bounces to simulate. The default is 0.
{{CLIO|StaticPropBounce|param=int|Number of static prop light bounces to simulate. The default is 0.
: {{Tip|Valve uses 3 static prop bounces for the new Dust 2.}}
: {{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.}}|only=CSGO|also={{gmod}}}}
: {{Note|Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.}}|game={{only|{{csgo}}{{gmod}}}}}}
{{IO|-StaticPropLightingFinal|{{obs}} Merged with {{mono|-final}}.|only=CSGO}}
{{CLIO|StaticPropLightingFinal|{{obs}} Merged with {{mono|-final}}.|only=CSGO}}
{{IO|-StaticPropLightingOld|Will use the old lighting algorithm on props, light affects them much more.|only=CSGO}}
{{CLIO|StaticPropLightingOld|Will use the old lighting algorithm on props, light affects them much more.|game={{only|{{csgo}}}}}}
{{IO|-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.|only=BMS}}
{{CLIO|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}}}}}}
{{IO|-extratransfers|Enable overscaling of light transfers.|only=BMS}}
{{CLIO|extratransfers|Enable overscaling of light transfers.|game={{only|{{BMS}}}}}}
{{IO|-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.|only=BMS}}
{{CLIO|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}}}}}}
{{IO|-satthresh|param=float|This is the threshold that checks how saturated a material color is. Used with {{mono|-satthreshscale}}. Default 0.4.|only=BMS}}
{{CLIO|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}}}}}}
{{IO|-satthreshscale|param=float|The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.|only=BMS}}
{{CLIO|satthreshscale|param=float|The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.|game={{only|{{BMS}}}}}}
{{IO|-ambientocclusion|Enable lightmapped ambient occlusion.
{{CLIO|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.}}
{{tip|Use very low lightmap scale for small stairs or add additional light sources to light them, otherwise stairs will be completely black.}}
|only=BMS|also={{slamminsrc}},{{gmod}}}}
|game={{only|{{BMS}}{{slamminsrc}}{{gmod}}}}}}
{{expand|title=Examples|
{{expand|title=Examples|
<br>
<br>
Line 101: Line 101:
</gallery>
</gallery>
}}
}}
{{IO|-experimentalambientocclusion|Use an improved algorithm for the ambient occlusion.
{{CLIO|experimentalambientocclusion|Use an improved algorithm for the ambient occlusion.
{{warning|Broken. Not being used.}}
{{warning|Broken. Not being used.}}
|only=BMS}}
|game={{only|{{BMS}}}}}}
{{expand|title=Expriemental AO examples|
{{expand|title=Expriemental AO examples|
<br>
<br>
Line 111: Line 111:
</gallery>
</gallery>
}}
}}
{{IO|-cascadeshadows|Indicates that lightmap alpha data is interleved in the lighting lump, required for CSM.
{{CLIO|cascadeshadows|Indicates that lightmap alpha data is interleved in the lighting lump, required for CSM.
{{important|Must be used with <code>-StaticPropLighting3</code> to have proper lighting of static props.
{{important|Must be used with <code>-StaticPropLighting3</code> to have proper lighting of static props.
{{expand|title=Examples|
{{expand|title=Examples|
Line 121: Line 121:
}}
}}
}}
}}
|only=BMS}}
|game={{only|{{BMS}}}}}}
{{IO|-realskylight|Enables VRAD to compute skylight ambient color by using actual values from skybox.
{{CLIO|realskylight|Enables VRAD to compute skylight ambient color by using actual values from skybox.
{{note|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.}}
{{note|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|
{{expand|title=-realskylight - Examples|
Line 132: Line 132:
}}
}}
|only=BMS}}
|only=BMS}}
{{IO|-realskylightscale|param=float|Scale factor of -realskylight intensity. Default: 1.0|only=BMS}}
{{CLIO|realskylightscale|param=float|Scale factor of -realskylight intensity. Default: 1.0|game={{only|{{BMS}}}}}}
{{IO|-directsunlightisforadditivemode|Toggles direct sunlight for additive mode.
{{CLIO|directsunlightisforadditivemode|Toggles direct sunlight for additive mode.
:{{bug|This option is not compatible with cascade shadows.
:{{bug|This option is not compatible with cascade shadows.
:{{expand|title=An example.|
:{{expand|title=An example.|
Line 142: Line 142:
}}
}}
}}
}}
|only=BMS}}
|game={{only|BMS}}}}
{{IO|-ambient|param=vector|Sets the ambient term. Can be used to tweak lightmap color. Appears to just mix the color into all lightmaps.|only=CSGO|also={{Dmmm}}{{slamminsrc}}}}
{{CLIO|ambient|param=vector|Sets the ambient term. Can be used to tweak lightmap color. Appears to just mix the color into all lightmaps.|game={{only|{{csgo}}{{Dmmm}}{{slamminsrc}}}}}}
{{IO|-PortalTraversalLighting|Enables static lights to go through {{ent|linked_portal_door}}, if <code>Static Portal</code> value is <code>Yes</code>.|only={{Strata}}}}
{{CLIO|PortalTraversalLighting|Enables static lights to go through {{ent|linked_portal_door}}, if <code>Static Portal</code> value is <code>Yes</code>.|only={{Strata}}}}
:{{expand|title=-PortalTraversalLighting - Examples|
:{{expand|title=-PortalTraversalLighting - Examples|
<br>
<br>
Line 152: Line 152:
</gallery>
</gallery>
}}
}}
{{IO|-PortalTraversalAO|Enables static light [[Ambient Occlusion]] to go through {{ent|linked_portal_door}}, if <code>Static Portal</code> value is <code>Yes</code>.|only={{Strata}}}}
{{CLIO|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|
:{{expand|title=-PortalTraversalAO - Examples|
<br>
<br>
Line 160: Line 160:
</gallery>
</gallery>
}}
}}
{{IO|-softenCosine|Softens coloured lighting so it blends more accurately.|only={{slamminsrc}}|also={{gmod}}}}
{{CLIO|softenCosine|Softens coloured lighting so it blends more accurately.|game={{only|{{slamminsrc}}{{gmod}}}}}}
{{IO|-coring|Scale the light threshold before a luxel is completely unlit, used to save lightmap data.
{{CLIO|coring|Scale the light threshold before a luxel is completely unlit, used to save lightmap data.
:{{modernConfirm|Although this command exists in stock {{src13}} VRAD, it does not seem to do anything.}}|only={{slamminsrc}}}}
:{{modernConfirm|Although this command exists in stock {{src13}} VRAD, it does not seem to do anything.}}|game={{only|{{slamminsrc}}}}}}
{{IO|-worldtextureshadows|Allows world polys to cast texture shadows, much like models can.
{{CLIO|worldtextureshadows|Allows world polys to cast texture shadows, much like models can.
:{{bug|Doesn't work with displacements.}}
:{{bug|Doesn't work with displacements.}}
|only={{slamminsrc}}}}
|game={{only|{{slamminsrc}}}}}}
:{{expand|title=-worldtextureshadows - Examples|
:{{expand|title=-worldtextureshadows - Examples|
<gallery mode=nolines widths=320px heights=192px>
<gallery mode=nolines widths=320px heights=192px>
Line 172: Line 172:
</gallery>
</gallery>
}}
}}
{{IO|-translucentshadows|Enables -worldtextureshadows on {{Command|$translucent}} surfaces. As by default only {{ent|$alphatest}} surfaces cast baked shadows.
{{CLIO|translucentshadows|Enables -worldtextureshadows on {{Command|$translucent}} surfaces. As by default only {{ent|$alphatest}} surfaces cast baked shadows.
:{{bug|Doesn't work with displacements.}}
:{{bug|Doesn't work with displacements.}}
|only={{slamminsrc}}}}
|game={{only|{{slamminsrc}}}}}}
:{{expand|title=-translucentshadows - Examples|<gallery mode=nolines widths=320px heights=192px>
:{{expand|title=-translucentshadows - Examples|<gallery mode=nolines widths=320px heights=192px>
File:Translu2.jpg|Disabled.
File:Translu2.jpg|Disabled.
Line 181: Line 181:
}}
}}
}}
}}
{{IO|-HL2LDRAmbientClassic|Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)|only={{hl2}} 20th}}
{{CLIO|HL2LDRAmbientClassic|Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)|game={{only|{{hl2}}}} 20th}}
{{IO|-HL2LDRAmbientFix|Use adjusted LDR ambient lighting constant for HDR re-lit maps (Use adjusted LDR ambient lighting constant for HDR re-lit maps (Post 360/Orange Box HL2 VMFs only)|only={{hl2}} 20th}}
{{CLIO|HL2LDRAmbientFix|Use adjusted LDR ambient lighting constant for HDR re-lit maps (Use adjusted LDR ambient lighting constant for HDR re-lit maps (Post 360/Orange Box HL2 VMFs only)|game={{only|{{hl2}}}} 20th}}


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


{{ColumnBox|count=1|{{IO|-low|Run as a low-priority process.}}
{{ColumnBox|count=1|{{CLIO|low|Run as a low-priority process.}}
{{IO|-threads|param=int|Override the number of CPU threads used. Maximum is 16 threads (32 in {{csgo}}{{slamminsrc}}{{mapbase}}, unlimited in {{tf2}})
{{CLIO|threads|param=int|Override the number of CPU threads used. Maximum is 16 threads (32 in {{csgo}}{{slamminsrc}}{{mapbase}}, unlimited in {{tf2}})
:{{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.}}
:{{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.}}
::{{Note|The above mentioned thread scaling issue has been fixed in {{tf2}},{{csgo}},{{l4d2}},{{gmod}}.}}
::{{Note|The above mentioned thread scaling issue has been fixed in {{tf2}},{{csgo}},{{l4d2}},{{gmod}}.}}
:{{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.}}
:{{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.}}
}}
}}
{{IO|-mpi|Use [[Vmpi|VMPI]] to distribute computations.}}
{{CLIO|mpi|Use [[Vmpi|VMPI]] to distribute computations.}}
{{IO|-mpi_pw|param=string|Use a password to choose a specific set of VMPI workers.}}
{{CLIO|mpi_pw|param=string|Use a password to choose a specific set of VMPI workers.}}
{{IO|-noextra|Disable supersampling. This will lead to blockier, less accurate lighting.}}
{{CLIO|noextra|Disable supersampling. This will lead to blockier, less accurate lighting.}}
{{IO|-chop|param=int|Smallest number of [[luxel]] widths for a bounce patch, used on edges. (Default: 4)}}
{{CLIO|chop|param=int|Smallest number of [[luxel]] widths for a bounce patch, used on edges. (Default: 4)}}
{{IO|-maxchop|param=int|Coarsest allowed number of luxel widths for a patch, used in face interiors. (Default: 4)}}
{{CLIO|maxchop|param=int|Coarsest allowed number of luxel widths for a patch, used in face interiors. (Default: 4)}}
{{IO|-dispchop|param=int|Smallest acceptable [[luxel]] width of displacement patch face. (Default: 8)}}
{{CLIO|dispchop|param=int|Smallest acceptable [[luxel]] width of displacement patch face. (Default: 8)}}
{{IO|-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.}}
{{CLIO|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.}}
{{IO|-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.}}
{{CLIO|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.}}
{{IO|-fastambient|Uses low quality per-leaf ambient sampling to save compute time.}}
{{CLIO|fastambient|Uses low quality per-leaf ambient sampling to save compute time.}}
{{IO|-LeafAmbientSampleReduction|param=float|Reduction factor for ambient samples. Defaults to 1.0.|only=CSGO}}
{{CLIO|LeafAmbientSampleReduction|param=float|Reduction factor for ambient samples. Defaults to 1.0.|game={{only|{{CSGO}}}}}}
{{IO|-noao|Disables compiling simulated ambient occlusion for lightmaps.|only={{Nwi_games}}}}
{{CLIO|noao|Disables compiling simulated ambient occlusion for lightmaps.|game={{only|{{Nwi_games}}}}}}
{{IO|-StaticPropSampleScale|param=float|Extra sampling factor for indirect lighting on prop_static.
{{CLIO|StaticPropSampleScale|param=float|Extra sampling factor for indirect lighting on prop_static.
: slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
: slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
: {{note|-final is the equivalent of having -StaticPropSampleScale 16.}}|only=CSGO|also={{gmod}}}}
: {{note|-final is the equivalent of having -StaticPropSampleScale 16.}}|game={{only|{{CSGO}}{{gmod}}}}}}
{{IO|-disppatchradius|param=float|Sets the maximum radius allowed for displacement patches. If you get "Patch Sample Radius Clamped", you can try increasing this limit.}}
{{CLIO|disppatchradius|param=float|Sets the maximum radius allowed for displacement patches. If you get "Patch Sample Radius Clamped", you can try increasing this limit.}}
{{IO|-ambientfromleafcenters|Samples ambient lighting from the center of the leaf.|only=CSGO}}
{{CLIO|ambientfromleafcenters|Samples ambient lighting from the center of the leaf.|game={{only|{{csgo}}}}}}
}}
}}


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


{{ColumnBox|count=1|{{IO|-rederrors|Emit red light when "a luxel has no samples".}}
{{ColumnBox|count=1|{{CLIO|rederrors|Emit red light when "a luxel has no samples".}}
{{IO|-vproject <directory>}}
{{CLIO|vproject <directory>}}
{{IO|-game <directory>|Override the VPROJECT environment variable.}}
{{CLIO|game <directory>|Override the VPROJECT environment variable.}}
{{IO|-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.}}
{{CLIO|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.}}
{{IO|-v}}
{{CLIO|v}}
{{IO|-verbose|Turn on verbose output.}}
{{CLIO|verbose|Turn on verbose output.}}
{{IO|-novconfig|Don't bring up graphical UI on vproject errors.}}
{{CLIO|novconfig|Don't bring up graphical UI on vproject errors.}}
{{IO|-dump|Dump patches to debug files.}}
{{CLIO|dump|Dump patches to debug files.}}
{{IO|-dumpnormals|Write normals to debug .txt files.}}
{{CLIO|dumpnormals|Write normals to debug .txt files.}}
{{IO|-debugextra|Places debugging data in lightmaps to visualize supersampling.}}
{{CLIO|debugextra|Places debugging data in lightmaps to visualize supersampling.}}
{{IO|-dlightmap|Force direct lighting into different lightmap than radiosity.}}
{{CLIO|dlightmap|Force direct lighting into different lightmap than radiosity.}}
{{IO|-stoponexit|Wait for a keypress on exit.}}
{{CLIO|stoponexit|Wait for a keypress on exit.}}
{{IO|-nodetaillight|Don't light detail props.}}
{{CLIO|nodetaillight|Don't light detail props.}}
{{IO|-centersamples|Move sample centers.}}
{{CLIO|centersamples|Move sample centers.}}
{{IO|-loghash|Log the sample hash table to samplehash.txt.}}
{{CLIO|loghash|Log the sample hash table to samplehash.txt.}}
{{IO|-onlydetail|Only light detail props and per-leaf lighting.}}
{{CLIO|onlydetail|Only light detail props and per-leaf lighting.}}
{{IO|-maxdispsamplesize|param=int|Set max displacement sample size (default: 512).}}
{{CLIO|maxdispsamplesize|param=int|Set max displacement sample size (default: 512).}}
{{IO|-FullMinidump|Write large minidumps on crash.}}
{{CLIO|FullMinidump|Write large minidumps on crash.}}
{{IO|-OnlyStaticProps|Only perform direct static prop lighting.}}
{{CLIO|OnlyStaticProps|Only perform direct static prop lighting.}}
{{IO|-StaticPropNormals|When lighting static props, just show their normal vector.}}
{{CLIO|StaticPropNormals|When lighting static props, just show their normal vector.}}
{{IO|-noskyboxrecurse|Turn off recursion into 3d skybox (skybox shadows on world).}}
{{CLIO|noskyboxrecurse|Turn off recursion into 3d skybox (skybox shadows on world).}}
{{IO|-nossprops|Globally disable self-shadowing on static props.}}
{{CLIO|nossprops|Globally disable self-shadowing on static props.}}
{{IO|-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.}} |only=2013MP|also={{gmod}}}}
{{CLIO|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={{only|{{2013MP}}{{gmod}}}}}}
{{IO|-unlitdetail|Disables lighting for detail props.|only=CSGO}}
{{CLIO|unlitdetail|Disables lighting for detail props.|game={{only|{{csgo}}}}}}
{{IO|-reflectivityScale|param=float|Scale the [[$reflectivity]] of all textures. Default 1.0|only={{slamminsrc}}}}
{{CLIO|reflectivityScale|param=float|Scale the [[$reflectivity]] of all textures. Default 1.0|game={{only|{{slamminsrc}}}}}}
}}
}}


=== Debug mode options ===
=== Debug mode options ===
If VRAD is compiled in debug mode or the <code>#if ALLOWDEBUGOPTIONS</code> preprocessor is removed, additional options are available.
If VRAD is compiled in debug mode or the <code>#if ALLOWDEBUGOPTIONS</code> preprocessor is removed, additional options are available.
{{IO|-scale|param=float|Scale lighting by this value.}}
{{CLIO|scale|param=float|Scale lighting by this value.}}
{{IO|-ambient|param=|Apply a minimum ambient lighting value to the map.{{confirm|Is this [[color255]] or [[color1]]? Light entities use the former, but VRAD uses the latter internally.}}}}
{{CLIO|ambient|param=|Apply a minimum ambient lighting value to the map.{{confirm|Is this [[color255]] or [[color1]]? Light entities use the former, but VRAD uses the latter internally.}}}}
{{IO|-scale|param=float|Scale lighting by this value.}}
{{CLIO|scale|param=float|Scale lighting by this value.}}
{{IO|-sky|param=float|}}
{{CLIO|sky|param=float}}
{{IO|-notexscale|param=|}}
{{CLIO|notexscale|param=|}}
{{IO|-coring|param=float|Luxels with values dimmer than this are treated as completely black, and don't get supersampled.}}
{{CLIO|coring|param=float|Luxels with values dimmer than this are treated as completely black, and don't get supersampled.}}


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

Revision as of 08:04, 19 March 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.

Effects

Todo: Split some of the game-specific options into their own page section.

Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

-aoscale - Examples

Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

Examples


Template:CLIO

Expriemental AO examples


Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

-PortalTraversalLighting - Examples


Template:CLIO

-PortalTraversalAO - Examples


Template:CLIO Template:CLIO Template:CLIO

-worldtextureshadows - Examples

Template:CLIO

-translucentshadows - Examples

Template:CLIO Template:CLIO

Performance

Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

Template:CLIO
Todo: Find out if this is branch specific, as it doesn't work with TF2.

Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

Debugging

Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO Template:CLIO

Debug mode options

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

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.  [todo tested in ?]
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.
  [todo tested in ?]
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.
PlacementTip.pngWorkaround:For the latter, compile the lightmap at a higher resolution than necessary, then downscale it and use as a $lightmap.

See also