Lighting

From Valve Developer Community
Revision as of 09:04, 14 April 2008 by Beeswax (talk | contribs) (a bit more structuring)
Jump to navigation Jump to search
Abstract Mapping series Discuss your thoughts - Help us develop the articles or ideas you want

Ammunition | List of HL2 Animals and Creatures | Mapping with Antlions | Beams and Lasers | Cables and Ropes | Moving Clouds | Color Theory in Level Design | Combat | Combine | Compression (Source 1) | Doors | Dust, Fog, & Smoke | Elevators | Level Transitions | Environmental Lighting, Sun, Weather, & Outdoors | Explosions | Fire | Half-Life 2 Foliage | Glass & Windows | Headcrab | Health | Ladders | Lighting | Optimization (level design) | Physics | Retinal scanners | Sound and Music | Special effects | Terrain | Trains | Turrets | Water | Weapons | Zombie


Guides

Entities

Static light sources

  • Note: static lighting is compiled into Lightmaps (which illuminate World Brushes) and Cubemaps (which illuminate World Models).
light
A static, omni-directional Radial light source. (eg a naked light bulb or flame.)
light_spot
A static, uni-directional Radial light source. (eg most light fittings.) The conical beam angle cannot exceed 90°.
light_environment
Includes 2 light sources; a Diffuse light (eg reflected from overhead clouds/sky) and a Parallel light (eg Direct Sun or Moonlight). Both are emitted from the toolsskybox material wherever it is used on a map. See also Skybox.
env_particlelight
Illuminates only particles produced by env_smokestack. Particles are not affected by normal lighting. Use (no more than) two of these to make (only) env_smokestack particles appear to reflect ambient lighting.

Dynamic light sources

env_projectedtexture shines from a doorway.
  • Note: dynamic lighting is calculated at runtime, which makes it very expensive to render.
light_dynamic
A combination point light and spotlight that can be moved, turned, and adjusted.
point_spotlight
A moveable spotlight (directional) glow, with a dynamic light source.
npc_spotlight
A spotlight NPC capable of tracking targets.
env_projectedtexture
A dynamic light that lights using a texture rather than a solid colour, and which also casts realistic dynamic shadows. Affects all surfaces that can accept lighting, and is used for the player flashlight in Episode Two.

Shadows

shadow_control
Controls dynamically projected shadows (produced by player models, NPCs, and physics props) in the entire map.
info_no_dynamic_shadow
Used to mark surfaces that shouldn't receive dynamic shadows. Useful to apply to walls and floors where shadows are drawn improperly, giving away the location of enemies.

Atmospheric light effects

  • Halo (Glow Sprite) effects :
  • env_sprite - entity used to create omni-directional glow or flare effects.
  • env_lightglow - an asymmetrical glow (for areas of contrasting light).
  • env_sun - adds a bright haloed spot to the Skybox to represent the position of the Sun or Moon.
  • Brush texture : models/effects/vol_light001
  • Brush texture : models/effects/vol_light002
  • Model : models/Effects/vol_light.mdl - use with prop_static.


Common values

City 17 day
Brightness 237 218 143 800
Ambience 190 201 220 100
Ravenholm night
Brightness 175 230 239 50
Ambience 43 45 57 5
Combine lamp
Brightness 147 226 240 3000
Ambience N/A
Tungsten bulb
Brightness 254 216 146
Ambience N/A
Fluorescent bulb
Brightness 159 237 215
Ambience N/A

For values to accompany the stock skybox materials, see Sky List.

Notes

  • Naming a light makes it more expensive. Only name lights when you need to. Multiple lights sharing the same name are cheaper than lights with separate names.
  • light_dynamic is especially expensive, and will not even show up on some systems
  • The basic light entities do not come with a visible representation (e.g. a lightbulb). For that you need a prop. See HL2 light props for a list.
  • The basic light entities do not come with a "glow" as you'd expect to see in a foggy or misty area. To provide this, either compile and run the map with HDR enabled, or add a point_spotlight (with dynamic lighting off unless needed) or env_lightglow entity.
  • Maps will not be lit unless you run vrad (or equivalent). Vrad will not run properly and will not calculate realistic light bounces unless the level is free of leaks.
  • Several textures provide their own light & can do so using lights.rad in a mod's directory or the one in sourcesdk/bin.
  • Moving brushed-based objects will not change the way they are lit. Their lighting will be calculated only according to their positions in Hammer. (e.g. a brush in a dark room will not become bright if it is brought into a bright room.)

Console commands

  • mat_fullbright boolean — Toggles map lighting

See also

External links