VRAD: Difference between revisions
SirYodaJedi (talk | contribs) |
(→Options: reorganized the "options") |
||
Line 30: | Line 30: | ||
Use these in combination with [[expert compile mode]], a batch file, or a frontend such as {{compilepal|2}}. | 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.}} | |||
=== Effects === | === Effects === | ||
{{CLParam|-ldr}} | {{CLParam|-ldr}} | ||
{{CLParam|-hdr}} | {{CLParam|-hdr}} | ||
{{CLParam|-both|Whether to compile Standard Dynamic Range lighting (''referred as'' "Low Dynamic Range lighting" in Source), [[HDR|High Dynamic Range]] lighting, or both respectively. | {{CLParam|-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.}}}}}} | ||
{{CLParam|-fast|Compiles quick low quality lighting. Used for quick previewing. | {{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}} | :{{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.<br> | |||
{{CLParam|-final|Increases the quality of {{Ent|light_environment}} and indirect lighting by spending more time firing rays.<br>{{csgo}} Sets{{mono|-StaticPropSampleScale}} to 16.}} | {{csgo}} Sets{{mono|-StaticPropSampleScale}} to 16.}}<br> | ||
{{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|-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|-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|-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|-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|-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|-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 {{Ent|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. | {{CLParam|-StaticPropLighting|Generate per-vertex lighting on {{Ent|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> It also generates lightmaps for static props that have {{code|[[prop_static#Keyvalues|generatelightmaps]]}} enabled not many games supports this, {{only|{{src13mp}} {{tf2branch}} {{gmod}}}}. | ||
: {{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}}}}}} | {{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> | :{{expand|title=-StaticPropPolys - Examples|<gallery mode=nolines widths=320px heights=192px> | ||
Line 62: | Line 57: | ||
</gallery> | </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|4}} Also casts shadows from model materials with {{cmd|%alphatexture}}. | |||
{{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. | |||
:{{expand|title=-textureshadows - Examples| | :{{expand|title=-textureshadows - Examples| | ||
<br> | <br> | ||
Line 71: | Line 65: | ||
</gallery> | </gallery> | ||
}} | }} | ||
: {{note|{{bms|only}} Also generates lightmap shadows from brushes (but not displacements) using {{cmd|$alphatest}}.{{bug|Not compatible with {{cmd|$envmap|env_cubemap}}; manually define the {{cmd|$envmap}} path instead.|tested={{bms}}}}}} | |||
: {{note|{{bms|only}} Also generates lightmap shadows from brushes (but not displacements) using {{cmd|$alphatest}}.{{bug|Not compatible with {{cmd|$envmap|env_cubemap}}; manually define the {{cmd|$envmap}} path instead.}}}} | : {{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.<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.|tested={{dods}}{{src13mp}}}}|game={{since|{{Src07}}}}}} | ||
=== Game/Compiler Specific Parameters === | |||
: {{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}}}}}} | === {{csgo|4}} === | ||
{{CLParam|-aoscale|param=float|Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default. | {{CLParam|-aoscale|param=float|Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default. | ||
: {{Tip|Valve uses 1.5 for | : {{Tip|Valve uses 1.5 for 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}} | ||
File:VRAD AO Scale 2.0.jpg|{{code|-aoscale}} set to {{code|2.0}} | File:VRAD AO Scale 2.0.jpg|{{code|-aoscale}} set to {{code|2.0}} | ||
</gallery> | </gallery> | ||
}} | }} | ||
{{CLParam|-StaticPropBounce|param=int|Number of static prop light bounces to simulate. The default is 0. | {{CLParam|-StaticPropBounce|param=int|Number of static prop light bounces to simulate. The default is 0. | ||
: {{Tip|Valve uses 3 static prop bounces for | : {{Tip|Valve uses 3 static prop bounces for Dust 2.}} | ||
: {{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}}}}}} | : {{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}}}} | ||
}} | |||
{{CLParam|-StaticPropLightingFinal|{{obs}} Merged with {{mono|-final}}.|game={{only|{{csgo}}}}}} | {{CLParam|-StaticPropLightingFinal|{{obs}} Merged with {{mono|-final}}.|game={{only|{{csgo}}}}}} | ||
{{CLParam|-StaticPropLightingOld|Will use the old lighting algorithm on props, light affects them much more.|game={{only|{{csgo}}}}}} | {{CLParam|-StaticPropLightingOld|Will use the old lighting algorithm on props, light affects them much more.|game={{only|{{csgo}}}}}} | ||
{{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}}}}}} | |||
{{CLParam|-unlitdetail|Disables lighting for detail props.|game={{only|{{csgo}}}}}} | |||
{{CLParam|-ambientfromleafcenters|Samples ambient lighting from the center of the leaf.|game={{only|{{csgo}}}}}} | |||
{{CLParam|-StaticPropSampleScale|param=float|Extra sampling factor for indirect lighting on prop_static. | |||
: slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality) | |||
: {{note|-final is the equivalent of having -StaticPropSampleScale 16.}}|game={{only|{{CSGO}}}}{{also|{{gmod}}}}}} | |||
{{CLParam|-LeafAmbientSampleReduction|param=float|Reduction factor for ambient samples. Defaults to 1.0.|game={{only|{{CSGO}}}}}} | |||
=== {{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|-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|-extratransfers|Enable overscaling of light transfers.|game={{only|{{BMS}}}}}} | ||
Line 96: | Line 100: | ||
{{CLParam|-satthreshscale|param=float|The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.|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. | {{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.}} | : {{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}}}}}} | ||
|game={{only|{{BMS}}{{slamminsrc}}{{gmod}}}}}} | :{{expand|title=-ambientocclusion Examples| | ||
{{expand|title=Examples| | |||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 105: | Line 108: | ||
</gallery> | </gallery> | ||
}} | }} | ||
{{CLParam|-experimentalambientocclusion| | {{CLParam|-experimentalambientocclusion|Uses an improved algorithm for ambient occlusion. | ||
{{ | :{{obs}}Broken. Don't use.|game={{only|{{BMS}}}}}} | ||
|game={{only|{{BMS}}}}}} | :{{expand|title=-experimentalambientocclusion Examples| | ||
{{expand|title= | |||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 116: | Line 118: | ||
}} | }} | ||
{{CLParam|-cascadeshadows|Indicates that lightmap alpha data is interleved in the lighting lump, required for CSM. | {{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=Examples| | :{{expand|title=-cascadeshadows Examples| | ||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 123: | Line 125: | ||
File:CSMlSkyLight2.jpg|With <code>-cascadeshadows</code> and <code>-staticproplighting3</code>. | File:CSMlSkyLight2.jpg|With <code>-cascadeshadows</code> and <code>-staticproplighting3</code>. | ||
</gallery> | </gallery> | ||
}} | }} | ||
|game={{only|{{BMS}}}}}} | |game={{only|{{BMS}}}}}} | ||
{{CLParam|-realskylight|Enables VRAD to compute skylight ambient color by using actual values from skybox. | {{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| | |||
{{expand|title=-realskylight | |||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 138: | Line 138: | ||
{{CLParam|-realskylightscale|param=float|Scale factor of -realskylight intensity. Default: 1.0|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. | {{CLParam|-directsunlightisforadditivemode|Toggles direct sunlight for additive mode. | ||
{{bug|tested = {{bms}}|This option is not compatible with cascaded shadows.}} | :{{bug|tested = {{bms}}|This option is not compatible with cascaded shadows.}} | ||
{{expand|title=- | :{{expand|title=-directsunlightisforadditivemode Examples| | ||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 146: | Line 146: | ||
}} | }} | ||
|game={{only|{{BMS}}}}}} | |game={{only|{{BMS}}}}}} | ||
{{CLParam|- | === {{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}}}}}} | {{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 | :{{expand|title=-PortalTraversalLighting Examples| | ||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 156: | Line 158: | ||
}} | }} | ||
{{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}}}}}} | {{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 | :{{expand|title=-PortalTraversalAO Examples| | ||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
Line 163: | Line 165: | ||
</gallery> | </gallery> | ||
}} | }} | ||
{{CLParam|-softenCosine|Softens coloured lighting so it blends more accurately.|game={{only|{{slamminsrc | === {{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. | {{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!}} | :{{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}}}}}} | ||
|game={{only|{{slamminsrc}}}}}} | :{{expand|title=-worldtextureshadows Examples| | ||
:{{expand|title=-worldtextureshadows | |||
<gallery mode=nolines widths=320px heights=192px> | <gallery mode=nolines widths=320px heights=192px> | ||
File:WorldTex1.jpg|Disabled. | File:WorldTex1.jpg|Disabled. | ||
Line 177: | Line 178: | ||
:{{bug|tested={{src13}}|Doesn't work with displacements, and certain [https://knockout.chat/thread/992/5#post-2531724 file formats] might not cast 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}}}}}} | |game={{only|{{slamminsrc}}}}}} | ||
:{{expand|title=-translucentshadows | :{{expand|title=-translucentshadows Examples|<gallery mode=nolines widths=320px heights=192px> | ||
File:Translu2.jpg|Disabled. | File:Translu2.jpg|Disabled. | ||
File:Translu1.jpg|Enabled. | File:Translu1.jpg|Enabled. | ||
</gallery> | </gallery> | ||
}} | }} | ||
{{CLParam|-coring|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 === | |||
{{CLParam|-HL2LDRAmbientClassic|Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)|game={{only|{{hl2}}}} 20th}} | {{CLParam|-HL2LDRAmbientClassic|Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)|game={{only|{{hl2}}}} 20th}} | ||
{{CLParam|-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}} | {{CLParam|-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 === | ||
Line 203: | Line 210: | ||
{{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.}} | {{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.}} | ||
{{CLParam|-fastambient|Uses low quality per-leaf ambient sampling to save compute time.}} | {{CLParam|-fastambient|Uses low quality per-leaf ambient sampling to save compute time.}} | ||
{{CLParam|-noao|Disables compiling simulated ambient occlusion for lightmaps.|game={{only|{{Nwi_games}}}}}} | {{CLParam|-noao|Disables compiling simulated ambient occlusion for lightmaps.|game={{only|{{Nwi_games}}}}}} | ||
{{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.}} | {{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.}} | ||
}} | }} | ||
Line 237: | Line 239: | ||
{{CLParam|-nossprops|Globally disable self-shadowing on static props.}} | {{CLParam|-nossprops|Globally disable self-shadowing on static props.}} | ||
{{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={{only|{{src13mp}}{{gmod}}}}}} | {{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={{only|{{src13mp}}{{gmod}}}}}} | ||
}} | }} | ||
=== Debug | === 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. | ||
{{CLParam|-scale|param=float|Scale lighting by this value.}} | {{CLParam|-scale|param=float|Scale lighting by this value.}} |
Revision as of 00:16, 19 April 2025
VRAD is the command-line tool for
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
radiosity algorithm.
VRAD will:
- Generate lightmaps
- Generate 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 leaks.
Syntax
For example, a regular compile would look like thus:
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.
Effects
- -ldr
- -hdr
- -both
- Whether to compile Standard Dynamic Range lighting (referred as "Low Dynamic Range lighting" in Source), High Dynamic Range lighting, or both respectively.
- -fast
- Compiles quick low quality lighting. Used for quick previewing.
Note:-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: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.
Sets-StaticPropSampleScale to 16.
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: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
)
- 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.
It also generates lightmaps for static props that have generatelightmaps enabled not many games supports this, (only in).
Warning:In
Black Mesa, you should use -StaticPropLighting3 instead.
Important: Does not work on props with bump maps, except in
Counter-Strike: Global Offensive.
- -StaticPropPolys (in all games since
)
- 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
)
- 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 Mod Also casts shadows from model materials with %alphatexture.
-textureshadows - Examples
Note:(only in
) Also generates lightmap shadows from brushes (but not displacements) using $alphatest.
Bug: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:)
Game/Compiler Specific Parameters
Counter-Strike: Global Offensive
- -aoscale <float> (in all games since
)(also in
)
- Scales the radius of VRAD's simulated ambient occlusion. 1.0 is default.
Tip:Valve uses 1.5 for Dust 2.
-aoscale - Examples
- -StaticPropBounce <integer> (only in
)(also in
)
- Number of static prop light bounces to simulate. The default is 0.
Tip:Valve uses 3 static prop bounces for Dust 2.
Note:Any static props that you want light to bounce off of must also have their "Enable Bounced Lighting" keyvalue set.
- -StaticPropLightingOld (only in
)
- Will use the old lighting algorithm on props, light affects them much more.
- -ambient <color1> (only in
)
- Sets the ambient term. Can be used to tweak lightmap color. Appears to just mix the color into all lightmaps.
Also available inSource 2013 if VRAD is compiled in debug mode
- -StaticPropSampleScale <float> (only in
)(also in
)
- Extra sampling factor for indirect lighting on prop_static.
- slow: 16 (high quality); default: 4 (normal); fast: 0.25 (low quality)
Note:-final is the equivalent of having -StaticPropSampleScale 16.
- -LeafAmbientSampleReduction <float> (only in
)
- Reduction factor for ambient samples. Defaults to 1.0.
Black Mesa
- -StaticPropLighting3 (only in
)
- This is a more precise and less buggy version of -StaticPropLighting.
- -choptexlights (only in
)
- 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.
- -transferscale <float> (only in
)
- 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
)
- This is the threshold that checks how saturated a material color is. Used with -satthreshscale. Default 0.4.
- -satthreshscale <float> (only in
)
- The amount to scale light transfers from surfaces that pass the saturation threshold. Default 3.0.
- -ambientocclusion (only in
)(also in
)
- 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.
-ambientocclusion Examples
- -experimentalambientocclusion (only in
)
- Uses an improved algorithm for ambient occlusion.
Broken. Don't use.
-experimentalambientocclusion Examples
- -cascadeshadows (only in
)
- 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
)
- 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
)
- Scale factor of -realskylight intensity. Default: 1.0
-directsunlightisforadditivemode Examples
Strata Source
- -aoradius <float> (only in
)
- Set the radius of VRAD's simulated ambient occlusion. 36 is default.
- -aosamples <integer> (only in
)(also in
)
- How many samples to use for VRAD's simulated ambient occlusion.
- -PortalTraversalLighting (only in
)
- Enables static lights to go through linked_portal_door, if
Static Portal
value isYes
.
-PortalTraversalLighting Examples
- -PortalTraversalAO (only in
)
- Enables static light Ambient Occlusion to go through linked_portal_door, if
Static Portal
value isYes
.
-PortalTraversalAO Examples
Slammin' Source Map Tools
- -worldtextureshadows (only in
)
- Allows world polys to cast texture shadows, much like models can.
Bug:Doesn't work with displacements, and certain file formats might not cast shadows! (tested in:
)
-worldtextureshadows Examples
- -translucentshadows (only in
)
- Enables -worldtextureshadows on $translucent surfaces. As by default only $alphatest surfaces cast baked shadows.
Bug:Doesn't work with displacements, and certain file formats might not cast shadows! (tested in:
)
-translucentshadows Examples
- -coring (only in
)
- Luxels with values dimmer than this are treated as completely black, and don't get supersampled.
Also available inSource 2013 if VRAD is compiled in debug mode
- -reflectivityScale <float> (only in
)
- Scale the $reflectivity of all textures. Default 1.0
Mapbase
- -ultrafast (only in
)
- Merges '-fast -fastambient -noextra -bounce 1' commands into one, reduces compile time, useful for testing large maps.
- -extrapasses (only in
)
- 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 20th
- -HL2LDRAmbientClassic (only in
) 20th
- Use BSP version <20 LDR ambient lighting constant (pre-Lost Coast vmfs)
- -HL2LDRAmbientFix (only in
) 20th
- 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)
Performance
- -low
- Run as a low-priority process.
- -threads <integer>
- Override the number of CPU threads used. Maximum is 16 threads (32 in
, unlimited in
)
Workaround:With a patched vrad_dll you can use 32 threads.
fixtoolthreads is a patch for VRAD (and VVIS) that supports unlimited threads and fixes a thread scaling issue.
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.
- -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.
- -maxchop <integer>
- Coarsest allowed number of luxel widths for a patch, used in face interiors. (Default: 4)
- -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.
- -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 (only in
)
- Dump computed static prop lightmaps as TGA files.
Tip:This can be used to create lightmaps for dynamic props, using the $lightmap shader parameter.
Tip:To pair static props in a map with their dumped lightmaps, use r_staticpropinfo 2 to show static prop IDs on screen.
Bug:The resulting TGAs are written with the wrong color space (fixed in
); 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.
- -scale <float>
- Scale lighting by this value.
- -sky <float>
- -notexscale
- -coring <float>
- Luxels with values dimmer than this are treated as completely black, and don't get supersampled.
Lights files
Console output
Bugs and caveats





















- [todo tested in ?]
Tip:Source Engine BSP Lightmap Editor can be used to manually correct a .bsp lightmap data.




See also
- QRAD and HLRAD -
GoldSrc counterparts.
- VRAD2 & VRAD3 -
Source 2 counterparts.
- Map Compiling Theory
- HDR Lighting Basics
- VRAD HDR Crash Fix
- Static Props show up black
|