CLight

From Source Entities
(Redirected from Light spot)
Jump to navigation Jump to search

Code classes:

Light.png

CLight is the base class for the majority of Source's lighting entities.

Classnames:

  • light - The standard light entity. It emits light in all directions.
  • light_spot - A light entity made to emit light in a certain direction.
  • light_glspot - Older name for light_spot.
  • light_directional (available in all games since L4d.png) - An entity that simulates sunlight. It can't use ambient settings like light_environment can, but it can be used multiple times in one map, even with a light_environment. Bug: Csgo-small.pngColors may come out too strong and look too dark in places when multiple sunlight sources overlap.

Unless the entity is given a targetname, it will remove itself upon spawning because the game no longer needs it for anything. Named lights are toggleable and can take inputs but do a simpler light calculation and lightmap pieces are limited to up to 2 toggled lights shining on them at once. To be clear, this applies to CLight and everything inheriting it.

Flags[edit | edit source]

  • 1: Initially dark - If this light is toggled, tell it to spawn in the off state.

Keyvalues[edit | edit source]

Brightness (_light) <color255>
Color and intensity of the light.
BrightnessHDR (_lightHDR) <color255>
If specified, color + intensity for players with HDR turned on. The default -1 -1 -1 1 means the lightmap data will be the same, regardless of HDR. The lighting may still appear different ingame, due to HDR being on. Note: In L4d.pngL4d2-small.pngAsw.pngP2.pngCsgo-small.png HDR is on by default and can only be turned off with console commands, so setting this keyvalue is pointless.
BrightnessScaleHDR (_lightscaleHDR) <float>
Multiplier for the color + intensity for players with HDR turned on. (Works with BrightnessHDR, though it doesn't make sense to use them together...)
Appearance (style) <choices>
Modulates the light between its lit and unlit states. See here for preset info. Using these counts as making the light toggleable.
Custom Appearance (pattern) <string>
Sets a custom pattern. Pattern format is a string of characters, where a is total darkness, and z is fully bright. i.e. aaggnnttzz would be a steppy fade in from dark to light.
Constant (_constant_attn) <float>
How strongly the light should use constant attenuation. Processed in a ratio along with Linear and Quadratic to determine how quickly light weakens as it moves away from its source (this entity). See here.
Note: Do not use these if already using the 50% and 0% falloff KVs.
Linear (_linear_attn) <float>
How strongly the light should use linear attenuation.
Quadratic (_quadratic_attn) <float>
How strongly the light should use quadratic attenuation.
50 percent falloff distance (_fifty_percent_distance) <float>
How far away from the source that light weakens to 50% its original brightness.
Note: Do not use these if already using the constant-linear-quadratic falloff KVs.
0 percent falloff distance (_zero_percent_distance) <float>
How far away from the source that light weakens to 0.4% (1/256) its original brightness, at which point VRAD will quit calculating it.
hard falloff (_hardfalloff) <float>
Light will not hit surfaces this far away from the source.
Entity To Point At (target) <target_destination>
If this light emits in a certain direction, tell it to point at this entity. info_null works well.
Inner (bright) angle (_inner_cone) <float>
If this light emits in a certain direction, this is the angle of the cone in which the light emits at full intensity. Past this angle, light will weaken until it stops completely at Outer (fading) angle. Maximum 90.
Outer (fading) angle (_cone) <float>
If this light emits in a certain direction, this is the farthest angle away from that direction that the light is allowed emit at. Maximum 90.
Focus (_exponent) <float>
Bias for where most of the intensity falloff between Inner (bright) angle and Outer (fading) angle occurs. 1 means a simple linear[Confirm] falloff. Decimals between 0 and 1 cause the falloff to occur closer to the outer angle, and numbers above 1 make it happen closer to the inner angle.
Pitch (pitch) <angle_negative_pitch>
If this light emits in a certain direction, this overrides the pitch in Pitch Yaw Roll. This is entirely useless, but VRAD ignores the regular one, so it must be specified in order to orientate the light. Note that this pitch is the negative of the regular one, so -90 is straight down.
Maximum Distance (_distance) <float>
Old version of hard falloff.
Default Style (Not in FGD) (defaultstyle)
To do: Description.
Cast entity shadows (_castentityshadow) <boolean> (available in all games since L4d.png)
Allows the light to modify the direction of nearby _rt_shadows shadows so that they always point away from the light source.
Shadow cast offset (_shadoworiginoffset) <vector> (available in all games since L4d.png)
An offset from the light source which acts as the actual light source, for the purpose of _rt_shadows shadow angles. Useful for dealing with funny-looking shadows from lights close to the ground: Just move it up the Z axis.

Inputs[edit | edit source]

TurnOn
Turns the light on.
TurnOff
Turns the light off.
Toggle
If on, turn off. If off, turn on.
SetPattern <string>
Sets a Custom Appearance.
FadeToPattern <string>
Broken. Goes through patterns incorrectly and can cause models to shine the inverse color of the light.

See Also[edit | edit source]