From Valve Developer Community
Jump to: navigation, search
Light environment.png
light_environment is an internal point entity available in all Source games. It casts parallel directional lighting from the toolsskybox texture to approximate the light cast from the Sun or Moon.
Note:The properties of this entity apply to the whole map. Using more than 1 entity for areas with a skybox toolsskybox texture does not create errors provided If all instances of light_environment have identical info. It is pointless to have more than 1 though.
Tip:Use with env_sun and shadow_control.

Skybox lighting

Skybox Lighting enters the Map through every toolsskybox-textured Brush. Its basic properties are controlled by three Entities used in combination:
  • light_environment defines (a) the color and intensity of the Diffuse Skylight and (b) the direction, color and intensity of the Direct Sunlight.
  • It also creates (buggy, unconfigurable) Dynamic Shadows which can only be overridden/controlled by the shadow_control Entity.
  • env_sun places a glow sprite in the skybox to represent the Sun's apparent position in the sky.

To make sense of it all, just make sure you have only one of each of these entities in your map, and that the Pitch and Yaw <angles> are set the same for all three of them. (Pitch is equivalent to the Sun's Angle of Elevation from the ground, and Yaw is its Compass Bearing.)

The Sky List article suggests some settings for some of Valve's skyboxes. The worldspawn entity defines which skybox to use. Note also that env_fog_controller settings will look wrong if they don't correspond to the particular skybox in use.


Pitch <angle>
Overrides the pitch value in Angles, even if left at 0, so it needs to be specified. Contrary to Angles, the rotation of this pitch is measured counter-clockwise from the horizontal, so that 90 is straight up, while -90 is straight down. (It's simply the negative of a normal pitch value.)
Brightness <color>
Color and brightness of direct Sunlight.
Ambient <color>
Color and brightness of diffuse Skylight.
BrightnessHDR <color>
Override for Brightness when compiling HDR lighting. Defaults to -1 -1 -1 1, which means "same as LDR".
BrightnessScaleHDR <float>
Amount to scale direct light by when compiling for HDR.
AmbientHDR <color>
Override for Ambient when compiling HDR lighting. Defaults to -1 -1 -1 1, which means "same as LDR".
BrightnessScaleHDR <float>
Amount to scale ambient light by when compiling for HDR.
SunSpreadAngle (New with Source 2007) <float>
The angular extent of the sun for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value. Remember: on cloudy days, the shadows will be blurred because the sunlight is being diffused by clouds. Try 90 for hazy days, and use 135 for cloudy days, rain and fog. If you're trying a night atmosphere, sometimes you'll need up to 180. You'll also have to turn down the shadow alpha in your shadow_control entity - try changing the Shadow Color variable to something such as 50 50 50.


Pitch Yaw Roll (Y Z X) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

External links

Tutorials about Light_environment (Russian)

Lessons created by Project-S