This article's documentation is for Source 2. Click here for more information.

light_environment

From Valve Developer Community
Jump to: navigation, search

light_environment is a point entity available in all Source 2 Source 2 games. It controls environmental lighting and casts sunlight from the outside of the map toward its forward direction.

In SteamVR Home, the real-time component casts sharp shadows with a maximum of three cascaded shadow maps.

Usage

Typical setup:

1. Create an env_sky entity to use as your skybox.

2. Create a light_environment entity and set Sky IBL Source to the name of the env_sky entity.

3. Right-click on your light_environment entity and select Selected environment light -> Estimate lighting from HDR skybox.

Note.pngNote:This feature only works if the source material and texture files for the used skybox material are present.

4. Adjust angle and brightness of the sunlight as you see fit.

Keyvalues

Blank image.pngTodo: Add any new keyvalues from HL:A.


SunSpreadAngle (angulardiameter) (???) <float>
The angular extent of the sun for casting soft shadows. Higher numbers are more diffuse. 1 is a good starting value. This only affects baked lighting.
Cascade Count (numcascades) (???) <integer>
Number of shadow cascades to use.
Cascade Distance 0 (shadowcascadedistance0) (???) to Cascade Distance 3 (shadowcascadedistance3) <float>
Maximum distance for each shadow map.
Cascade Resolution 0 (shadowcascaderesolution0) (???) to Cascade Resolution 3 (shadowcascaderesolution3) <integer>
Resolution of each shadow map texture. If set to 0, it uses the default texture resolution.


Sky Color (skycolor) (???) <color255>
Flat sky color. Not used if a sky IBL source is set.
Sky Intensity (skyintensity) (???) <float>
Flat sky intensity. Not used if a sky IBL source is set.
Lower Hemisphere Is Black (lower_hemisphere_is_black) (???) <boolean>
Sky IBL Source (skytexture) (???) <string>
Sky source for Image Based Lighting. Can be an env_sky entity, lat-long/h-cross/v-cross skybox image, or sky material.
Sky IBL Scale (skytexturescale) (???) <float>
Scale value for IBL intensity fine-tuning.
Sky Ambient Bounce (skyambientbounce) (???) <color255>
Sun Light Minimum Brightness Threshold (sunlightminbrightness) (???) <float>
Brightness beyond which pixels in the Sky IBL Source are considered to be coming from the sun.


Ambient Occlusion (ambient_occlusion) (???) <boolean>
Ambient Occlusion Max Distance (max_occlusion_distance) (???) <float>
Ambient Occlusion Fully Occluded Fraction (fully_occluded_fraction) (???) <float>
Ambient Occlusion Exponent (occlusion_exponent) (???) <float>
Ambient Light (ambient_color) (???) <color255>
Adds a constant flat term to the entire map. Use with care as this can look very unrealistic.

Source 2 Light:
Enabled (enabled) (???) <boolean>
Sets the initial on/off state of the light.
Color (color) (???) <color255>
The RGB color of the light.
Brightness (brightness) (???) <float>
The brightness of the light. The value can be increased over 1.0
Range (range) (???) <float>
Distance range for light. 0 : infinite.
Cast Shadows (castshadows) (???) <choices>
Whether this light casts shadow.
  • 0: No
  • 1: Yes
  • 2: Baked Only
Shadow Near Clip Plane (nearclipplane) (???) <float>
Distance in game units for near clip plane for shadow map.
Appearance (style) (???) <choices>
Various Custom Appearance presets.
Light Appearances
Literal Value Description Sequence Preview
0 Normal m Sequence 0.gif
10 Fluorescent flicker mmamammmmammamamaaamammma Sequence 10.gif
2 Slow, strong pulse abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba Sequence 2.gif
11 Slow pulse, noblack abcdefghijklmnopqrrqponmlkjihgfedcba Sequence 11.gif
5 Gentle pulse jklmnopqrstuvwxyzyxwvutsrqponmlkj Sequence 5.gif
1 Flicker A mmnmmommommnonmmonqnmmo Sequence 1.gif
6 Flicker B nmonqnmomnmomomno Sequence 6.gif
3 Candle A mmmmmaaaaammmmmaaaaaabcdefgabcdefg Sequence 3.gif
7 Candle B mmmaaaabcdefgmmmmaaaammmaamm Sequence 7.gif
8 Candle C mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa Sequence 8.gif
4 Fast strobe mamamamamama Sequence 4.gif
9 Slow strobe aaaaaaaazzzzzzzz Sequence 9.gif
12 !FGD Underwater light mutation mmnnmmnnnmmnn Sequence 12.gif
Custom Appearance (pattern) (???) <string>
Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light.
Start Fade Dist (fademindist) (???) <float>
Distance at which the light starts to fade (<0 : use fademaxdist).
End Fade Dist (fademaxdist) (???) <float>
Maximum distance at which the light is visible (0 : don't fade out).
Render to Cubemaps (rendertocubemaps) (???) <boolean>
If true, this geometry renders into baked cube maps
Priority (priority) (???) <integer>
When the number of visible lights exceeds the rendering budget, higher priority lights are chosen for rendering first.


Indirect Light Multiplier (bouncescale) (???) <float>
Multiplies the brightness of light bouncing of surfaces.
Render Diffuse (renderdiffuse) (???) <boolean>
Toggles baking and rendering of diffuse lighting (per-pixel, lightmaps,light probe volumes and bounced light on cubemaps).
Render Specular (renderspecular) (???) <choices>
Controls rendering of direct specular highlights. This applies a bright sphere effect to reflections.
  • 0: Off
  • 1: On - Render in real-time.
  • 2: Bake into cubemaps (Source 1 behavior)
Enabled (directlight) (???) <choices>
How direct lighting should be represented.
  • 0: None
  • 1: Baked
  • 2: Per-Pixel
  • 3: Mixed
    Blank image.pngTodo: possibly deprecated
Enabled (indirectlight) (???) <choices>
How indirect lighting should be represented.
  • 0: None
  • 1: Baked



Source 2 Light Attenuation:
Linear Attenuation (attenuation1) (???) <float>
Quadratic Attenuation (attenuation2) (???) <float>
Light Source Radius (enabled) (???) <float>
The radius of the light source in game units.



Source 2 Targetname:
Name (targetname) (???) <string>
The targetname that other entities refer to this entity by.
Entity Scripts (vscripts) (???) <scriptlist>
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Create Client-Only Entity (clientSideEntity) (???) <choices>
  • 0: No
  • 1: Yes



Source 2 Hierarchy:
Parent (parentname) (???) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent.
Parent Model Bone/Attachment Name (parentAttachmentName) (???) <string>
The name of the bone or attachment to attach to on the entity's parent in the movement hierarchy. Use !bonemerge to use bone-merge style attachment.
Model Attachment position offset (local.origin) (???) <coordinates>
Offset in the local space of the parent model's attachment/bone to use in hierarchy. Not used if you are not using parent attachment.
Model Attachment angular offset (local.angles) (???) <angles>
Angular offset in the local space of the parent model's attachment/bone to use in hierarchy. Not used if you are not using parent attachment.
Model Attachment scale (local.scales) (???) <vector>
Scale in the local space of the parent model's attachment/bone to use in hierarchy. Not used if you are not using parent attachment.
Use Model Attachment Offset (useLocalOffset) (???) <boolean>
Whether to respect the specified local offset when doing the initial hierarchical attachment to its parent.



Source 2 Transform:
Origin (origin) <coordinates>
The world space origin of the entity.
Angles (angles) <angles>
The pitch, yaw, roll orientation of the entity.
Scale (scales) <vector>
The x, y, z scales of the entity. Not all entities can use this.
Transform Locked (transform locked) <boolean>
Lock the transform at its current value, preveting the transform of the node from being modified.
Force Hidden (force hidden) <boolean>
Visually hides the entity from the viewports. The Outliner pane will still list hidden entities.
Editor Only (editor only) <boolean>
Entity is only displayed in Hammer and will not appear in game.


Inputs


Source 2 Light:
SetLightEnabled <integer>
Sets whether the light is enabled (takes parameter of 0 or 1)
TurnOn
Turn the light on.
TurnOff
The the light off.
Toggle
Toggle the light's current state.
SetLightColor <vector>
Set light color.
SetLightBrightness <float>
Set light brightness.
SetAppearance <integer>
Set appearance 0: Normal 1: Flicker A, 2: Slow, strong pulse 3: Candle A ...
SetCustomAppearance <string>
Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light.



Source 2 Targetname:
Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.


RunScriptFile <string>
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string>
Execute a string of VScript source code in the scope of the entity receiving the input.
CallScriptFunction <string>
Call a script function.
CallPrivateScriptFunction <string>
Calls a script function from this entity's private script scope.
CallGlobalScriptFunction <string>
Calls a script function in the global script scope.



Source 2 Hierarchy:
SetParent <string>
Changes the entity's parent in the movement hierarchy.
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.
SetParentAttachmentMaintainOffset <string>
Change this entity to attach to a specific attachment point on it's parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment. The entity will maintain it's position relative to the parent at the time it is attached.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.


Outputs


Source 2 Targetname:
OnUser1 to OnUser4
These Outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled
This Output fires when the entity is killed and removed from the game.


See also