Env cascade light: Difference between revisions
No edit summary |
Thunder4ik (talk | contribs) m (Added references section) |
||
Line 3: | Line 3: | ||
[[File:CSM Example.jpg|thumb|CSM in {{csgo|4.1}}]] | [[File:CSM Example.jpg|thumb|CSM in {{csgo|4.1}}]] | ||
[[File:Env_cascade_light_-_BMS_CSM_comparison.gif|thumb|Comparison of CSM and without CSM in {{bms|3.1}}<br>(Click to preview)]] | [[File:Env_cascade_light_-_BMS_CSM_comparison.gif|thumb|Comparison of CSM and without CSM in {{bms|3.1}}<br>(Click to preview)]] | ||
It casts an extremely accurate shadow map via the <code>tools/[[skybox]]</code> texture, acting as a real-time variation of {{ent|light_environment}}. This form of lighting is known as | It casts an extremely accurate shadow map via the <code>tools/[[skybox]]</code> texture, acting as a real-time variation of {{ent|light_environment}}. This form of lighting is known as {{ref|1}} 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. | ||
{{important|{{clr}} | {{important|{{clr}} | ||
Line 16: | Line 16: | ||
{{note|{{clr}} | {{note|{{clr}} | ||
* 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. | * 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. | ||
* {{src13|4}} doesn't have this entity, but there is an | * {{src13|4}} doesn't have this entity, but there is an {{ref|2}} attempt] of porting 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. | ||
Line 91: | Line 91: | ||
== External links == | == External links == | ||
* [https://chetanjags.wordpress.com/2023/07/17/blackmesa-xenengine-part3-csm-2-0/ | * {{ref|3}} BlackMesa XenEngine: Part3 – CSM 2.0] (page from Black Mesa developer about their own CSM implementation) | ||
* {{ref|4}} BlackMesa XenEngine: Part2 – How a Frame is Rendered] (page from Black Mesa developer about new graphics features) | |||
* {{ref|5}} BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] (page from Black Mesa developer about Black Mesa engine, better known as [[Xengine]]) | |||
== References == | |||
{{ref|1}}: https://learn.microsoft.com/en-us/windows/win32/dxtecharts/cascaded-shadow-maps | |||
{{ref|2}}: https://github.com/celisej567/Fake-CSM-Source-2013 | |||
{{ref|3}}: https://chetanjags.wordpress.com/2023/07/17/blackmesa-xenengine-part3-csm-2-0/ | |||
{{ref|4}}: https://chetanjags.wordpress.com/2023/07/11/blackmesa-xenengine-part2-how-a-frame-is-rendered/ | |||
{{ref|5}}: https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/ |
Revision as of 08:50, 8 April 2024


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 [1] 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.


- Although you can toggle this entity, you can have only one env_cascade_light in your level. Other will not work.
- In
, shadows will be very faint if the map hasn't been compiled with HDR.
- In
, Lightstyles will break when this entity exists. [todo tested in ?]

- 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.
Source 2013 doesn't have this entity, but there is an [2] attempt] of porting 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.
Represented by class
CCascadeLight
.
Keyvalues
- Light Color (color) <color255>
- This is the color of the sunlight. For
, 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
)
- Used for controlling shadow softness in cascades 1, 2, and 3.
- Depthbias1 (Depthbias1) to Depthbias3 <float> (only in
)
- DepthBias for cascades 1, 2, and 3.
- Slopescaledepthbias1 (Slopescaledepthbias1) to Slopescaledepthbias3 <float> (only in
)
- Slope DepthBias for cascades 1, 2, and 3.
- ViewModelDepthbias (ViewModelDepthbias) <float> (only in
)
- DepthBias for viewmodel cascade.
- ViewModelSlopescaledepthbias (ViewModelSlopescaledepthbias) <float> (only in
)
- DepthBias for viewmodel cascade.
- CSM_Volume_Mode (CSMVolumeMode) <choices> (only in
)
- 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 the
Enable
input).
Inputs
- SetAngles <string >
- Sets the direction shadows cast in.

- LightColor <color255 >
- Changes color of the sunlight.



![]() ![]() ![]()
|
LightColorScale!FGD- Deprecated.
Boosts the color of the sunlight. Non-functional, only resets the Light Color.
- SetCSMVolumeViaCSMVolumeEntity <targetname > (only in
)
- Set CSM Volume to CSM Volume Entity.
- Disable <void>
- Disable this entity.



- Enable <void>
- Enable this entity.



Outputs
See also
- light_environment
- Shadow_control
- env_sun
- Skybox Basics
- Skybox lighting
- Advanced Lighting
- Effect flags (dynamic light effects)
- newLight_Dir
- newLight_Point
- newLight_Spot
- NewLights_settings
- New_Specular
- light_deferred
- light_deferred_global
External links
- [3] BlackMesa XenEngine: Part3 – CSM 2.0] (page from Black Mesa developer about their own CSM implementation)
- [4] BlackMesa XenEngine: Part2 – How a Frame is Rendered] (page from Black Mesa developer about new graphics features)
- [5] BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] (page from Black Mesa developer about Black Mesa engine, better known as Xengine)
References
[1]: https://learn.microsoft.com/en-us/windows/win32/dxtecharts/cascaded-shadow-maps [2]: https://github.com/celisej567/Fake-CSM-Source-2013 [3]: https://chetanjags.wordpress.com/2023/07/17/blackmesa-xenengine-part3-csm-2-0/ [4]: https://chetanjags.wordpress.com/2023/07/11/blackmesa-xenengine-part2-how-a-frame-is-rendered/ [5]: https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/