Env cascade light: Difference between revisions
Jump to navigation
Jump to search

Important:
Note:Although you can toggle this entity, you can have only one env_cascade_light present in your level. Any others will not work.
Code:
Bug:
Bug:Doesn't work as expected. The color only changes on static props, not on world geometry or dynamic objects. It only changes the shadow color (only in world geometry, not in models), with no change upon reloading the game.
(tested in:
)
MyGamepedia (talk | contribs) |
SirYodaJedi (talk | contribs) (oops) |
||
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{LanguageBar}} | {{LanguageBar}} | ||
{{This is a|logical entity|name=env_cascade_light|since=Counter-Strike: Global Offensive|notext=1 | {{tabsBar|main=env_cascade_light}} | ||
{{This is a|logical entity|name=env_cascade_light|since=Counter-Strike: Global Offensive|notext=1}} | |||
{{CD|CCascadeLight}} | {{CD|CCascadeLight}} | ||
[[File:CSM Example.jpg|thumb|CSM in {{csgo|4.1}}]] | [[File:CSM Example.jpg|thumb|CSM in {{csgo|4.1}}]] | ||
It casts an extremely accurate shadow map via the <code>tools/tools[[skybox]]</code> texture, augmenting the lighting cast by {{ent|light_environment}} with real-time shadows. This form of shadow mapping is known as '''[https://learn.microsoft.com/en-us/windows/win32/dxtecharts/cascaded-shadow-maps Cascaded Shadow Maps]''', or '''CSM''' for short, which works by rendering very detailed shadow maps which becomes a lower and lower resolution depending on the distance the viewer is from the surface, similar to [[mipmaps]]. Some games automatically add this entity to the map, but it can be placed manually as well. | It casts an extremely accurate shadow map via the <code>tools/tools[[skybox]]</code> texture, augmenting the lighting cast by {{ent|light_environment}} with real-time shadows. This form of shadow mapping is known as '''[https://learn.microsoft.com/en-us/windows/win32/dxtecharts/cascaded-shadow-maps Cascaded Shadow Maps]''', or '''CSM''' for short, which works by rendering very detailed shadow maps which becomes a lower and lower resolution depending on the distance the viewer is from the surface, similar to [[mipmaps]]. Some games automatically add this entity to the map, but it can be placed manually as well. | ||
{{ | {{important| | ||
{{ | * You still need to have a {{ent|light_environment}} in your map as well to create [[lightmap]] based lighting, which is not done by this entity. CSM relies upon a fifth channel <!--first 4 channels are RGB and exponent, even in non-HDR mode--> in the lightmap to mask dark and light areas. | ||
* If this entity is missing from your map, the CSM will still be created automatically! | |||
:{{note|In {{jb3}}, this will only occur if both {{ent|env_cascade_light}} and {{ent|shadow_control}} are missing, and the BSP contains lightmap alpha. {{confirm|{{strata}} probably works similarly.}} }} | |||
}} | |||
{{note| | {{note|Although you can toggle this entity, you can have only one {{ent|env_cascade_light}} present in your level. Any others will not work.}} | ||
{{codenote| | |||
* {{src13|4}} doesn't have this entity, but there is an [https://github.com/celisej567/Fake-CSM-Mapbase attempt] of | * {{src13|4}} doesn't have this entity, but there is an [https://github.com/celisej567/Fake-CSM-Mapbase attempt] of simulating it. | ||
* {{asd|4}}'s counterpart to this entity is {{ent|Light_deferred_global}}{{also|{{lw}}}} | * {{asd|4}}'s counterpart to this entity is {{ent|Light_deferred_global}}{{also|{{lw}}}} | ||
* You alternatively can [[Implementing_Deferred_lighting_into_Source_2013|implement]] {{lw|4}}'s Deferred lighting as it is the most robust implementation currently being available to the public. | * You alternatively can [[Implementing_Deferred_lighting_into_Source_2013|implement]] {{lw|4}}'s Deferred lighting as it is the most robust implementation currently being available to the public. | ||
}} | }} | ||
{{ | {{bug| | ||
* {{ | * In {{insurgency}}, shadows will be very faint if the map hasn't been compiled with [[HDR]]. | ||
* | * In {{insurgency}}, [[lightstyle]]s will break when this entity exists.|hidetested=1}} | ||
==Keyvalues== | ==Keyvalues== | ||
{{KV Targetname}} | {{KV Targetname}} | ||
{{KV|Light Color|intn=color|color255|This is the color of the sunlight. For {{csgo|4}}, the color is automatically copied from the {{ent|light_environment}}. | {{KV|Light Color|intn=color|color255|This is the color of the sunlight. For {{csgo|4}}, the color is automatically copied from the {{ent|light_environment}}.}} | ||
}} | |||
{{KV|Max shadow distance|intn=maxshadowdistance|float|Maximum dynamic shadow distance. Higher values are slower, default on PC is 400 units.}} | {{KV|Max shadow distance|intn=maxshadowdistance|float|Maximum dynamic shadow distance. Higher values are slower, default on PC is 400 units.}} | ||
{{KV|Use light_environment's angles|intn=uselightenvangles|bool|If true, the CSM shadow angles are automatically taken from a {{ent|light_environment}}'s angles. If false, this entity's | {{KV|Use light_environment's angles|intn=uselightenvangles|bool|If true, the CSM shadow angles are automatically taken from a {{ent|light_environment}}'s angles. If false, this entity's angles is used.}} | ||
{{KV | {{KV Angles}} | ||
{{KV | {{KV StartDisabled}} | ||
{{ | :{{bug|hidetested=1|Non-functional in {{csgo}}. Fixed in {{jb3}}.}} | ||
==Inputs== | ==Inputs== | ||
{{I|SetAngles|Sets the direction shadows cast in.|param=string}} | {{I|SetAngles|Sets the direction shadows cast in.|param=string}} | ||
:{{ | :{{bug|Affects nothing.}} | ||
{{I|LightColor|Changes color of the sunlight.|param=color255}} | {{I|LightColor|Changes color of the sunlight.|param=color255}} | ||
<dd>{{bug|Doesn't work as expected. | <dd>{{bug|Doesn't work as expected. The color only changes on static props, not on world geometry or dynamic objects. It only changes the shadow color (only in world geometry, not in models), with no change upon reloading the game. | ||
{{expand|title=Examples|noborder=1|1= | {{expand|title=Examples|noborder=1|1= | ||
{{p2ce|4.1}} uses {{csgo|4.1}}'s implementation of CSM | {{p2ce|4.1}} uses {{csgo|4.1}}'s implementation of CSM | ||
<br> | <br> | ||
<gallery mode=nolines widths=320px heights=250px> | <gallery mode=nolines widths=320px heights=250px> | ||
| Line 52: | Line 42: | ||
File:afterCSMLC.jpg|After <code>ent_fire env_cascade_light lightcolor 255 0 0 255</code>. | File:afterCSMLC.jpg|After <code>ent_fire env_cascade_light lightcolor 255 0 0 255</code>. | ||
</gallery> | </gallery> | ||
}}|tested={{p2ce}}}}</dd> | |||
}}|tested={{p2ce | |||
{{I|LightColorScale|Boosts the color of the sunlight. Non-functional, only resets the Light Color.|nofgd=1|deprecated=1}} | {{I|LightColorScale|Boosts the color of the sunlight. Non-functional, only resets the Light Color.|nofgd=1|deprecated=1}} | ||
{{I EnableDisable}} | |||
:{{bug|Doesnt work correctly in {{CSGO}}; cascade light must be [[kill]]ed instead. Fixed in {{jb3}}.}} | |||
{{I | |||
:{{ | |||
{{ | |||
== See also == | == See also == | ||
* {{ent|light_environment}} - baked static sunlight | * {{ent|light_environment}} - baked static sunlight | ||
* {{ent|Shadow_control}} - dynamic shadows | * {{ent|Shadow_control}} - dynamic shadows | ||
| Line 120: | Line 55: | ||
* [[Advanced Lighting]] | * [[Advanced Lighting]] | ||
* [[Effect flags]] (dynamic light effects) | * [[Effect flags]] (dynamic light effects) | ||
[[Category:Lighting]] | [[Category:Lighting]] | ||
Latest revision as of 17:24, 3 December 2025
env_cascade_light is a logical entity available in all
Source games since
Counter-Strike: Global Offensive.
| CCascadeLight |
It casts an extremely accurate shadow map via the tools/toolsskybox texture, augmenting the lighting cast by light_environment with real-time shadows. This form of shadow mapping is known as Cascaded Shadow Maps, or CSM for short, which works by rendering very detailed shadow maps which becomes a lower and lower resolution depending on the distance the viewer is from the surface, similar to mipmaps. Some games automatically add this entity to the map, but it can be placed manually as well.
- You still need to have a light_environment in your map as well to create lightmap based lighting, which is not done by this entity. CSM relies upon a fifth channel in the lightmap to mask dark and light areas.
- If this entity is missing from your map, the CSM will still be created automatically!
Note:In
, this will only occur if both env_cascade_light and shadow_control are missing, and the BSP contains lightmap alpha.
Source 2013 doesn't have this entity, but there is an attempt of simulating it.
Alien Swarm Deferred's counterpart to this entity is Light_deferred_global(also in
)- You alternatively can implement
Lambda Wars's Deferred lighting as it is the most robust implementation currently being available to the public.
- In
, shadows will be very faint if the map hasn't been compiled with HDR. - In
, lightstyles will break when this entity exists.
Keyvalues
- Name (targetname) <string>
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentnameortarget).
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>
- This is the color of the sunlight. For
Counter-Strike: Global Offensive, the color is automatically copied from the light_environment.
- Max shadow distance (maxshadowdistance) <float>
- Maximum dynamic shadow distance. Higher values are slower, default on PC is 400 units.
- Use light_environment's angles (uselightenvangles) <boolean>
- If true, the CSM shadow angles are automatically taken from a light_environment's angles. If false, this entity's angles is used.
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
- This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
- Start Disabled (StartDisabled) <boolean>
- Stay dormant until activated (with the
Enableinput).
Inputs
- LightColor <color255>
- Changes color of the sunlight.
|
LightColorScale!FGD
- Deprecated.
Boosts the color of the sunlight. Non-functional, only resets the Light Color.
EnableDisable:
- Enable / Disable
- Enable/disable this entity from performing its task. It might also disappear from view.
See also
- light_environment - baked static sunlight
- Shadow_control - dynamic shadows
- env_sun - glowing sun effect
- Skybox Basics
- Skybox lighting
- Advanced Lighting
- Effect flags (dynamic light effects)