Light environment: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎Entity Description: cleanup & workarounds added)
Line 4: Line 4:
==Entity Description==
==Entity Description==
[[Image:light_environment.png|left]]
[[Image:light_environment.png|left]]
The '''light_environment''' entity is a light controller, that casts directional lighting from the [[skybox]] texture. This is to approximate the light cast from the Sun.
The '''light_environment''' entity is a light controller, that casts both diffuse and parallel directional lighting from the [[tool textures|toolsskybox]] texture. This is to approximate the light cast from the Sun or Moon.
The first keyvalue, Brightness, controls direct lighting. This approximates direct sunlight. The second keyvalue, Ambient, controls indirect lighting from the sky. This is the diffused light that is cast on every face that can "see" the sky.
{{clr}}
* The ''Brightness'' keyvalue defines the colour and intensity of the direct light coming from the Sun. Direct light is cast on every surface that can "see" the Sun.  
* The ''Ambient'' keyvalue defines the colour and intensity of the diffuse light reflected from the sky/clouds. Diffuse light is cast on every face that can "see" the sky.
* The ''Pitch/Yaw/Roll'' (<angles>) keyvalue defines the direction of the sunlight coming into the map through the [[tool textures|toolsskybox]] texture.
** The [[Sky_List]] article suggests some colour, intensity and angles settings to use with the official [[Valve]] skyboxes.


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]].
{{Warning|[[light_environment]], [[env_sun]] and [[shadow_control]] should be used together. Each entity represents only a one aspect of a naturally unified phenomenon; Sunlight. [[light_environment]] defines the direct sunlight settings and creates (buggy, unconfigurable) dynamic shadows which can only be overridden/controlled by [[shadow_control]]. [[env_sun]] places a glow sprite in the skybox where the sunlight comes from. To make sense of it all, just make sure that the <angles> (Pitch/Yaw/Roll) are set the same for all three entities. Unfortunately [[shadow_control]] does not have the Pitch override parameter, so its Pitch will be determined by the first of its <angles>. Even more unfortunately, the Pitch override rotation cannot be switched off and is measured counter-clockwise from the horizontal (so straight down is -90 degrees) whereas the <angles> Pitch is rotation is clockwise (so straight down is +90 degrees).}}


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.
* Because light_environment properties are applied to the whole map, only one light_environment per map is functional. A [[3D Skybox]] does not require an extra light_environment placement. If multiple light_environment entities are placed, [[Vrad]] uses the keyvalues from the first placed light_environment to calculate the lighting.


* See also [[Lighting]] and [[Environmental Lighting, Sun, Weather, & Outdoors]]
* See also [[Lighting]] and [[Environmental Lighting, Sun, Weather, & Outdoors]]
* [[env_sun]]
{{clr}}


==Keyvalues==
==Keyvalues==

Revision as of 17:01, 14 April 2008

Template:Wrongtitle Template:Base point

Entity Description

Light environment.png

The light_environment entity is a light controller, that casts both diffuse and parallel directional lighting from the toolsskybox texture. This is to approximate the light cast from the Sun or Moon.

  • The Brightness keyvalue defines the colour and intensity of the direct light coming from the Sun. Direct light is cast on every surface that can "see" the Sun.
  • The Ambient keyvalue defines the colour and intensity of the diffuse light reflected from the sky/clouds. Diffuse light is cast on every face that can "see" the sky.
  • The Pitch/Yaw/Roll (<angles>) keyvalue defines the direction of the sunlight coming into the map through the toolsskybox texture.
    • The Sky_List article suggests some colour, intensity and angles settings to use with the official Valve skyboxes.
Warning.pngWarning:light_environment, env_sun and shadow_control should be used together. Each entity represents only a one aspect of a naturally unified phenomenon; Sunlight. light_environment defines the direct sunlight settings and creates (buggy, unconfigurable) dynamic shadows which can only be overridden/controlled by shadow_control. env_sun places a glow sprite in the skybox where the sunlight comes from. To make sense of it all, just make sure that the <angles> (Pitch/Yaw/Roll) are set the same for all three entities. Unfortunately shadow_control does not have the Pitch override parameter, so its Pitch will be determined by the first of its <angles>. Even more unfortunately, the Pitch override rotation cannot be switched off and is measured counter-clockwise from the horizontal (so straight down is -90 degrees) whereas the <angles> Pitch is rotation is clockwise (so straight down is +90 degrees).
  • Because light_environment properties are applied to the whole map, only one light_environment per map is functional. A 3D Skybox does not require an extra light_environment placement. If multiple light_environment entities are placed, Vrad uses the keyvalues from the first placed light_environment to calculate the lighting.

Keyvalues

#000000 This approximates direct sunlight.
  • _ambient
#000000 This is the diffuse light that is cast on every face that can "see" the sky.
  • _lightHDR
#000000 This approximates direct HDR sunlight. Can be left as default or be slightly less bright, since HDR is sometimes rendered brighter.
  • _ambientHDR
#000000 This is the diffuse HDR light. Can be left as default or be slightly less bright.
  • pitch
<angle> This value overrides the value of pitch in the keyvalue "angles". 90 is straight up, -90 is straight down.