Env global light: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fixed link to "shadow map")
 
(23 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{base point|env_global_light|since=Alien Swarm}} It casts an [[Wikipedia:Orthographic projection|orthographic]] [[Wikipedia:Shadow mapping|shadow map]] onto the world, centred on the camera. It is only designed to work from top-down cameras.
{{LanguageBar}}
[[File:Env_global_light_stockasw.jpg|thumb|350px]]
{{CD|CGlobalLight|file1=env_global_light.cpp}}
{{this is a|point entity|game=Alien Swarm|game1=Mapbase|name=env_global_light}}  
It casts a [[Wikipedia:Shadow mapping|shadow map]] that follows the player. Nearly identical to {{ent|sunlight_shadow_control}}.


{{Game link|Dota 2}} will be the first Valve game to use this entity.
The main difference from an {{ent|env_projectedtexture}} is that this projects [[Wikipedia:Orthographic_projection|orthographically]] (like sunlight) instead of in a radial fashion (like a lightbulb).


== Keyvalues ==
== Keyvalues ==
{{KV|Pitch Yaw Roll (Y Z X)|string|This is the light cast direction. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, and roll is the rotation around the X axis.}}
{{KV|Light Color|color255|This is the color of the sunlight.}}
{{KV|Color Transition Time|float|This is the number of seconds it takes to get from 0 to 255.}}
{{KV|Distance|float|This is the distance of the sun, greater distances produce more orthogonal shadows.}}
{{KV|FOV|float|This is the field of view that the sunlight casts in. Use lower values for more distant sun and sharper shadows.}}
{{KV|NearZ Distance|float|This controls the near clipping plane's distance from the player.}}
{{KV|North Offset|float|This offsets the from the player position where the sun is attached.}}
{{KV|Texture Name|material}}
{{KV|Enable Shadows|boolean|Enables/disables [[shadow map]]s.}}
{{KV EnableDisable}}
{{KV Targetname}}
{{KV Targetname}}
{{KV|Light Color|intn=color|color255|RGBA color of the sunlight.}}
{{KV|Color Transition Time|intn=colortransitiontime|float|This is the number of seconds it takes to get from 0 to 255.{{clarify}} }}
{{KV|Distance|intn=distance|float|Height above the player where the projection originates from.}}
{{KV|FOV|intn=fov|float|This is the field of view that the sunlight casts in. Use lower values to simulate a more distant sun and sharper shadows.}}
{{KV|NearZ Distance|intn=nearz|float|Distance from the player where the near Z plane is. Anything closer to the projection origin}}
{{KV|North Offset|intn=northoffset|float|"This offsets the from the player position where the sun is attached."{{clarify}} }}
{{KV|Texture Name|intn=texturename|material|The light texture which this entity projects.}}
{{KV|Enable Shadows|intn=enableshadows|boolean|Enables shadows. If shadows are disabled, light may appear to go through objects. Disabling shadows may be ideal for lower-detail environments due to being less [[expensive]].}}
{{KV StartDisabled}}


== Inputs ==
== Inputs ==
{{IO|LightColor|Set the light color.|param=color255}}
{{I|LightColor|Set the light color.|param=color255}}
{{IO|SetAngles|Set the sun direction.|param=string}}
{{I|SetAngles|Set the sun direction.|param=string}}
{{IO|SetDistance|Set the distance of the sun.|param=float}}
{{I|SetDistance|Set the distance of the sun.|param=float}}
{{IO|SetFOV|Set the field of view the sun casts.|param=float}}
{{I|SetFOV|Set the field of view the sun casts.|param=float}}
{{IO|SetNearZDistance|Set the near z distance.|param=float}}
{{I|SetNearZDistance|Set the near z distance.|param=float}}
{{IO|SetNorthOffset|Sets the north offset.|param=float}}
{{I|SetNorthOffset|Sets the north offset.|param=float}}
{{IO|SetTexture|Set the texture cookie of the sunlight.|param=string}}
{{I|SetTexture|Set the texture cookie of the sunlight.|param=string}}
{{IO|EnableShadows|Set whether [[shadow map]]s are enabled|param=boolean}}
{{I|EnableShadows|Set whether [[Wikipedia:Shadow mapping|shadow map]]s are enabled|param=boolean}}
{{I EnableDisable}}
{{I EnableDisable}}
{{I Targetname}}


== Outputs ==
== Dedicated Console Variables ==
{{O Targetname}}
{{varcom|start}}
{{varcom|cl_globallight_freeze|0|01|Freezes the <code>env_global_light</code> in place so that it won't follow the player.{{confirm}} }}
{{varcom|cl_globallight_xoffset|-800|dist|Offset from the player that the light originates from, along the X axis.}}
{{varcom|cl_globallight_yoffset|1600|dist|Offset from the player that the light originates from, along the Y axis.}}
{{varcom|end}}
 
[[Category:Lighting]]

Latest revision as of 06:56, 4 June 2025

English (en)Translate (Translate)
Env global light stockasw.jpg
C++ Class hierarchy
CGlobalLight
CBaseEntity
C++ env_global_light.cpp

env_global_light is a point entity available in Alien Swarm Alien Swarm and Mapbase Mapbase. It casts a shadow map that follows the player. Nearly identical to sunlight_shadow_control.

The main difference from an env_projectedtexture is that this projects orthographically (like sunlight) instead of in a radial fashion (like a lightbulb).

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Light Color (color) <color255>
RGBA color of the sunlight.
Color Transition Time (colortransitiontime) <float>
This is the number of seconds it takes to get from 0 to 255.[Clarify]
Distance (distance) <float>
Height above the player where the projection originates from.
FOV (fov) <float>
This is the field of view that the sunlight casts in. Use lower values to simulate a more distant sun and sharper shadows.
NearZ Distance (nearz) <float>
Distance from the player where the near Z plane is. Anything closer to the projection origin
North Offset (northoffset) <float>
"This offsets the from the player position where the sun is attached."[Clarify]
Texture Name (texturename) <material>
The light texture which this entity projects.
Enable Shadows (enableshadows) <boolean>
Enables shadows. If shadows are disabled, light may appear to go through objects. Disabling shadows may be ideal for lower-detail environments due to being less expensive.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Inputs

LightColor <color255RedirectInput/color32>
Set the light color.
SetAngles <stringRedirectInput/string>
Set the sun direction.
SetDistance <floatRedirectInput/float>
Set the distance of the sun.
SetFOV <floatRedirectInput/float>
Set the field of view the sun casts.
SetNearZDistance <floatRedirectInput/float>
Set the near z distance.
SetNorthOffset <floatRedirectInput/float>
Sets the north offset.
SetTexture <stringRedirectInput/string>
Set the texture cookie of the sunlight.
EnableShadows <booleanRedirectInput/boolean>
Set whether shadow maps are enabled

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Dedicated Console Variables

Cvar/Command Parameters or default value Descriptor Effect
cl_globallight_freeze 0 0 disables, 1 enables Freezes the env_global_light in place so that it won't follow the player.[confirm]
cl_globallight_xoffset -800 Hammer units Offset from the player that the light originates from, along the X axis.
cl_globallight_yoffset 1600 Hammer units Offset from the player that the light originates from, along the Y axis.