This article's documentation is for anything that uses the Source engine. Click here for more information.

Env cascade light: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Move BMS bloat to a separate page)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 6: Line 6:
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.


{{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.}}
{{important|
{{bug|
* 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.
* In {{insurgency}}, shadows will be very faint if the map hasn't been compiled with [[HDR]].
* If this entity is missing from your map, the CSM will still be created automatically!
* In {{insurgency}}, [[Naming Lights|Lightstyles]] will break when this entity exists.|hidetested=1}}
:{{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.}}
* 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.
{{codenote|
* {{src13|4}} doesn't have this entity, but there is an [https://github.com/celisej567/Fake-CSM-Mapbase attempt] of porting it.
* {{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==
Line 25: Line 28:
{{KV Angles}}
{{KV Angles}}
{{KV EnableDisable}}
{{KV EnableDisable}}
:{{bug|hidetested=1|Non-functional in {{csgo}}. Fixed in {{jb3}}.}}


==Inputs==
==Inputs==
Line 41: Line 45:
{{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}}
{{KV EnableDisable}}
{{KV EnableDisable}}
:{{bug|Doesnt work correctly in {{CSGO}}. Fixed in {{jb3}}.}}
:{{bug|Doesnt work correctly in {{CSGO}}; cascade light must be [[kill]]ed instead. Fixed in {{jb3}}.}}
 


== See also ==
== See also ==

Latest revision as of 16:31, 2 December 2025

English (en)Translate (Translate)
Edit Tabs

env_cascade_light is a logical entity available in all Source Source games since Counter-Strike: Global Offensive Counter-Strike: Global Offensive.

C++ Class hierarchy
CCascadeLight
CBaseEntity

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.

Icon-Important.pngImportant:
  • 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.pngNote:In Jabroni Brawl: Episode 3, this will only occur if both env_cascade_light and shadow_control are missing, and the BSP contains lightmap alpha.
Confirm:Strata Source probably works similarly.
Note.pngNote:Although you can toggle this entity, you can have only one env_cascade_light present in your level. Any others will not work.
Cpp.pngCode:
Icon-Bug.pngBug:
  • In Insurgency, shadows will be very faint if the map hasn't been compiled with HDR.
  • In Insurgency, 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. 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>
This is the color of the sunlight. For Counter-Strike: Global Offensive 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 theEnableinput).
Icon-Bug.pngBug:Non-functional in Counter-Strike: Global Offensive. Fixed in Jabroni Brawl: Episode 3.

Inputs

SetAngles <stringRedirectInput/string>
Sets the direction shadows cast in.
Icon-Bug.pngBug:Affects nothing.  [todo tested in ?]
LightColor <color255RedirectInput/color32>
Changes color of the sunlight.
Icon-Bug.pngBug: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.
Examples
Portal 2: Community Edition Portal 2: Community Edition uses Counter-Strike: Global Offensive Counter-Strike: Global Offensive's implementation of CSM


  (tested in: Portal 2: Community Edition)
LightColorScale  !FGD Obsolete
Deprecated.
Boosts the color of the sunlight. Non-functional, only resets the Light Color.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).
Icon-Bug.pngBug:Doesnt work correctly in Counter-Strike: Global Offensive; cascade light must be killed instead. Fixed in Jabroni Brawl: Episode 3.  [todo tested in ?]

See also