Window lighting: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with 'This is an ongoing list of tips and tricks I have picked up from Valve's maps and elsewhere. Feel free to add to this with anything else you feel is useful. ==Window Lighting== …')
 
(Rewrite Template:Lang to Template:LanguageBar. This action was performed by a bot.)
 
(18 intermediate revisions by 9 users not shown)
Line 1: Line 1:
This is an ongoing list of tips and tricks I have picked up from Valve's maps and elsewhere. Feel free to add to this with anything else you feel is useful.
{{LanguageBar|Window lighting}}


==Window Lighting==
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.


Ever wanted to illuminate a room with outside light streaming in through the windows, but the sun's facing the wrong way? Here's a solution that Valve use commonly...
[[Valve]] commonly uses the following technique to simulate this:
 
Here's your window frame.
 
[[{{ns:6}}:windowtip1.png|A simple window with a frame.]]


[[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).
{{clr}}
{{clr}}


With the ''nodraw'' texture, create a brush the same width as your wall that completely fills your window.
[[File:windowtip2.png|right|thumb|The brush-filled window.]]
 
2. Cover the opening with a brush using the <code>toolsnodraw</code> texture.
[[{{ns:6}}:windowtip2.png|The brush-filled window.]]
 
{{clr}}
{{clr}}


Texture the inward-facing side of this brush with the ''lights/white001_nochop'' texture. This is the texture that will be emitting the light.
[[File:windowtip3.png|right|thumb|The brush will now emit light.]]
 
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.
[[{{ns:6}}:windowtip3.png|The brush will now emit 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}}


This is all very well but not completely what we want. In this state, the light-emitting brush will be solid and visible in-game and will block leaf visibility, seeing as it is not yet a brush entity.
[[File:windowtip4.png|right|thumb|The properties box.]]
 
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).
For the next step, tie the light-emitting brush to a ''func_illusionary.'' In the properties, set '''Render Mode''' to ''Don't Render.''
{{note|Alternatively, use {{ent|func_null}}, to prevent wasting [[edict]]s.}}
 
[[{{ns:6}}:windowtip4.png|The properties box.]]
 
{{clr}}
{{clr}}


This will ensure that the brush is invisible and doesn't collide in-game, but will cast light into the room when the map is compiled.
[[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.