RAD file: Difference between revisions
Jump to navigation
Jump to search
Note:RAD files are removed in
Source 2, in favor of emissive materials (only in
) and light_rect.
Note:In some games (such as
or
, may include its own lights.rad inside the game VPK's file. This meant that if the game VPK is loaded first, it may load the original lights.rad file, regardless if you have the edited lights.rad file placed outside the VPKs.
Workaround:Go to
SirYodaJedi (talk | contribs) (Created page with "{{draft}} == Source 1 == A light file is a plain text file that can be used to manipulate the way VRAD handles given materials when compiling static lighting. Al...") |
(removedd goldsrc link on source page) |
||
(83 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
== | {{TabsBar|main=gs|base=RAD_file}} | ||
{{src topicon}} | |||
{{seealso|[[:Category:RAD]]}} | |||
A | A '''RAD file''' is a plain text file that can be used to manipulate the way [[QRAD]], [[HLRAD]], and [[VRAD]] handle given brush [[texture]]s when compiling static lighting. | ||
There are: | There are: | ||
#'''{{mono|lights.rad}}''', the global file. | #'''{{mono|[[lights.rad]]}}''', the global file. | ||
#'''An auto-loaded map light file''', using the format {{mono|<mapname>.rad}}. The file must be placed in the same folder as {{mono|<mapname>.vmf}}. | #'''An auto-loaded map light file''', using the format {{mono|<mapname>.rad}}. The file must be placed in the same folder as {{mono|<mapname>.vmf}} ({{src}}). | ||
#'''Any number of additional lights files''' that can be added with | #'''Any number of additional lights files''' that can be added with the {{mono|-lights}} parameter. | ||
Where these are placed depends upon the engine; see below. | |||
{{note|RAD files are removed in {{src2|4}}, in favor of [[Glowing textures (Source 2)|emissive materials]] {{cs2|only}} and {{ent|light_rect}}.}} | |||
{{clr}} | |||
[[File:Lightmap.PNG|320px|thumb|Scales and effects of texlights.]] | |||
[[File:Lightsrad light generation.png|320px|thumb|Lower luxel scales will result in texlights being more evenly distributed, but can lead to reaching a [[too many lights]] error more quickly. The brightness of the individual lights are automatically adjusted to avoid brightness discrepancies between luxel scales.]] | |||
All RAD files must have the .rad file extension and must be in the same folder as [[gameinfo.txt]], except for {{mono|<mapname>.rad}}, which should be in the same folder as the uncompiled [[VMF]]. If not present in the gameinfo directory, the directory where VRAD is will be searched instead. | |||
An example Source 1 RAD file can be found [[lights.rad/Half-Life 2|here]] (from {{hl2}}). | |||
{{clr}} | |||
{{Note|In some games (such as {{css}} or {{hl2}}, may include its own lights.rad inside the game [[VPK]]'s file. This meant that if the game VPK is loaded first, it may load the original lights.rad file, regardless if you have the edited lights.rad file placed outside the VPKs. | |||
{{Workaround|Go to {{path|custom}} folder (create one if it doesn't exist), then create a folder inside it, name it whatever you want, then put custom lights.rad file here.}} | |||
}} | |||
{{bug|tested={{hammer++}}|Texture resolution seems to impact texlight brightness as well, not just texture scale and luxel scale.}} | |||
=== Rules === | === Rules === | ||
Lights files perform these functions, one rule per line: | Lights files perform these functions, one rule per line: | ||
;{{mono|<material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity>}} | ;{{mono|<material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity>}} | ||
: | : Defines a [[texlight]], making the material appear to emit the given light value when applied to a [[brush]] face ({{mono|hdr_}} values are optional). Texture scale has an effect on final intensity. | ||
:{{Note|The material does not truly emit light, but instead, | :{{Note|The material does not truly emit light, but instead, spotlights are [[:file:Lightsrad_light_generation.png|generated across the surface]]. More technically, lights are placed every four luxels across the surface. The brightness of each light is distributed uniformly, by taking the area of each subdivision. Lower lightmap scales will increase subdivision and therefore more lights will be created. This will not occur on textures that are unlit, as no subdivision occurs on these textures. Leaf splits will still incur subdivision however, which might make the light creation unpredictable (using a [[func_detail]] will avoid this). It may be cheaper to instead manually place {{ent|light_spot}} entities near the material. {{note|Unlike {{ent|light}} however, texlights are directional, and only cast light in the 90 degrees in which the face faces. Unlike {{goldsrc}}, '''a texlight will not directly illuminate the face which "casts" the light''' (although it can still receive indirect light). As such, materials intended to be used as texlights should be {{ent|UnlitGeneric}} or {{ent|$selfillum}}.}} }} | ||
:{{note|Materials that aren't in a folder must have a slash before their name.}} | :{{note|Materials that aren't in a folder must have a slash before their name.}} | ||
:{{ | :{{bug|hidetested=1|A [[func_detail]] with an emissive material applied on a face may randomly cause VRAD to fail computing lighting for the face; tie to [[func_brush]] instead.}} | ||
;{{mono|noshadow <material name>}} | ;{{mono|noshadow <material name>}} | ||
:Prevents the named material from casting shadows. | :Prevents the named material from casting shadows. Path is optional. | ||
;{{mono|forcetextureshadow <model path>.mdl}} | ;{{mono|forcetextureshadow <model path>.mdl}} {{src07|since}} | ||
:Enables translucency shadow testing for a model when VRAD is run with {{mono|[[#Effects|-TextureShadows]]}}. Path is relative to the models folder. | :Enables translucency shadow testing for a model when VRAD is run with {{mono|[[VRAD#Effects|-TextureShadows]]}}, regardless of whether it was compiled with {{ent|$casttextureshadows}}. Path is relative to the models folder. | ||
;{{mono|<nowiki>ldr:</nowiki>}} | ;{{mono|<nowiki>ldr: <rule></nowiki>}} {{src07|since}} | ||
;{{mono|<nowiki>hdr:</nowiki>}} | ;{{mono|<nowiki>hdr: <rule></nowiki>}} {{src07|since}} | ||
:Prefixes to make any rule only apply to SDR or HDR lighting. | :Prefixes to make any rule only apply to SDR or HDR lighting. | ||
;{{mono|<nowiki>hdr:ldr:</nowiki>}} | ;{{mono|<nowiki>hdr:ldr: <comment></nowiki>}} {{src07|since}} | ||
:Lines beginning with both tags (in that order) will always be ignored by VRAD. Can be used to add comments or quickly disable some entries. | :Lines beginning with both tags (in that order) will always be ignored by VRAD. Can be used to add comments or quickly disable some entries. | ||
; {{mono|// <comment>}} {{only|VRAD++}} | |||
: Denotes an end-of-line comment. Anything after the two slashes will be ignored by [[VRAD++]]. | |||
== See also == | |||
* [[Texlight]] | |||
* [[:Category:RAD]] | |||
* [[:Category:Source RAD files]] | |||
[[Category:File formats]] | |||
[[Category:Files]] | |||
[[Category:RAD]] |
Latest revision as of 14:58, 4 August 2025
See also: Category:RAD
A RAD file is a plain text file that can be used to manipulate the way QRAD, HLRAD, and VRAD handle given brush textures when compiling static lighting.
There are:
- lights.rad, the global file.
- An auto-loaded map light file, using the format <mapname>.rad. The file must be placed in the same folder as <mapname>.vmf (
).
- Any number of additional lights files that can be added with the -lights parameter.
Where these are placed depends upon the engine; see below.




Lower luxel scales will result in texlights being more evenly distributed, but can lead to reaching a too many lights error more quickly. The brightness of the individual lights are automatically adjusted to avoid brightness discrepancies between luxel scales.
All RAD files must have the .rad file extension and must be in the same folder as gameinfo.txt, except for <mapname>.rad, which should be in the same folder as the uncompiled VMF. If not present in the gameinfo directory, the directory where VRAD is will be searched instead.
An example Source 1 RAD file can be found here (from ).





custom
folder (create one if it doesn't exist), then create a folder inside it, name it whatever you want, then put custom lights.rad file here.Rules
Lights files perform these functions, one rule per line:
- <material> <red> <green> <blue> <intensity> <hdr_red> <hdr_green> <hdr_blue> <hdr_intensity>
- Defines a texlight, making the material appear to emit the given light value when applied to a brush face (hdr_ values are optional). Texture scale has an effect on final intensity.
Note:The material does not truly emit light, but instead, spotlights are generated across the surface. More technically, lights are placed every four luxels across the surface. The brightness of each light is distributed uniformly, by taking the area of each subdivision. Lower lightmap scales will increase subdivision and therefore more lights will be created. This will not occur on textures that are unlit, as no subdivision occurs on these textures. Leaf splits will still incur subdivision however, which might make the light creation unpredictable (using a func_detail will avoid this). It may be cheaper to instead manually place light_spot entities near the material.
Note:Unlike light however, texlights are directional, and only cast light in the 90 degrees in which the face faces. Unlike
, a texlight will not directly illuminate the face which "casts" the light (although it can still receive indirect light). As such, materials intended to be used as texlights should be UnlitGeneric or $selfillum.
Note:Materials that aren't in a folder must have a slash before their name.
Bug:A func_detail with an emissive material applied on a face may randomly cause VRAD to fail computing lighting for the face; tie to func_brush instead.
- noshadow <material name>
- Prevents the named material from casting shadows. Path is optional.
- forcetextureshadow <model path>.mdl (in all games since
)
- Enables translucency shadow testing for a model when VRAD is run with -TextureShadows, regardless of whether it was compiled with $casttextureshadows. Path is relative to the models folder.
- ldr: <rule> (in all games since
)
- hdr: <rule> (in all games since
)
- Prefixes to make any rule only apply to SDR or HDR lighting.
- hdr:ldr: <comment> (in all games since
)
- Lines beginning with both tags (in that order) will always be ignored by VRAD. Can be used to add comments or quickly disable some entries.
- // <comment> (only in VRAD++)
- Denotes an end-of-line comment. Anything after the two slashes will be ignored by VRAD++.