light_environment Last edited 3 months ago2024-09-15 09:15:23 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

light_environment - Point Entity

This entity makes the map's sky (i.e. User posted image sky-textured brushes) emit parallel beams of light in the specified direction, just like real world sunlight/moonlight. The only practical way of lighting outdoor maps.

The game also uses the angles and brightness of this entity to override lighting on models if they can trace a line back towards the sky from the reverse direction of this entity's angles. The tutorial on models and lighting has more information on this.

Attributes

ZHLT/VHLT-specific keyvalues:

Positioning logic

Use the Pitch in Pitch Yaw Roll (angles) (and optionally also Pitch) to shift the sun (or moon) vertically (similar to daytime/hours) and Yaw to shift it horizontally (cardinal direction or obliquity)
Pitch Result
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
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

_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
User posted image
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.

Example maps

1 Comment

Commented 3 months ago2024-09-15 15:09:55 UTC Comment #106399
NOTE TO SELF: VHLT rolls pitch into the pitch component of angles. World and model lighting should just work.

You must log in to post a comment. You can login or register a new account.