Light

From Valve Developer Community

This point-based entity is available in all Source games.

Table of contents

Entity Description

Image:note.png Note: For an article on light sources in general, proceed to Lighting.
An invisible light source. If named, it can be turned on and off through inputs.

The light entity is basic yet essential to almost every map.


Keyvalues

Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.
Warning.png Warning: Adding a targetname to this entity creates a dynamic (switchable) light source, and creates extra lightmap pages for each uniquely named light. This occurs regardless of whether the light entity receives any inputs at run time. Lights should not be named unless they will be turned on and off via inputs, and then only sparingly. Lights given the same name will be triggered together and share lightmap pages. Many dynamic lights in a level can cause performance problems and other errors. Lightmaps calculated for named lights are conspicuously simpler and cruder than unnamed lights.
_light
<color255 & integer> The color and brightness of the light. RGB colors need to be between 0 and 255. Brightness can be higher.
style
<choices> A preset pattern of diverse flicker effects.
Literal Value Description
0 Normal
1 Flicker A
2 Slow, strong pulse
3 Candle A
4 Fast strobe
5 Gentle pulse
6 Flicker B
7 Candle B
8 Candle C
9 Slow strobe
10 Fluorescent flicker
11 Slow pulse, noblack
Image:note.png Note: Applies only to light entities with a targetname.
pattern
<string> A string of characters defining a custom pattern, a being most dark and z being most bright. Think of it as a sequence of Piano keys.
Image:note.png Note: Applies only to light entities with a targetname.
_constant_attn
<float> Influences the light spread to be more constant, by dimming near the source and brightening at the edges. Used in equation with Linear and Quadratic. (Learn more about constant, linear and quadratic attenuation here.)
_linear_attn
<float> Influences the light spread to decrease at a fixed rate. Used in equation with Constant and Quadratic. (Learn more about constant, linear and quadratic attenuation here.)
_quadratic_attn
<float> Influences the light spread to decrease exponentially, i.e. faster as one moves away from the source. Used in equation with Constant and Linear. (Learn more about constant, linear and quadratic attenuation here.)
_distance
<integer> Stops the light emitted from reaching beyond this distance. Useful in cutting down compiling time by not making lights extend infinitely.
_lightHDR [Episode One Update]
<color255> BrightnessHDR. Defaults to -1 -1 -1 1, which tells the compiler to inherit from _light.
Warning.png Warning: The final digit in the default string is positive. Entering four negative numbers will suck the light out of your entire map!
_fifty_percent_distance [Episode One Update]
<float> 50 percent falloff distance
Distance at which brightness should fall off to 50%. If set, overrides the Linear, Constant and Quadratic parameters.
_zero_percent_distance [Episode One Update]
<float> 0 percent falloff distance
Distance at which brightness should fall off to negligible (1/256)%. Must set _fifty_percent_distance to use.

Flags

  • 1 : Initially Off

Inputs

Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.
  • TurnOn
Turns the light on.
  • TurnOff
Turns the light off.
  • Toggle
Toggles the light on or off.
  • SetPattern
Sets the light's custom appearance to the input's parameters.
  • FadeToPattern
Fades from the light's old pattern to the new one.

Outputs

Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.