NewLights settings: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{Toc-right}}{{This is a|name=NewLights_settings|e0|game=Black Mesa}} This entity uses to dynamically change some settings for Black Mesa new light entities. For better unders...")
 
 
(34 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Toc-right}}{{This is a|name=NewLights_settings|e0|game=Black Mesa}} This entity uses to dynamically change some settings for Black Mesa new light entities. For better understanding of this page - recommended at first familiarize yourself with new lights.
{{CDA|CNewLightsSettings|CBaseEntity|}}  
{{back | Black Mesa Level Creation}}
{{this is a|point entity|name=NewLights_settings|game=Black Mesa}} This entity dynamically changes some lighting settings for {{ent|newLight_Spot}} and {{ent|newLight_Point}} if triggered by the input.
{{tip|You can change values dynamically via {{code|[[AddOutput]]}} input.}}


==Keyvalues==
==Keyvalues==
{{KV|Name|intn=targetname|target_source|The name that other entities refer to this entity by.}}
{{KV|TargetNewLightEntity_Name|intn=TargetNewLightEntity|string|Here you enter name of new light source for which you want to apply changes. Works with multiple lights if they have the same name.}}
{{KV|TargetNewLightEntity_Name|intn=TargetNewLightEntity|string|Target Light Entity name}}
{{KV|TransitionTime|intn=TransitionTime|integer|Transition time in seconds (0 for instant) to transition into new settings. Its a lerp operation A + (B-A) * TimeFactor.}}
Here you enter name of new light source for which you want to apply changes. Works with multiple lights if they have the same name.
{{KV|LightType|intn=LightType|Choices|Type of light source for which you want to apply settings. Entity will not apply settings for spot lights if selected <code>Point Light</code> and will not apply settings for point lights if selected <code>Spot Light</code>.
{{KV|TransitionTime|intn=TransitionTime|integer|TransitionTime in secs ( 0 for instant ) to transition into new settings. Its a lerp operation A + (B-A)*TimeFactor}}
{{KV|LightType|intn=LightType|Choices|  
Type of light source for which you want to apply settings. Entity will not apply settings for spot lights if selected <code>Point Light</code> and will not apply settings for point lights if selected <code>Spot Light</code>.
*0: Point Light
*0: Point Light
*1: Spot Light}}
*1: Spot Light}}
{{KV|Enabled|intn=Enabled|integer| Light Enabled or Disabled
{{KV BmNewLightsSettings}}
Determines if the light turns on or turns off. 1 - turns on, 0 - turns off.}}
 
{{KV|Light Ambient Color|intn=LightColorAmbient|color255|This is the ambient color of the sunlight.
==Inputs==
Determines color of shadows that light source creates.}}
{{I|InputApplySettings|param=void|Triggers the entity to apply the settings.}}
{{expand|title=Examples|
 
<br>
==Bugs/Limitations==
<gallery mode=packed heights=500px>
===Range increasing doesn't increase [[Bounding box|BBOX]]===
File:cShadowC1.jpg| thumb | left | 510px | 0 0 0
This results in the lighting disappearing before the player's field of view moved away completely from the lighting. This affects all light types, including Dynamic type.
File:cShadowC2.jpg| thumb | left | 510px | 255 0 0
{{workaround|You can use '''InputFixRotBugDueToTram''' input to reset BBOX values.}}
File:cShadowC3.jpg| thumb | left | 510px | 255 128 128
<gallery mode=packed heights=290px>
File:range_bug0.jpg| thumb | left | 510px | Before applying settings. Range - 56.
File:range_bug1.jpg| thumb | left | 510px | After applying settings. Range - 500.
</gallery>
</gallery>
}}
 
{{KV|Light Color|intn=LightColor|color255|This is the color of the sunlight.
===OuterAngle increasing/decreasing doesn't change ShadowFOV===
Determines color of light.}}
Static shadowmaps will be broken after increasing outer angle value for {{ent|newLight_Spot}} (fixes after save reload). For Static light type, you will not have notable issues with decreasing, but shadows will not look better. Stationary light type will be broken after decreasing as well.
{{KV|Appearance|intn=FlareStyle|Choices| 
<gallery mode=packed heights=290px>
{{Light appearances}}}}
File:outerangle_bug0.jpg| thumb | left | 510px | Before applying settings. OuterAngle - 30.
{{KV|Light Intensity|intn=Intensity|float|RGB * Intensity.
File:outerangle_bug1.jpg| thumb | left | 510px | After applying settings. OuterAngle - 60.
Brightness of the light.}}
{{Note|With 0 will not draw, process and specular shader be disabled.}}
{{KV|SpecularMultiplier|intn=SpecMultiplier|float|0 to 1 RGB * Intensity * SpecularMultiplier.
Brightness of the specular shader from this light source.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cBS IN1.jpg| thumb | left | 510px | SpecularMultiplier - 1
File:cBS IN10.jpg| thumb | left | 510px | SpecularMultiplier - 10
File:cBS IN20.jpg| thumb | left | 510px | SpecularMultiplier - 20
</gallery>
</gallery>
}}
 
{{KV|Range|intn=Range|float|Range.
===AngularFallOff may broke shadows for Stationary light type===
How far the light source illuminates. Measured in Hammer Units.}}
Sometimes, for some reason, changing AngularFallOff value for Stationary light type will make your shadows look broken.
{{Important|It greatly affects optimization, less is better.}}
<gallery mode=packed heights=290px>
{{expand|title=Examples|
File:AngularFallOff_bug0.jpg| thumb | left | 510px | Before applying settings. AngularFallOff - 0.
<br>
File:AngularFallOff_bug1.jpg| thumb | left | 510px | After applying settings. AngularFallOff - 5.
<gallery mode=packed heights=500px>
File:cL1.jpg| thumb | left | 510px | Range - 150
File:cL2.jpg| thumb | left | 510px | Range - 300
File:cL3.jpg| thumb | left | 510px | Range - 500
</gallery>
</gallery>
}}
{{KV|falloffQuadratic|intn=falloffQuadratic|float|falloffQuadratic|deprecated=1}}
{{KV|falloffLinear|intn=falloffLinear|float|falloffLinear|deprecated=1}}
{{KV|falloffConstant|intn=falloffConstant|float|falloffConstant|deprecated=1}}
{{KV|OuterAngle|intn=phi|float|OuterAngle
Sets outer angle for spot light.}}
{{KV|InnerAngle|intn=theta|float|InnerAngle
Inner angle value for spot light.}}
{{KV|AngularFallOff|intn=angularFallOff|float|AngularFallOff
Sets angular falloff.}}
{{Note|Results depend on values of OuterAngle and InnerAngle.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:AngularFallOff1.jpg| thumb | left | 510px | AngularFallOff - 1 (OuterAngle - 60, InnerAngle - 30)
File:AngularFallOff2.jpg| thumb | left | 510px | AngularFallOff - 30 (OuterAngle - 60, InnerAngle - 30)
File:AngularFallOff3.jpg| thumb | left | 510px | AngularFallOff - 60 (OuterAngle - 60, InnerAngle - 30)
</gallery>
}}


==Inputs==
===Range increasing/decreasing will make static shadowmaps broken===
{{IO|InputApplySettings|param=void|InputApplySettings Trigger to apply settings}}
Range increasing/decreasing doesn't update static shadowmaps, this leaves old static shadowmaps that cannot be properly overlaid with the changed range value.


{{I BaseEntity}}
This is how it looks with increasing.
 
<gallery mode=packed heights=290px>
==Outputs==
File:rangeStaticShadow_bug-0.jpg| thumb | left | 510px | Before applying settings. Range - 50.
{{O BaseEntity|}}
File:rangeStaticShadow_bug-1.jpg| thumb | left | 510px | After applying settings. Range - 500.
 
File:rangeStaticShadow_bug-2.jpg| thumb | left | 510px | This is how it supposed to look like.
== See Also ==
</gallery>
This is how it looks with decreasing.
<gallery mode=packed heights=290px>
File:rangeStaticShadow_bug0.jpg| thumb | left | 510px | Before applying settings. Range - 500.
File:rangeStaticShadow_bug1.jpg| thumb | left | 510px | After applying settings. Range - 50.
File:rangeStaticShadow_bug2.jpg| thumb | left | 510px | This is how it supposed to look like.
</gallery>


* {{ent|newLight_Point}}
== See also ==
* {{ent|newLight_Spot}}
* {{ent|newLight_Dir}} - directional sun light with godrays only.
* {{ent|env_lensflare}}
* {{ent|NewLights_Spawner}} - spawner of deferred point lights.
* {{ent|newLight_Dir}}
* {{ent|env_lensflare}} - cinematic dynamic lens flare.
* {{ent|env_cascade_light}}
* {{ent|newLight_Spot}} - spot deferred light entity.
* [[Lighting]]
* {{ent|newLight_Point}} - point deferred light entity.
* [[Adding Light]]
* {{ent|godrays_settings}} - entity that changes godrays settings.
* [[Intermediate Lighting]]
* {{ent|env_cascade_light}} - deferred cascade sun light entity.
* [[Advanced Lighting]]
* [[New Lights Editor]] - in game deferred lights editor.
* [[Effect flags]] (dynamic light effects)
* [[Effect flags]] - effects flags, some of them are dynamic light effects.
* [[Tool textures]] (for Block light)
* [https://chetanjags.wordpress.com/2023/07/18/blackmesa-xenengine-part-4-lighting-shadows/ BlackMesa XenEngine: Part 4 – Lighting & Shadows] - page from Chetan (lead programmer for Black Mesa) about new lights.
* [https://chetanjags.wordpress.com/2023/07/18/blackmesa-xenengine-part-4-lighting-shadows/ BlackMesa XenEngine: Part 4 – Lighting & Shadows] (page from Black Mesa developer about new lights)
* [https://chetanjags.wordpress.com/2023/07/11/blackmesa-xenengine-part2-how-a-frame-is-rendered/ BlackMesa XenEngine: Part2 – How a Frame is Rendered] - page from Chetan (lead programmer for Black Mesa) about how a frame is rendered.
* [https://chetanjags.wordpress.com/2023/07/11/blackmesa-xenengine-part2-how-a-frame-is-rendered/ BlackMesa XenEngine: Part2 – How a Frame is Rendered] (page from Black Mesa developer about how a frame rendered)
* [https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/ BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] page from Chetan (lead programmer for Black Mesa) about {{xe|4}}.
* [https://chetanjags.wordpress.com/2022/06/01/blackmesa-xenengine-part1-a-heavily-modified-source-engine/ BlackMesa XenEngine: Part1 – Heavily Modified Source Engine] (page from Black Mesa developer about Black Mesa engine, better known as [[Xenengine]])
{{todo|Clean up english. Add more issues if you'll find.}}

Latest revision as of 11:50, 12 August 2025

C++ Class hierarchy
CNewLightsSettings
CBaseEntity

NewLights_settings is a point entity available in Black Mesa Black Mesa. This entity dynamically changes some lighting settings for newLight_Spot and newLight_Point if triggered by the input.

Tip.pngTip:You can change values dynamically via AddOutput input.

Keyvalues

TargetNewLightEntity_Name (TargetNewLightEntity) <string>
Here you enter name of new light source for which you want to apply changes. Works with multiple lights if they have the same name.
TransitionTime (TransitionTime) <integer>
Transition time in seconds (0 for instant) to transition into new settings. Its a lerp operation A + (B-A) * TimeFactor.
LightType (LightType) <choices>
Type of light source for which you want to apply settings. Entity will not apply settings for spot lights if selected Point Light and will not apply settings for point lights if selected Spot Light.
  • 0: Point Light
  • 1: Spot Light


Light Color (LightColor) <color255>
The RGB color of the light. Colors must be between 0 and 255.
Light Intensity (Intensity) <float>
Intensity/brightness of the light. It's RGB * intensity.
Note.pngNote:With 0 it will make the light disabled, including the effects. Doesn't affect shadows.
Range (Range) <float>
Range of the light, or how far the light source can illuminate. Measured in Hammer Units.
Warning.pngWarning:This is one of the parameters that affects performance in the game. Smaller values ​​allow you to process less geometry and save performance.
Icon-Important.pngImportant:Range is limited, the limit depends on intensity value. Do not use values ​​bigger than the intensity value allows.
Examples
Enabled (Enabled) <choices>
Sets light state on spawn, enabled or disabled.
  • 0: Enabled
  • 1: Disabled
Appearance (style) <integer choices>
Appearance presets.
Lightstyle presets (epilepsy warning)
Literal Value Description Sequence Preview
0 Normal m Lightstyle 0.png
10 Fluorescent flicker mmamammmmammamamaaamammma Lightstyle 10.gif
2 Slow, strong pulse abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba Lightstyle 2.gif
11 Slow pulse, noblack abcdefghijklmnopqrrqponmlkjihgfedcba Lightstyle 11.gif
5 Gentle pulse jklmnopqrstuvwxyzyxwvutsrqponmlkj Lightstyle 5.gif
1 Flicker A mmnmmommommnonmmonqnmmo Lightstyle 1.gif
6 Flicker B nmonqnmomnmomomno Lightstyle 6.gif
3 Candle A mmmmmaaaaammmmmaaaaaabcdefgabcdefg Lightstyle 3.gif
7 Candle B mmmaaaabcdefgmmmmaaaammmaamm Lightstyle 7.gif
8 Candle C mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa Lightstyle 8.gif
4 Fast strobe mamamamamama Lightstyle 4.gif
9 Slow strobe aaaaaaaazzzzzzzz Lightstyle 9.gif
12 Underwater light mutation mmnnmmnnnmmnn Lightstyle 12.gif
Tip.pngTip:Use new lights instead for lights with custom appearance, because static lightmapped lights reduces performance with this feature (especially near displacements).
Note.pngNote:Custom light styles are not possible.
Light Ambient Color (LightColorAmbient) <color255>
The RGB color of the shadows. Colors must be between 0 and 255.
Examples
SpecularMultiplier (SpecMultiplier) <float>
Specular multiplier. Sets intensity of new specular shader from this light source. It's RGB * Intensity * SpecularMultiplier. 0 means disabled.
Examples


falloffConstant (falloffConstant) <integer> !FGD Obsolete
Deprecated.
Constant value (can work only if old falloff is enabled).
falloffLinear (falloffLinear) <integer> !FGD Obsolete
Deprecated.
Linear value (can work only if old falloff is enabled).
falloffQuadratic (falloffQuadratic) <integer> !FGD Obsolete
Deprecated.
Quadratic value (can work only if old falloff is enabled).
OuterAngle (phi) <float>
Outer angle for spot light.
Warning.pngWarning:This affect shadow quality, less is better.
Icon-Important.pngImportant:Don't use values 180 and higher, this will make shadows and lighting broken.
InnerAngle (theta) <float>
Inner angle value for spot light.
Warning.pngWarning:Using values higher than in OuterAngle will not make ShadowFOV value higher. This will result in broken shadows.
AngularFallOff (angularFallOff) <float>
Angular falloff value.
Examples
Note.pngNote:Results depend on values of OuterAngle and InnerAngle.

Inputs

InputApplySettings <void>
Triggers the entity to apply the settings.

Bugs/Limitations

Range increasing doesn't increase BBOX

This results in the lighting disappearing before the player's field of view moved away completely from the lighting. This affects all light types, including Dynamic type.

PlacementTip.pngWorkaround:You can use InputFixRotBugDueToTram input to reset BBOX values.

OuterAngle increasing/decreasing doesn't change ShadowFOV

Static shadowmaps will be broken after increasing outer angle value for newLight_Spot (fixes after save reload). For Static light type, you will not have notable issues with decreasing, but shadows will not look better. Stationary light type will be broken after decreasing as well.

AngularFallOff may broke shadows for Stationary light type

Sometimes, for some reason, changing AngularFallOff value for Stationary light type will make your shadows look broken.

Range increasing/decreasing will make static shadowmaps broken

Range increasing/decreasing doesn't update static shadowmaps, this leaves old static shadowmaps that cannot be properly overlaid with the changed range value.

This is how it looks with increasing.

This is how it looks with decreasing.

See also