Window lighting: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Rewrote the manual. Categorized. Removed ns:6 voodoo.)
(Rewrite Template:Lang to Template:LanguageBar. This action was performed by a bot.)
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
By default, light will only shine in through a window if the [[env_sun]] angle is set so that sunlight shines directly through it. However, real-world windows will often stream in ''refracted'' (indirect) sunlight, independent of the suns angle.
{{LanguageBar|Window lighting}}


Valve commonly uses the following technique to simulate this:
By default, light will only shine in through a window if the {{ent|light_environment}} angle is set so that sunlight shines directly through it; however, real-world windows will often stream in ''refracted'' (indirect) sunlight, independent of the suns angle.


[[Image:windowtip1.png|right|thumb|A simple window with a frame.]]
[[Valve]] commonly uses the following technique to simulate this:
 
[[File:windowtip1.png|right|thumb|A simple window with a frame.]]
1. Create the opening that you want light to refract through (such as a window).
1. Create the opening that you want light to refract through (such as a window).
{{clr}}
{{clr}}


[[Image:windowtip2.png|right|thumb|The brush-filled window.]]
[[File:windowtip2.png|right|thumb|The brush-filled window.]]
2. Cover the opening with a brush using the ''nodraw'' texture.
2. Cover the opening with a brush using the <code>toolsnodraw</code> texture.
{{clr}}
{{clr}}


[[Image:windowtip3.png|right|thumb|The brush will now emit light.]]
[[File:windowtip3.png|right|thumb|The brush will now emit light.]]
3. Texture the inward-facing side of this brush with the ''lights/white001_nochop'' texture. This particular texture emits light in-game. You can adjust the strength of this light with the "Texture scale" settings. (''Lightmap scale'' does nothing in this regard.)
3. Texture the inward-facing side of this brush with <code>lights/white001</code> or <code>lights/white001_nochop</code>. This particular texture emits light in-game. You can adjust the strength of this light with the "Texture scale" settings. Values between 0.5-1 tend to work well. The closer to zero, the brighter the light. If using the version without nochop, adjusting the "lightmap scale" will adjust the quality of the light.
{{important|Setting the brightness too high will cause an undesired effect where [[CBaseAnimating|dynamically lit models]] such as player viewmodels glow when right next to the windowsill.}}
{{clr}}
{{clr}}


[[Image:windowtip4.png|right|thumb|The properties box.]]
[[File:windowtip4.png|right|thumb|The properties box.]]
4. Tie the brush to a [[func_brush]] entity. In its properties, set '''Render Mode''' to ''Don't Render'' to will prevent the non-transparent brush from blocking the view as a white sheet. (It will still emit its light.) Unless you want the brush to simulate unbreakable glass, also set ''Solidity'' to ''Never Solid''.
4. Tie the brush to a {{ent|func_illusionary}} or {{ent|func_brush}} entity. In its properties, set ''Render Mode'' to ''Don't Render'' to will prevent the non-transparent brush from blocking the view as a white sheet. (It will still emit its light.) If using {{mono|func_brush}}, also set ''Solidity'' to ''Never Solid'' (unless you want the brush to simulate unbreakable glass).
{{note|Tying the brush to an non-rendered [[func_illusionary]] would work just as well, but this entity type has been deprecated.}}
{{note|Alternatively, use {{ent|func_null}}, to prevent wasting [[edict]]s.}}
{{clr}}
{{clr}}


[[Category:Level Design]] [[Category:Tutorials]]
[[Category:Level Design]] [[Category:Tutorials]]
[[Category:Lighting]]

Latest revision as of 17:43, 18 July 2025

English (en)Русский (ru)Translate (Translate)

By default, light will only shine in through a window if the light_environment angle is set so that sunlight shines directly through it; however, real-world windows will often stream in refracted (indirect) sunlight, independent of the suns angle.

Valve commonly uses the following technique to simulate this:

A simple window with a frame.

1. Create the opening that you want light to refract through (such as a window).

The brush-filled window.

2. Cover the opening with a brush using the toolsnodraw texture.

The brush will now emit light.

3. Texture the inward-facing side of this brush with lights/white001 or lights/white001_nochop. This particular texture emits light in-game. You can adjust the strength of this light with the "Texture scale" settings. Values between 0.5-1 tend to work well. The closer to zero, the brighter the light. If using the version without nochop, adjusting the "lightmap scale" will adjust the quality of the light.

Icon-Important.pngImportant:Setting the brightness too high will cause an undesired effect where dynamically lit models such as player viewmodels glow when right next to the windowsill.
The properties box.

4. Tie the brush to a func_illusionary or func_brush entity. In its properties, set Render Mode to Don't Render to will prevent the non-transparent brush from blocking the view as a white sheet. (It will still emit its light.) If using func_brush, also set Solidity to Never Solid (unless you want the brush to simulate unbreakable glass).

Note.pngNote:Alternatively, use func_null, to prevent wasting edicts.