Lighting: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (sdk nuts link commented out & minor tidy)
Line 1: Line 1:
{{Abstract Mapping}}
{{Abstract Mapping}}
__NOTOC__
__NOTOC__
==Guides==
== Guides ==
*[[Adding Light]] - A beginners tutorial on how to set up a basic [[light]] entity.
*[[Adding Light]] - A beginners tutorial on how to set up a basic [[light]] entity.
*[[Intermediate Lighting]] - A tutorial dealing with all the light sources in more detail.
*[[Intermediate Lighting]] - A tutorial dealing with all the light sources in more detail.
Line 7: Line 8:
*[[Constant-Linear-Quadratic Falloff]] - An easy-to-read explanation of the old C-L-Q light attenuation system.
*[[Constant-Linear-Quadratic Falloff]] - An easy-to-read explanation of the old C-L-Q light attenuation system.


==Entities==
== Entities ==
===Stationary light sources===
=== Stationary light sources ===
*[[light]] — a simple omni-directional light
*[[light]] — a simple omni-directional light
*[[light_environment]] — light from [[Tool textures#skybox|toolsskybox]] materials
*[[light_environment]] — light from [[Tool textures#skybox|toolsskybox]] materials
*[[light_spot]] — a stationary spotlight
*[[light_spot]] — a stationary spotlight


===Moving light sources===
=== Moving light sources ===
*[[light_dynamic]] — a combination point light and spotlight that can be moved, turned, and adjusted.
*[[light_dynamic]] — a combination point light and spotlight that can be moved, turned, and adjusted.
*[[npc_spotlight]] — a spotlight [[NPC]] capable of tracking targets.
*[[npc_spotlight]] — a spotlight [[NPC]] capable of tracking targets.


===Other light effect entities===
=== Other light effect entities ===
The following entities are primarily just visual effects from light, meaning they do not cast light on their surroundings.
The following entities are primarily just visual effects from light, meaning they do not cast light on their surroundings.
*[[env_sprite]] — entity used to create omni-directional glow or flare effects.
*[[env_sprite]] — entity used to create omni-directional glow or flare effects.
Line 27: Line 28:
*[[env_particlelight]] — only lights particles (such as those produced by [[env_smokestack]]).
*[[env_particlelight]] — only lights particles (such as those produced by [[env_smokestack]]).


==Common values==
== Common values ==
;City 17 day
;City 17 day
:Brightness <code>237 218 143 800</code>
:Brightness <code>237 218 143 800</code>
Line 45: Line 46:
For values to accompany the stock [[skybox]] materials, see [[Sky List]].
For values to accompany the stock [[skybox]] materials, see [[Sky List]].


==Notes==
== 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.
*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
*[[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 (eg, a lightbulb). For that you need a prop. See [[HL2 light props]] for a list.
*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.
*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 [[leak]]s.
*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 [[leak]]s.
*Several textures provide their own light & can do so using <code>[[lights.rad]]</code> in a mod's directory or the one in <code>sourcesdk/bin</code>.
*Several textures provide their own light & can do so using <code>[[lights.rad]]</code> in a mod's directory or the one in <code>sourcesdk/bin</code>.
*Moving brushed-based objects will not change the way they are lit. Their lighting will be calculated only according to thier positions in Hammer. (eg. a brush in a dark room will not become bright if it is brought into a bright room.)
*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==
== [[Console command]]s ==
*<code>mat_fullbright [[boolean]]</code> &mdash; Toggles map lighting
*<code>mat_fullbright [[boolean]]</code> &mdash; Toggles map lighting


==See also==
== See also ==
*[[HL2 light props]]
*[[HL2 light props]]
*[[Color theory (level design)]]
*[[Color theory (level design)]]
Line 67: Line 68:
*[http://www.freewebs.com/flashsjunk/lightingtutorial.htm Lighting Tutorial] - Covers entities & variables with examples
*[http://www.freewebs.com/flashsjunk/lightingtutorial.htm Lighting Tutorial] - Covers entities & variables with examples
*[http://www.editlife.net/tutorials.php?id=15 Quadratic/Linear/Constant in Lights]
*[http://www.editlife.net/tutorials.php?id=15 Quadratic/Linear/Constant in Lights]
<!-- SDK nuts has closed. When (and if) this tutorial is ported onto the VDC, please link to it instead!
*[http://www.sdknuts.net/akg/?sdk=tutlights HDR/Shaped Light/Burning Light/Darkness/Sun/Volumetric]
*[http://www.sdknuts.net/akg/?sdk=tutlights HDR/Shaped Light/Burning Light/Darkness/Sun/Volumetric]
-->

Revision as of 13:48, 13 February 2008

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

Stationary light sources

Moving light sources

  • light_dynamic — a combination point light and spotlight that can be moved, turned, and adjusted.
  • npc_spotlight — a spotlight NPC capable of tracking targets.

Other light effect entities

The following entities are primarily just visual effects from light, meaning they do not cast light on their surroundings.

  • env_sprite — entity used to create omni-directional glow or flare effects.
  • point_spotlight — a moveable spotlight (directional) glow, with an optional dynamic light source.
  • env_lightglow — an asymmetrical glow (for areas of contrasting light).
  • The models/effects/vol_light001 and models/effects/vol_light002 textures, used for volumetric lighting.
  • prop_static — This entity can be used together with the models/Effects/vol_light.mdl model to simulate basic volumetric light.
  • env_sun — visual effect of the sun in the sky.
  • env_particlelight — only lights particles (such as those produced by env_smokestack).

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