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

VRAD

From Valve Developer Community
Revision as of 08:10, 19 March 2025 by Nescius (talk | contribs)
Jump to navigation Jump to search
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