This entity makes the map's sky (specifically,
sky-textured brushes) emit light. The only practical way of lighting outdoor maps.
Attributes
- Name (targetname) - Property used to identify entities.
- Pitch, Yaw, Roll (angles) - Sets the pitch (up/down), yaw (left/right) and roll (bank) respectively.
- Pitch (pitch) - A negative number will give downward pitch (which is normally what you want).
- Brightness (_light) - The first three 3-digit numbers are the colour (RGB) and the fourth is brightness/light intensity (e.g. 248 244 237 350).
ZHLT/VHLT-specific keyvalues:
- Ambient Color (_diffuse_light) - Diffused light colour and brightness. This simulates diffuse light usually from blue sky.
- Sun Spread (_spread) - Diffuses the shadow of the sunlight. Values range from 0 to around 10 (0 being sharp shadows).
- Only Dynamic (_fake) - Treat this
light_environment
as an info_sunlight
, causing it to be ignored by HLRAD and only affect dynamic MDL lighting. Click this link for more information.
Positioning logic
Use Pitch to shift the sun (or moon) vertically (similar to daytime/hours) and Yaw to shift it horizontally (cardinal direction or obliquity)
Pitch |
Result |
0° |
Sun at the horizon (like in sunrise/sunset) - huge shadows on floor if at least a minimal amount of -pitch were given |
-45° |
Sun between horizon and top (like 9 AM or 3 PM) |
-90° |
Sun directly overhead (like 12 Noon) - only parallel shadows on floor |
Yaw |
Result |
0° |
facing RT side of the skybox |
90° |
facing BK side of the skybox |
180° |
facing LF side of the skybox |
270° |
facing FT side of the skybox |
Notes
- Don't name
light_environment
entities if you don't have to toggle the Sun/Moon on/off.
- Sky brushes must have the "SKY" texture on all faces or they won't reliably emit light (depends on version of HLRAD used).
- The key pitch have the same function as the one in angles, although if you add a value (≠0) to pitch it will overwrite the one in angles. Roll has no effect at all.
- For modern compiler, you are not advised to use multiple
light_environment
in a map. [why?] However, you can still use multiple light_environment
for multiple colors.
- This entity doesn't spawn a visible source of light in the sky. Therefore, the sun or moon must be part of the skybox as a picture for visual effects.
- The angles/angle+pitch and brightness values of this entity is used in game to override lighting on models. If the entity has direct line of sight to the sky (i.e. a "SKY" face) in the reverse direction of this
light_environment
entity's angles/angle+pitch value, its lighting will be overridden with values calculated from the brightness of this light_environment
entity.
- Having multiple
light_environment
entities confuses the game engine for the above dynamic model lighting. It will only light models with the values of the last light_environment
entity. If you need multiple sky light sources/values, use light_spot
with "Is Sky" keyvalue for everything, and an info_sunlight
for the actual model sky lighting, using an average of all the values.
- The ZHLT/VHLT keyvalues may be missing in your copy of
halflife.fgd
. To add them, open the file in Notepad (or other suitable text editor). Find the line that starts with @PointClass
and contains the text = light_environment
, and between the brackets that follow the above line, add the following lines:
_spread(integer) : "Spread Angle" : 0 : "Spread angle for soft shadows."
_diffuse_light(color255) : "Diffuse Light" : "" : "Diffuse light color."
_fake(choices) : "Only Dynamic" : "" =
[
"" : "No"
1 : "Yes"
]
Balancing Brightness, Ambient Color, and Sun Spread
Here's a very rough guide on how to balance the three values:
- On overcast skies, the ambient light should contribute more light than sunlight.
- The sun's shadow gets more diffused the more overcast the sky is
This all depends on the choice of skybox that you use. Most of them are set on a clear sky which rules out any pressing need to set the sun spread value.
Also worth mentioning the lightmap resolution is the hard limit on how sharp shadows can be.
Related pages
Example maps
pitch
into the pitch component ofangles
. World and model lighting should just work.