NewLight Dir: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(54 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{This is a|name=newLight_Dir|e0|game=Black Mesa|sprite=NewLight_Dir-Icon-Small.png}} It is one of the many new lighting entities available. Black Mesa incorporates a new lighting system which utilizes {{wiki|Deferred lighting}} to create a hyper realistic interpretation of light. This entity draw in [[skybox]] post processing effect called GodRays, also include disk to imitate sun.
{{CDA|CNewLightDir|CBaseEntity|}}
[[File:newLight_DirGIF.gif|frame|right|NewLight_Dir in bm_c4a1b.]]
[[File:NewLight_Dir_jpg.jpg|670px||thumb|right|NewLight_Dir in bm_c2a5d.]]
{{back | Black Mesa Level Creation}}
{{this is a|point entity|name=newLight_Dir|game=Black Mesa|}} It places a godrays and disk/circle as sun effect in the [[skybox]] where it does not parallax, giving the impression that it is nearly infinitely far away. The entity does not contribute any actual lighting (the lighting code is disabled); it is merely a visual representation of the Sun.
{{note|You maybe seen {{ent|env_godrays_controller}} in [[Hammer]] or [[fgd]]. This is deprecated [https://en.wikipedia.org/wiki/Crepuscular_rays Crepuscular Rays] from the [https://steamcommunity.com/games/362890/announcements/detail/75795300358700519  Crossfire Update] (22 december 2015 year). With [[newLight_Dir]] implementation, this entity is removed with crepuscular rays.}}
{{warning|You can have only one {{ent|newLight_Dir}} per map. Exceeding the limit will result in the instant crash with the engine error message. You are able to kill this entity and spawn new with {{ent|point_template}}.
{{expand|title=The error|
<gallery mode=packed heights=160px>
File: dirlimit.png| The error.
</gallery>
}}
}}
{{todo|Update issues, rework page.}}


==Keyvalues==
==Keyvalues==
{{KV|Pitch Yaw Roll (Y Z X)|intn=angles|angle|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.}}
{{KV Targetname}}
{{KV|LightEnvEnabled|intn=LightEnvEnabled|Choices|Grab direction and color values from light_env ?
{{KV|LightEnvEnabled|intn=LightEnvEnabled|Choices|Determines is the entity uses {{ent|light_environment}}'s direction or its own (just like {{ent|env_sun}}).
Determines is the entity use [[Light_environment]] direction or its own (just like [[env_sun]]).
*0: Enabled - use {{ent|light_environment}}'s direction.
*0: Enabled : Fetch Angles from Light_Env
*1: Disabled - use its own direction.}}  
*1: Disabled : Use Manual Angles}}
{{KV|PushbackDist|intn=PushbackDist|float|Pushback distance is distance from godrays to player in [[skybox]]. Decreasing the value will cause parallax effect.
{{KV|PushbackDist|intn=PushbackDist|float|PushbackDist.
Determines distance from GodRays to player in [[skybox]].}}
{{expand|title=Examples|
[[File:PBD1.png | thumb | left | 710px | PushbackDist - 9999999]]
[[File:PBD2.png | thumb | left | 710px | PushbackDist - 9999]]
}}
{{KV|EnableGodRays|intn=EnableGodRays|choices|Enable GodRays.
Determines whether godrays are enabled or not.
*0: Disabled
*1: Enabled}}
{{KV|Density|intn=Density|float|Density Controls the length of rays/volumetric shadows. 1.0 should work in 99% cases. Good values to start from: 0.5 to 1.5.}}
{{expand|title=Examples|
{{expand|title=Examples|
[[File:DEN1.gif| frame | left | 720px | Density - 1.0]]
<br>
[[File:DEN2.gif| frame | left | 720px | Density - 2.0]]
<gallery mode=packed heights=410px>
[[File:DEN3.gif| frame | left | 720px | Density - 0.5]]
File:cPBD1.jpg|PushbackDist - 999
File:cPBD2.jpg|PushbackDist - 9999999
</gallery>
}}
}}
{{KV|Weight|intn=Weight|float|Weight Controls the intensity of volumetric shadow. Blocking of rays by geometry. Good values to start from: 0.1 - 10.0.}}
{{expand|title=Examples|
[[File:WEI10.gif| frame | left | 720px | Weight - 1.0]]
[[File:WEI2.gif| frame | left | 720px | Weight - 2.0]]
[[File:WEI3.gif| frame | left | 720px | Weight - 5.0]]
}}
}}
{{KV|Decay|intn=Decay|float|Decay NOT being used.}}
{{KV|UseToneMapDisk|intn=m_bUseToneMapDisk|choices|Sets [[Env tonemap controller|tonemap]] state for disk, enabled or disabled. Doesn't work.
{{KV|Exposure|intn=Exposure|float|Exposure Controls the intensity of Rays during blending pass with main scene. 2.0 is a good start. Good values are 1.0 - 10.0.}}
{{expand|title=Examples|
[[File:EXP1.png| thumb | left | 710px | Exposure - 1.00]]
[[File:EXP2.png| thumb | left | 710px | Exposure - 10.0]]
[[File:EXP3.png| thumb | left | 710px | Exposure - 0.10]]
}}
{{KV|DistFactor|intn=DistFactor|float|DistFactor Controls the falloff of rays / length. 1.0f is a good starting value increase or decrease in the increments of 0.1. 0.0 will make the rays dissappear only disk will be rendererd.}}
{{expand|title=Examples|
[[File:DIST1.gif| frame | left | 720px | DistFactor - 1.00]]
[[File:DIST2.gif| frame | left | 720px | DistFactor - 10.0]]
[[File:DIST3.gif| frame | left | 720px | DistFactor - 50.0]]
}}
{{KV|DiskRadius|intn=DiskRadius|float|Radius of Disk/circle of sun in texturespace. 1.0 will be full screen 0.5 is half screen etc.}}
{{expand|title=Examples|
[[File:DISKR1.png| thumb | left | 710px | DiskRadius - 0.02]]
[[File:DISKR2.png| thumb | left | 710px | DiskRadius - 0.10]]
[[File:DISKR3.png| thumb | left | 710px | DiskRadius - 1.00]]
}}
{{Note|With 0 - will not render.}}
{{KV|ColorInner|intn=ColorInner|color255| This is the color of the inner circle.}}
{{expand|title=Examples|
[[File:CRAYS1.png | thumb | left | 710px | 255 0 0 255]]
[[File:CINN2.png | thumb | left | 710px | 0 255 0 255]]
[[File:CINN3.png | thumb | left | 710px | 0 0 255 255]]
}}
{{Note|Unlike lighting - brightness of inner depends on fourth number which can be written here.}}
{{KV|ColorRays|intn=ColorRays|color255| This is the color of the rays.}}
{{expand|title=Examples|
[[File:CRAYS1.png | thumb | left | 710px | 0 0 255 120]]
[[File:CRAYS2.png | thumb | left | 710px | 0 255 0 120]]
[[File:CRAYS3.png | thumb | left | 710px | 255 0 0 120]]
}}
{{Note|Unlike lighting - brightness of rays depends on fourth number which can be written here.}}
{{KV|DiskInnerSizePercent|intn=DiskInnerSizePercent|float|Used only in Fancy Gaphics Mode. Disk inner circle radius [[=]] DiskRadius * DiskInnerSizePercent.}}
{{expand|title=Examples|
[[File:DISKIR1.png| thumb | left | 710px | DiskInnerSizePercent - 0.75]]
[[File:DISKIR2.png| thumb | left | 710px | DiskInnerSizePercent - 0.50]]
[[File:DISKIR3.png| thumb | left | 710px | DiskInnerSizePercent - 1.00]]
}}
{{Note|With 0 - will not render.}}
{{KV|ColorOuter|intn=ColorOuter|color255|Used only in Fancy Mode. This is the color of the outer circle.}}
{{expand|title=Examples|
[[File:CRAYS1.png | thumb | left | 710px | 0 255 0 255]]
[[File:COUT2.png | thumb | left | 710px | 255 0 0 255]]
[[File:COUT3.png | thumb | left | 710px | 0 0 255 255]]
}}
{{Note|Unlike lighting - brightness of outer depends on fourth number which can be written here.}}
{{KV|UseToneMapDisk|intn=m_bUseToneMapDisk |choices|
*0: Enabled
*0: Enabled
*1: Disabled}}
*1: Disabled
|deprecated=1}}
{{KV BmGodraysNormal}}


==Inputs==
==Inputs==
{{IO|TurnOnGodRays|Turn the Godrays on.}}
{{I|TurnOnGodRays|Turn the godrays on.}}
{{IO|TurnOffGodRays|Turn the Godrays off.}}
{{I|TurnOffGodRays|Turn the godrays off.}}
{{I BaseEntity}}
 
==Outputs==
{{O BaseEntity|}}
 
== Issues ==
====Incorrect work with [[$translucent]]====
Godrays (also disk) all time fully rendering through textures with [[material]] [[shader]] parameter [[$translucent]], because of this you will see unexpected results like in the picture. Disable Godrays when you need or use [[$alphatest]] if it'll give similar resualts. You also can try use some other tricks to escape this problem.
{| border=0 cellspacing=0 cellpadding=0
| [[File: GodraysTransBug.png | thumb | left | 710px | Bug example in bm_c1a3c.]]
| [[File: GodraysTransBugSide.png | thumb | right | 710px | Sign from other side.]]
|}
====Godrays incorrect work with {{ent|point_viewcontrol}}====
Godrays change position in sky when player move, this affects to what show {{ent|point_viewcontrol}} when it's enabled. If you want to see in your background level Godrays - place player on needed position. If your {{ent|point_viewcontrol}} moves - attach player to it.
{| border=0 cellspacing=0 cellpadding=0
| [[File: PointViewControlFlareBug.gif | frame | left | 225px | Showcase of problem in background level of Black Mesa: Black Ops - Restored]]
|}


== See Also ==
==Bugs/Limitations==
See [[NewLight_Point/Bugs_and_limitations|/Bugs and limitations]]


* {{ent|newLight_Point}}
== See also ==
* {{ent|env_lensflare}}
* {{ent|newLight_Point}} - point deferred light entity.
* [[light_environment]]
* {{ent|NewLights_Spawner}} - spawner of deferred point lights.
* [[env_cascade_light]]
* {{ent|env_lensflare}} - cinematic dynamic lens flare.
* [[Advanced Lighting]]
* {{ent|newLight_Spot}} - spot deferred light entity.
* [[Effect flags]] (dynamic light effects)
* {{ent|newLights_settings}} - entity that changes deferred light settings.
* [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)
* {{ent|godrays_settings}} - entity that changes godrays settings.
{{todo|Fix some stuff.}}
* {{ent|env_cascade_light}} - deferred cascade sun light entity.
* [[New Lights Editor]] - in game deferred lights editor.
* [[Effect flags]] - effects flags, some of them are dynamic light effects.
* [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/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/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}}.

Latest revision as of 06:16, 27 May 2025

C++ Class hierarchy
CNewLightDir
CBaseEntity
NewLight_Dir in bm_c2a5d.

newLight_Dir is a point entity available in Black Mesa Black Mesa. It places a godrays and disk/circle as sun effect in the skybox where it does not parallax, giving the impression that it is nearly infinitely far away. The entity does not contribute any actual lighting (the lighting code is disabled); it is merely a visual representation of the Sun.

Note.pngNote:You maybe seen env_godrays_controller in Hammer or fgd. This is deprecated Crepuscular Rays from the Crossfire Update (22 december 2015 year). With newLight_Dir implementation, this entity is removed with crepuscular rays.
Warning.pngWarning:You can have only one newLight_Dir per map. Exceeding the limit will result in the instant crash with the engine error message. You are able to kill this entity and spawn new with point_template.
The error
Todo: Update issues, rework page.

Keyvalues

Name (targetname) <string>[ Edit ]
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

LightEnvEnabled (LightEnvEnabled) <choices>
Determines is the entity uses light_environment's direction or its own (just like env_sun).
PushbackDist (PushbackDist) <float>
Pushback distance is distance from godrays to player in skybox. Decreasing the value will cause parallax effect.
Examples


UseToneMapDisk (m_bUseToneMapDisk) <choices> Obsolete
Deprecated.
Sets tonemap state for disk, enabled or disabled. Doesn't work.
  • 0: Enabled
  • 1: Disabled


EnableGodRays (EnableGodRays) <choices>
Sets godrays state on spawn, enabled or disabled.
  • 0: Disabled
  • 1: Enabled
Warning.pngWarning:You can have only 40 point lights with godrays enabled simultaneously, otherwise the game will crash with this error message.
The error
Density (Density) <float>
Density controls the length of rays/volumetric shadows. 1.0 should work in 99% cases. Good values are 0.5-1.5.
Examples
Weight (Weight) <float>
Weight controls the intensity of volumetric shadow. Blocking of rays by geometry. Good values are 0.1-10.
Examples
Decay (Decay) <float> Obsolete
Deprecated.
Decay controls luminance fall off per sample. Value here doesn't work.
Exposure (Exposure) <float>
Exposure controls the intensity of rays during blending pass with main scene. 2.0 is a good start. Good values are 1.0-10.0.
Examples


DistFactor (DistFactor) <float>
DistFactor controls the falloff of rays/length. 1.0 is a good starting value increase or decrease in the increments of 0.1. 0.0 will make the rays dissappear only disk will be rendererd.
Examples
Note.pngNote:Godrays doesn't look smooth if used big value here. The same for Exposure.
Example
ColorInner (ColorInner) <color255 + int>
The RGB color and brightness of the inner circle. Colors and brightness must be between 0 and 255.
Icon-Bug.pngBug:This color value doesn't work properly with newLight_Point if you are using Normal godrays type. This entity takes only red value. Works fine with Fancy type.
Examples
Note.pngNote:Rays is disabled on this picture (the colors are partially blending).
ColorRays (ColorRays) <color255 + int>
The RGB color and brightness of the rays. Colors and brightness must be between 0 and 255.
Examples
ColorOuter (ColorOuter) <color255 + int>
The RGB color and brightness of the outer circle. Colors and brightness must be between 0 and 255.
Icon-Bug.pngBug:This color value doesn't work properly with newLight_Point if you are using Normal godrays type. This entity takes only red value. Works fine with Fancy type.
Examples
Note.pngNote:Rays is disabled on this picture (the colors are partially blending).
Note.pngNote:You can't use black colors for ColorOuter, ColorInner and ColorRays.
DiskRadius (DiskRadius) <float>
Radius of disk/circle of sun/point light in texturespace. 1.0 will be full screen, 0.5 is half screen, etc. 0 means don't render.
Examples
DiskInnerSizePercent (DiskInnerSizePercent) <float>
Disk inner circle radius is DiskRadius * DiskInnerSizePercent. 0 means don't render.
Examples
Note.pngNote:Rays is disabled on this picture (for clarity).

Inputs

TurnOnGodRays
Turn the godrays on.
TurnOffGodRays
Turn the godrays off.

Bugs/Limitations

See /Bugs and limitations

See also