Env cascade light

From Valve Developer Community
Revision as of 11:12, 6 February 2024 by Equalizer5118 (talk | contribs) (→‎Inputs: fixed broken english)
Jump to navigation Jump to search
English (en)Translate (Translate)

It is also available in Black Mesa Black Mesa

While Alien Swarm Deferred Alien Swarm Deferred doesn't have support for this entity its Light environment does cast dynamic shadows by default.

Comparison of CSM and without CSM in Black Mesa
(Click to preview)

It casts an extremely accurate shadow map via the tools/skybox texture, acting as a real-time variation of light_environment. This form of lighting is known as Cascaded Shadow Maps, or CSM, 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.pngNote:Due to lighting changes in Black Mesa, this entity has additional parameters.
Note.pngNote:Black Mesa Black Mesa's implementation requires -cascadeshadows parameter for VRAD, this for CSM to work correctly.
Icon-Bug.pngBug:In Insurgency, shadows will be very faint if the map hasn't been compiled with HDR.  [todo tested in ?]
Icon-Bug.pngBug:In Insurgency, Lightstyles will break when this entity exists.  [todo tested in ?]
Note.pngNote: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.
Note.pngNote:Older games like Half-Life 2 don't have this entity, but there is an attempt of porting it.
Note.pngNote:You alternatively can implement Biohazards deferred lighting here is a port for Source 2013 Multiplayer Source 2013 Multiplayer as originally it was made for Alien Swarm Alien Swarm.
Warning.pngWarning:This port contains many bugs, optimization is broken or missing, even on simple maps there will be low performance.
Todo: Make tutorial on how to implement deferred lighting in your source engine project, and also how to use it.

Counter-Strike: Global Offensive Represented by class CCascadeLight.

Keyvalues

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 Pitch Yaw Roll is used.
LightRadius1 (LightRadius1) to LightRadius3 <float> (only in Black Mesa)
Used for controlling shadow softness in cascades 1, 2, and 3.
Depthbias1 (Depthbias1) to Depthbias3 <float> (only in Black Mesa)
DepthBias for cascades 1, 2, and 3.
Slopescaledepthbias1 (Slopescaledepthbias1) to Slopescaledepthbias3 <float> (only in Black Mesa)
Slope DepthBias for cascades 1, 2, and 3.
ViewModelDepthbias (ViewModelDepthbias) <float> (only in Black Mesa)
DepthBias for viewmodel cascade.
ViewModelSlopescaledepthbias (ViewModelSlopescaledepthbias) <float> (only in Black Mesa)
DepthBias for viewmodel cascade.
CSM_Volume_Mode (CSMVolumeMode) <choices> (only in Black Mesa)
Use Manual mode for better quality and performance. In near future Auto mode will be removed from the game.
  • 0: Auto: Static cache will update once every 10 frames (approx) covering max shadow distance or whole map around player.
  • 1: Manual : Static cache area coverage and updates are managed via CSM Volumes' I/O.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).


Inputs

SetAngles <stringRedirectInput/string>
Sets the direction shadows cast in.
Note.pngNote:Effects nothing.
LightColor <color255RedirectInput/color32>
Changes color of the sunlight.
Icon-Bug.pngBug:Doesn't work as expected. With Counter-Strike: Global Offensive Counter-Strike: Global Offensive's implementation, 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. With Black Mesa Black Mesa's implementation, the only thing you can do is change shadows color to turquoise and change the intensity of these shadows, however this doesn't effects shadows on the viewmodel.
Examples

Counter-Strike: Global Offensive Counter-Strike: Global Offensive (Portal 2: Community Edition Portal 2: Community Edition):

Black Mesa Black Mesa:

  [todo tested in ?]
LightColorScale  !FGD Obsolete
Deprecated.
Boosts the color of the sunlight. Non-functional, only resets the Light Color.
Icon-Bug.pngBug:Effects nothing in Black Mesa Black Mesa.  [todo tested in ?]
SetCSMVolume  (only in Black Mesa)
Set CSM Volume via trigger volume.
SetCSMVolumeToSceneBounds  (only in Black Mesa)
Set CSM Volume to scene bounds.
SetCSMVolumeViaCSMVolumeEntity <targetnameRedirectInput/string> (only in Black Mesa)
Set CSM Volume to CSM Volume Entity.
Disable <void>
Disable this entity.
Note.pngNote:Only in Black Mesa Black Mesa work as expected. Counter-Strike: Global Offensive Counter-Strike: Global Offensive's implementation only disable blobby shadows and lighting in viewmodel, also cause freeze for some seconds.
Enable <void>
Enable this entity.
Note.pngNote:Only in Black Mesa Black Mesa work as expected. Counter-Strike: Global Offensive Counter-Strike: Global Offensive's implementation only enable blobby shadows and lighting in viewmodel, also cause freeze for some seconds.


Outputs

See also