Difference between revisions of "Ambient light"

From Valve Developer Community
Jump to: navigation, search
m
(did what i can for the TODOs)
Line 1: Line 1:
'''Ambient light''' is light that has bounced off a surface. Dynamically-lit objects receive ambient lighting through a different path from direct lighting, while statically-lit objects bake both into their [[lightmap]].
 
 
Only static lights, those compiled by [[VRAD]], generate ambient lighting.
 
 
{{tip|Ambient light can be created directly by configuring the Ambient property of a [[light_environment]]. It will then be emitted from [[skybox]] brush faces in all directions.}}
 
 
== Storage ==
 
 
[[File:Ambient cubes.jpg|thumb|Ambient cubes. Note the reflection of light from the bright wall on the left.]]
 
 
Ambient terms are stored in sample points spread throughout the world. These can be visualised by enabling <code>mat_leafvis</code> and <code>r_visambient</code>. Dynamic lighting is a combination of the nearest "ambient cube" sample point and [[:File:Shadetree.jpg|up to two direct lights]].
 
 
Although their absolute number is adjusted, smaller [[Visleaf|visleaves]] will still have denser concentrations of sample points.
 
 
 
== Console commands ==
 
== Console commands ==
  
Line 18: Line 4:
 
: These two commands together enable the display the ambient lighting sample points in the active leaf.
 
: These two commands together enable the display the ambient lighting sample points in the active leaf.
 
; <code>r_flashlightambient <[[int]]></code>
 
; <code>r_flashlightambient <[[int]]></code>
: {{todo}}
+
: Seems like it would be used for making ambient light originating from projected textures or for influencing the color of the flashlight based on ambient light. Does not do anything in Half-Life 2.
 
; <code>r_lightcache_numambientsamples <int></code>
 
; <code>r_lightcache_numambientsamples <int></code>
: Cheat. The number of random directions to fire rays when computing ambient lighting. Default 162. {{todo|What effect does this have ''after'' a map has been compiled?}}
+
: Cheat. The number of random directions to fire rays when computing ambient lighting. Default 162. Requires map restart. {{confirm|This only affects static props.}}
 
; <code>r_ambientlightingonly <[[bool]]></code>
 
; <code>r_ambientlightingonly <[[bool]]></code>
 
: Cheat. Light models with only ambient lighting; requires map restart.
 
: Cheat. Light models with only ambient lighting; requires map restart.
Line 28: Line 14:
 
: Boosts ambient term if it is totally swamped by local lights.
 
: Boosts ambient term if it is totally swamped by local lights.
 
; <code>r_ambientmin <[[float]]></code>
 
; <code>r_ambientmin <[[float]]></code>
: Threshold above which ambient cube will not boost (i.e. it's already sufficiently bright). Default 0.3. {{todo|What units?}}
+
: Threshold above which ambient cube will not boost (i.e. it's already sufficiently bright). Default 0.3. <!---about the TODO: this one works just like the one directly below it. 0 is the minimum value accepted, 1 is the maximum. users probably shouldn't change either of these settings anyway, cause it can risk making certain props look unrealistically lit.--->
 
; <code>r_ambientfraction <float></code>
 
; <code>r_ambientfraction <float></code>
 
: Cheat. Fraction of direct lighting that ambient cube must be below to trigger boosting. Default 0.1.
 
: Cheat. Fraction of direct lighting that ambient cube must be below to trigger boosting. Default 0.1.

Revision as of 01:50, 21 May 2018

Console commands

mat_leafvis 1; r_visambient 1
These two commands together enable the display the ambient lighting sample points in the active leaf.
r_flashlightambient <int>
Seems like it would be used for making ambient light originating from projected textures or for influencing the color of the flashlight based on ambient light. Does not do anything in Half-Life 2.
r_lightcache_numambientsamples <int>
Cheat. The number of random directions to fire rays when computing ambient lighting. Default 162. Requires map restart.
Confirm:This only affects static props.
r_ambientlightingonly <bool>
Cheat. Light models with only ambient lighting; requires map restart.
r_radiosity <int>
Cheat. The manner in which radiosity is sampled. The console claims that there are four settings (0-3), each with different behaviours, but in practice the only two that seem to matter are 0 to disable and 4 to re-enable. This command is thus the opposite of r_ambientlightingonly.
r_ambientboost <bool>
Boosts ambient term if it is totally swamped by local lights.
r_ambientmin <float>
Threshold above which ambient cube will not boost (i.e. it's already sufficiently bright). Default 0.3.
r_ambientfraction <float>
Cheat. Fraction of direct lighting that ambient cube must be below to trigger boosting. Default 0.1.
r_ambientfactor <float>
Boost ambient cube by no more than this factor. Default 5.