Intermediate Lighting: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎[[light_dynamic]]: article more relevant now)
(excuse any errors, done from memory (not final))
Line 2: Line 2:
=Introduction=
=Introduction=
{{Int lvl design}}
{{Int lvl design}}
This tutorial will cover the more advanced lighting techniques used in [[Source]] maps. If you are new to lighting in [[Valve Hammer Editor|Hammer]], you may want to read the [[Adding_Light|basic light tutorial]] first. {{todo|Flesh it all out}}
This tutorial will cover the more advanced lighting techniques used in [[Source]] maps. If you are new to lighting in [[Valve Hammer Editor|Hammer]], you may want to read the [[Adding_Light|basic light tutorial]] first. To begin all the possible ways to create light and then move onto all the settings related to lighting. It will then finish by suggesting some common ways to implement lighting.
{{clr}}
{{clr}}


=Light Entities=
=Light Entities=
This is a list and rundown of each entity you can use to cast physical light.
This is a list and rundown of each entity you can use to cast physical light. The titles for each section link to the page for the entity itself. Its important to remember that these entities cast light in some form or another.
{{todo|add more entities}}{{clr}}


==[[light]]==
==[[light]]==
[[Image:Light.png|left]]An invisible '''light''' source. Can be turned on and off through inputs.
[[Image:Light.png|left]]
This light entity is the simplest and cheapest of all lights and is the most usefull. Use this light whenever possible.{{clr}}
{{todo|add img}}
 
An invisible light source. Can be turned on and off through inputs. Able to set up with patterns given effects but cannot move locations. Light is cast in all directions from the origin of the entity. The brightness depends upon the falloff values you set up. This light entity is the simplest and cheapest of all lights and is the most usefull. Use this light whenever possible.{{clr}}


==[[light_spot]]==
==[[light_spot]]==
{{todo|add img}}


A cone-shaped, invisible light source. Can be turned on and off through inputs, though switchable lights may cause lightmap errors. This is a static spotlight that can be pointed at another entity.
A directional form of the light entity, its cone-shape allows for a directed form of light. Again it can be turned on and off through inputs, though a switchable light_spot may cause lightmap errors. This is a static light that can be pointed in any direction. And is also recommende for common use.


{{note|When using this entity, it is often necessary to turn the brightness value up significantly for the effects of the light to be visible. Values of 3000-4000 are sometimes necessary for light sources like streetlights.}}
{{note|When using this entity, it may be necessary to turn the brightness value up significantly to achive visible results. Streetlights for exmaple may need brightnesses of 3000-4000.}}


==[[light_dynamic]]==
==[[light_dynamic]]==
An invisible light source that changes over time. Can be turned on and off through inputs, and can aim at any object, including moving ones. Dynamic lights are calculated on the fly in the game, which means they have a higher processing cost but are much more flexible than static lighting. Use this type of light sparingly, because it is the most expensive light for the engine to render.
{{todo|add img}}
 
An invisible light source that can change and move over time. Itsa position can change and it can be aimed at moving objects. Dynamic lights are recalculated continuously, which means they have a higher processing cost but are much more flexible than static lighting. Use this type of light sparingly, because it is the most expensive light for the engine to render.


{{note|This entity actually consists of two lights, a cone model light and a spot world light.  Some values may affect one and not the other.}}
{{note|This entity actually consists of two lights, a cone shape light and a spot world light.  Some values may affect one and not the other.}}


==[[light_environment]]==
==[[light_environment]]==
The '''light_environment''' entity is a light controller, that casts directional lighting from the [[skybox]]. This is to approximate the light cast from the Sun.
[[Image:toolsskybox.gif|thumb|128px|right|The skybox texture]]
The first keyvalue, Brightness, controls direct lighting. This approximates direct sunlight. The second keyvalue, Ambient, controls indirect lighting from the sky. This is the diffuse light the is cast on every face that can "see" the sky.
{{todo|add img}}
 
A directional light cast in only one direction, the direction is decided by the keyvalues entered. The key is that the light is only cast from the <code>tools/toolsskybox</code> texture. The first keyvalue, Brightness, controls direct lighting. This approximates direct sunlight. The second keyvalue, Ambient, controls indirect lighting from the sky. This is the diffuse light the is cast on every face that can "see" the sky. Basically the shadow the light leaves.


If you don't want to come up with your own values for this entity, the values used in the official [[Valve]] games for each skybox, are given [[Sky_List|here]].
If you don't want to come up with your own values for this entity, the values used in the official [[Valve]] games for each skybox, are given [[Sky_List|here]].


Normally, only one light_environment entity is required per [[VMF]] file. A [[3D Skybox]] requires placement of an extra light_environment. If multiple light_environment entities are placed, [[Vrad]] uses the keyvalues from the first placed light_environment to calculate the lighting.{{clr}}
Normally, only one light_environment entity is required per level. A [[3D Skybox]] requires placement of an extra light_environment within the 3D skybox. If multiple light_environment entities are placed, [[Vrad]] uses the keyvalues from the first found light_environment to calculate the lighting.{{clr}}
 
==[[Glowing Textures|Glowing Textures]]==
{{todo|write link + add img}}
 
In a few cases its possible to make the texture itself appear bright or even to emit light. Doing so requires the use of a .vmt or .rad file and is beyond the scope of this article. Doing so can save the mapper the effort of trying to create an even lighting affect across a surface thats meant to be the lights source.{{clr}}
 
==[[env particlelight]]==
{{todo|add img}}
 
A normal light that lights only the particles created be an env_smokestack and lights nothing else. Usefull for enhancing lighting in areas with steam and such but rarely used due its specific nature.{{clr}}
 
==[[point_spotlight|(npc or point)_spotlight]]==
{{todo|add img}}
 
A straight light beam used for a spotlight affect. A mix of several affects including a flare when looking at it directly, a beam along the direction its pointing, and a light_dynamic where the beam touches the ground. While incapable of moving on its own it may be tied to a moving entity, alternatley there is the [[npc_spotlight]] option. This is exactly the same as a spotlight but is controlled by an NPC's intelgence and therefore can be controlled precisley and fluently. Due to to the dynamic light this is an expensive lighting source to render and should be used sparingly.{{clr}}


=Related Items=
=Related Items=
This is a list of all the topics related to lighting itself but don't emit light.
{{todo|add img}}
{{todo|add more items}}{{clr}}
 
This is a list of all the topics related to lighting itself but don't emit light. While none of these emit any physical light thier all essential to creating effects with it. If its controlling the lighting of entities or controlling an [[npc antlion|antlion's]] shadow they all fall under lighting effects.{{clr}}
 
==[[Info lighting]]==
{{todo|add img}}
 
This is an entity used to specify the origin from which another entity is lit. Sometimes due to drastic changes in light over short distances or complex shadows a model can appear to be lit incorrectly. By using this entity the model will be lit as though it were stationed at this location.{{clr}}


==[[env_lightglow]]==
==[[env_lightglow]]==
{{todo|add details}}{{clr}}
[[image:env_lightglow.jpg|thumb|150|right|the lightglow effect]]
{{todo|add img}}
 
Used to create a bright almost flare that will fade out at specified distances. Generally used to transition dark tunnels to bright outsides. Used as a precursor to the HDR effect to fake a change in exposure of the light.{{clr}}
 
==[[env_sun]]==
{{todo|add img}}
 
Often misinterpreted as a light that creates lighting like the sun it is instead an effect that places a flare in the sky that looks and acts like the sun. Casting no light at all it is often used with a light_enviornment to create its lighting affect.{{clr}}


==[[shadow_control]]==
==[[shadow_control]]==
{{todo|add details}}{{clr}}
{{todo|add img}}
 
Used to control all the dynamic shadows cast within the game. Shadows cast by NPC's or physics entities fall into this category. Used to line up the shadows angles so they appear correct with lighting. The one directional nature may be a problem but use of triggers to even it out should help.{{clr}}
 
==[[info_no_dynamic_shadow]]==
{{todo|add img}}
 
This forces a particular brush face to not recive any of the dynamic shadows create by physics entities or npcs. Its used rareley but may be needed to hid incorrect or bad shadows that create an icorretc look.
 
==[[env_tonemap_controller]]==
{{todo|add img}}
 
Used to control the exposure of the [[HDR]] lighting effects. Unless used with fully implemented HDR it has little/no effect.


==[[Lightmap|Lightmaps]]==
==[[Lightmap|Lightmaps]]==
{{todo|add details + write article at link}}{{clr}}
{{todo|write link + add img}}


==[[Glowing Textures|Glowing Textures]]==
A lightmap is the surface on top of each face that stores all the lighting information of a face. The stored light is then added to the face giving it brightness. The lightmap's value is the size of each pixel of light (luxel) that the lightmap stores. Smaller values means smaller luxels, thus a better resoultion and quality but higher files size and compile times.{{clr}}
{{todo|add details + write article at link}}{{clr}}


==[[Vrad]]==
==[[Vrad]]==
{{todo|add details}}{{clr}}
It is the part of the compiling process that will generate all your lighting effects, its also one of the longest parts of a compile and can often be the one you need to run the most. With no way to estimate lighting effects appart from experince it can often be tiresome to compile enough time to get a light effect right. The topic of how to compile Rad well is tackled later. For now familiraization with its features and setup should be a priority.{{clr}}


=Techniques=
=Techniques=
This covers how to use the mentioned items to create effective lighting.{{clr}}
This covers how to use the mentioned items to create effective lighting.{{clr}}
==Creating a true light source==
{{todo|talk about creating places for your light to come from and realistic sources}}{{clr}}


==Static Vs Dynamic==
==Static Vs Dynamic==
{{todo|discuss satic Vs Dynamic light, how and why}}{{clr}}
{{todo|discuss satic Vs Dynamic light, how and why}}{{clr}}


==Creating a true light source==
==Using lightmaps well==
{{todo|talk about creating places for your light to come from and realistic sources}}{{clr}}
{{todo|discuss benefits of high lightmaps and downsides, show examples, talk about tactics to achive resolution and avoid downsides}}{{clr}}
 
==Compiling RAD Well==
{{todo|how to perfect lighting effects in the shortest time, ways to estimate and work with light without compiling.}}


=Conclusion=
=Conclusion=

Revision as of 08:56, 8 June 2006

Stub

This article or section is a stub. You can help by expanding it.

Introduction

Template:Int lvl design This tutorial will cover the more advanced lighting techniques used in Source maps. If you are new to lighting in Hammer, you may want to read the basic light tutorial first. To begin all the possible ways to create light and then move onto all the settings related to lighting. It will then finish by suggesting some common ways to implement lighting.

Light Entities

This is a list and rundown of each entity you can use to cast physical light. The titles for each section link to the page for the entity itself. Its important to remember that these entities cast light in some form or another.

light

Light.png
Todo: add img

An invisible light source. Can be turned on and off through inputs. Able to set up with patterns given effects but cannot move locations. Light is cast in all directions from the origin of the entity. The brightness depends upon the falloff values you set up. This light entity is the simplest and cheapest of all lights and is the most usefull. Use this light whenever possible.

light_spot

Todo: add img

A directional form of the light entity, its cone-shape allows for a directed form of light. Again it can be turned on and off through inputs, though a switchable light_spot may cause lightmap errors. This is a static light that can be pointed in any direction. And is also recommende for common use.

Note.pngNote:When using this entity, it may be necessary to turn the brightness value up significantly to achive visible results. Streetlights for exmaple may need brightnesses of 3000-4000.

light_dynamic

Todo: add img

An invisible light source that can change and move over time. Itsa position can change and it can be aimed at moving objects. Dynamic lights are recalculated continuously, which means they have a higher processing cost but are much more flexible than static lighting. Use this type of light sparingly, because it is the most expensive light for the engine to render.

Note.pngNote:This entity actually consists of two lights, a cone shape light and a spot world light. Some values may affect one and not the other.

light_environment

The skybox texture
Todo: add img

A directional light cast in only one direction, the direction is decided by the keyvalues entered. The key is that the light is only cast from the tools/toolsskybox texture. The first keyvalue, Brightness, controls direct lighting. This approximates direct sunlight. The second keyvalue, Ambient, controls indirect lighting from the sky. This is the diffuse light the is cast on every face that can "see" the sky. Basically the shadow the light leaves.

If you don't want to come up with your own values for this entity, the values used in the official Valve games for each skybox, are given here.

Normally, only one light_environment entity is required per level. A 3D Skybox requires placement of an extra light_environment within the 3D skybox. If multiple light_environment entities are placed, Vrad uses the keyvalues from the first found light_environment to calculate the lighting.

Glowing Textures

Todo: write link + add img

In a few cases its possible to make the texture itself appear bright or even to emit light. Doing so requires the use of a .vmt or .rad file and is beyond the scope of this article. Doing so can save the mapper the effort of trying to create an even lighting affect across a surface thats meant to be the lights source.

env particlelight

Todo: add img

A normal light that lights only the particles created be an env_smokestack and lights nothing else. Usefull for enhancing lighting in areas with steam and such but rarely used due its specific nature.

(npc or point)_spotlight

Todo: add img

A straight light beam used for a spotlight affect. A mix of several affects including a flare when looking at it directly, a beam along the direction its pointing, and a light_dynamic where the beam touches the ground. While incapable of moving on its own it may be tied to a moving entity, alternatley there is the npc_spotlight option. This is exactly the same as a spotlight but is controlled by an NPC's intelgence and therefore can be controlled precisley and fluently. Due to to the dynamic light this is an expensive lighting source to render and should be used sparingly.

Related Items

Todo: add img

This is a list of all the topics related to lighting itself but don't emit light. While none of these emit any physical light thier all essential to creating effects with it. If its controlling the lighting of entities or controlling an antlion's shadow they all fall under lighting effects.

Info lighting

Todo: add img

This is an entity used to specify the origin from which another entity is lit. Sometimes due to drastic changes in light over short distances or complex shadows a model can appear to be lit incorrectly. By using this entity the model will be lit as though it were stationed at this location.

env_lightglow

the lightglow effect
Todo: add img

Used to create a bright almost flare that will fade out at specified distances. Generally used to transition dark tunnels to bright outsides. Used as a precursor to the HDR effect to fake a change in exposure of the light.

env_sun

Todo: add img

Often misinterpreted as a light that creates lighting like the sun it is instead an effect that places a flare in the sky that looks and acts like the sun. Casting no light at all it is often used with a light_enviornment to create its lighting affect.

shadow_control

Todo: add img

Used to control all the dynamic shadows cast within the game. Shadows cast by NPC's or physics entities fall into this category. Used to line up the shadows angles so they appear correct with lighting. The one directional nature may be a problem but use of triggers to even it out should help.

info_no_dynamic_shadow

Todo: add img

This forces a particular brush face to not recive any of the dynamic shadows create by physics entities or npcs. Its used rareley but may be needed to hid incorrect or bad shadows that create an icorretc look.

env_tonemap_controller

Todo: add img

Used to control the exposure of the HDR lighting effects. Unless used with fully implemented HDR it has little/no effect.

Lightmaps

Todo: write link + add img

A lightmap is the surface on top of each face that stores all the lighting information of a face. The stored light is then added to the face giving it brightness. The lightmap's value is the size of each pixel of light (luxel) that the lightmap stores. Smaller values means smaller luxels, thus a better resoultion and quality but higher files size and compile times.

Vrad

It is the part of the compiling process that will generate all your lighting effects, its also one of the longest parts of a compile and can often be the one you need to run the most. With no way to estimate lighting effects appart from experince it can often be tiresome to compile enough time to get a light effect right. The topic of how to compile Rad well is tackled later. For now familiraization with its features and setup should be a priority.

Techniques

This covers how to use the mentioned items to create effective lighting.

Creating a true light source

Todo: talk about creating places for your light to come from and realistic sources

Static Vs Dynamic

Todo: discuss satic Vs Dynamic light, how and why

Using lightmaps well

Todo: discuss benefits of high lightmaps and downsides, show examples, talk about tactics to achive resolution and avoid downsides

Compiling RAD Well

Todo: how to perfect lighting effects in the shortest time, ways to estimate and work with light without compiling.

Conclusion

This covers the base of all lighting effects. Any lighting affect that can be achived is a mixture of all or some of these effects.

Todo: create nav bar