Setting Up Sky and Sunlight (light_environment + Skybox)

April 23, 2026 Daemon666 8 min read

Outdoor lighting in GoldSrc is two cooperating pieces: a light_environment entity that hlrad uses as the sun, and a skybox — brushes textured with SKY plus the six gfx/env/ images the engine draws behind them. Get both right and the map has directional sunlight and a real sky; get one wrong and you have flat lighting or a black void overhead. Here is the correct setup.

1. Place exactly one light_environment

A map should have one light_environment. It is not a positional light — its location does not matter — it defines the sun for the whole level. Place it anywhere convenient and set its properties:

classname   light_environment
_light      255 255 200 200     // R G B brightness
pitch       -45                 // sun elevation, negative points down
angle       135                 // sun compass direction (yaw)

The _light value is the sun colour and intensity; the fourth number is brightness. Warm sun is high R/G with slightly lower B; a harsh noon sun is near-white and bright. Multiple light_environment entities fight each other — keep exactly one.

2. Aim the sun with angle and pitch

Two fields set the sun direction. angle is the yaw (compass heading the light comes from), and pitch is the vertical angle — negative pitch points the sun downward toward the ground, which is what you want for daylight. A pitch of -90 is directly overhead (short shadows); -25 is a low, long-shadow evening sun. Note that in some tools the angles/pitch keys interact, so set pitch explicitly rather than relying on the angle circle alone, or shadows point the wrong way.

3. Texture the sky with the SKY texture

The engine only draws the skybox where it sees the SKY tool texture. Cap every opening to the outdoors — the top of your outdoor area, window gaps to the sky — with brushes faced in SKY. hlrad also emits the sun light through SKY faces, so the sun only reaches the ground where a SKY brush lets it in. No SKY face means no sky drawn and no sunlight entering. Face the hidden sides of those brushes with NULL as usual.

4. Set the skybox name

The six sky images live in gfx/env/ and are named after your sky with directional suffixes:

gfx/env/desert_up.tga
gfx/env/desert_dn.tga
gfx/env/desert_lf.tga
gfx/env/desert_rt.tga
gfx/env/desert_ft.tga
gfx/env/desert_bk.tga

Tell the map which set to use by putting the base name (here desert) in the map's environment map / skybox field — in Hammer, Map → Map Properties → environment map (cl_skyname). The engine appends the six suffixes automatically. The name must match the files exactly, or the sky is blank. CS ships several stock skies; a custom one must be delivered to players (list all six in your .res file).

5. Add fill light so shadows are not pure black

light_environment gives you the sun and its shadows, but shadowed areas can go almost black. The _light ambient handling in ZHLT/VHLT adds a base ambient, but for interiors and deep shade add ordinary light entities to lift the darkness. This is the same balancing act covered in map lighting basics.

Common errors

  • Lighting is flat, no shadowspitch is 0 or positive so the sun points up/level. Set a negative pitch like -45.
  • Sky area is black / no sky drawn — the opening is not faced with the SKY texture, or cl_skyname is unset. Add SKY brushes and set the sky name.
  • Sunlight does not reach the ground — there is no SKY face for the sun to pass through. The sun enters only through SKY faces.
  • Sky is blank for players but fine for you — custom sky images are not delivered. List all six gfx/env/ files in the .res.
  • Two suns / weird double shadows — more than one light_environment. Delete all but one.

Verification

Compile with a full hlrad pass, load the map outdoors, and check three things: the sky renders overhead (not black), the sun casts shadows in the direction your angle/pitch imply, and shaded areas are dark but not pitch black. Rotate to face the sun and confirm the light comes from where you aimed it. If the sky is blank on a clean client, the custom sky files are missing from delivery; if shadows point up, fix the pitch. Then round out interior lighting with lighting basics.

Współtwórcy: Daemon666 ✦
Udostępnij: