Template:Archived Page History/NewLight Point: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Tag: Removed redirect
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{langsp}} It is one of the many new lighting entities available. Black Mesa incorporates a new lighting system which utilizes {{wiki|Deferred lighting}} to create dynamic lighting system with dynamic shadows, which allows to complement and quite enliven some scenes, it is also nice effect for moving objects, such as trains. It is also include fine tuning Godrays and lightcookies.
{{APH|NewLight Point}}
{{warning|New lights use expensive [https://learnopengl.com/Advanced-Lighting/Deferred-Shading gbuffer], that means that with this entity your scene rendering at least 5 times, which makes your level very expensive, considering that [[XenEngine]] uses 32-bit architecture and [[DirectX_Versions|DirectX]] 9.5 rendering. In large quantities, new lights can greatly heat up your computer and also cause large FPS drops (depending on difficulty of your map and how your area open). Use wisely.}}
{{note|You can have only 512 point light entities placed in the map editor.}}
{{bms}} Represented by class <code>CNewLightPoint</code>.
{{back | Black Mesa Level Creation}}
<br>
<gallery mode=packed heights=440px>
File:NewLight_PointGIFNEW.gif| frame | center | 510px |NewLight_Point in <code>Endgame</code> chapter.
</gallery>
==Keyvalues==
<div style=overflow:auto;height:500px><div><!-- some template has an extra </div> thats effing with the scroll box, so here is an extra <div> to appease your hungry appetite. DO NOT REMOVE!!! Mediawiki deserves to die, Markdown superiority! -->
{{KV|Name|intn=targetname|target_source|The name that other entities refer to this entity by.}}
{{KV|Parent|intn=parentname|target_destination|The name of this entity's parent in the movement hierarchy. Entities with parents move with their parent.}}
{{KV|Pitch Yaw Roll (Y Z X)|intn=angles|angle|nofgd=1|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.}}
{{Important|Have huge differences if you use texture for your {{ent|newLight_Point}}.}}
{{KV|Enabled|intn=Enabled|Choices|Enable/Disable this Entity.
Determines if the light is off at level start.
*0: Enabled
*1: Disabled}}
{{KV|Appearance|intn=FlareStyle|Choices|Appearance presets.
{{Light appearances}}
{{tip|Static lightmapped lights reduces performance with custom appearance (especially near displacements). If this cause problems, you can use replace your static lights with new lights, if used correctly - in most cases this will significantly preserve performance.
}}
}}
{{KV|Light Color|intn=LightColor|color255|This is the color of the sunlight.
Determines color of light.}}
{{KV|Light Ambient Color|intn=LightColorAmbient|color255|This is the ambient color of the sunlight.
Determines color of shadows that light source creates.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cShadowC1.jpg| thumb | left | 510px | 0 0 0
File:cShadowC2.jpg| thumb | left | 510px | 255 0 0
File:cShadowC3.jpg| thumb | left | 510px | 255 128 128
</gallery>
}}
{{KV|Light Intensity|intn=Intensity|float|RGB * Intensity.
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 [https://developer.valvesoftware.com/wiki/New_Specularof 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>
}}
{{KV|Range|intn=Range|float|Range.
How far the light source illuminates. Measured in Hammer Units.}}
{{Important|It greatly affects optimization, less is better.}}
{{expand|title=Examples|
<br>
<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>
}}
{{KV|Light Type|intn=LightType|choices|
Determines the light type.
*0: Static - shadows are cast only by static objects ([[prop_static]], geometry, etc.). Lighting does not update if it has parent (use if part scene has no large moving parts, or shadow accuracy is not important).
*1: Stationary - shadows are cast by static and dynamic objects, lighting does not update if it has a parent. {{Important|Shadows for dynamic props update, but baked for geometry. That means that shadows from [[func_physbox]] and other dynamic geometry will never update, and shadows from other geometry on them too.}}
*2: Dynamic - lighting is not baked at all. Shadows are cast by static and dynamic objects, lighting updates if it does have a parent. This light is quite expensive, and should only be used for moving light sources, or if your scene have moving geometry.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=420px>
File:B-1.gif|| thumb | left | 510px | Light Type - Static
File:B0.gif| thumb | left | 510px | Light Type - Stationary
File:B1.gif| thumb | left | 510px | Light Type - Dynamic
</gallery>
}}
{{KV|HasShadow|intn=HasShadow|choices|Do you want this light to have shadows?
Determines whether the light source will cast shadows. Remember that default choices is No.
*0: No
*1: Yes}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=410px>
File:cBM NO.jpg| thumb | left | 510px | Has Shadow - NO
File:cBM YES.jpg| thumb | left | 510px | Has Shadow - YES
</gallery>
}}
{{important|With closed [[areaportals]], shadows baking for <code>Static</code> and <code>Stationary</code> new light types. With <code>Dynamic</code> new light type all shadows disappear.
{{expand|title=An example.|
<br>
<gallery mode=packed heights=410px>
File:cBlack Mesa Screenshot 2023.10.23 - 19.02.36.87.jpg| thumb | left | 510px | 
</gallery>
}}
}}
{{KV|ShadowMapLOD|intn=ShadowLod|choices|Resolution of ShadowMap used by this light.
Determines quality of shadows. 1024 is very expensive, use it only in places where it's really needed, in most cases 512 is good alternative. 256 produces the blurriest shadows, but it is also the cheapest.
*0: 256
*1: 512
*2: 1024}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cLOD256.jpg| thumb | left | 510px | 256
File:cLOD512.jpg| thumb | left | 510px | 512
File:cLOD1024.jpg| thumb | left | 510px | 1024
</gallery>
}}
{{Important|In one level you can have only 8 light spot/points with shadows which use one and same shadow lod, even if you don't use all them simultaneously. If this limit is not respected - 9-th and next lights will not cast shadows. However - you can rise up this limit with {{ent|point_template}}, just kill past lights with kill input and spawn new when you need it. Also use different shadow lods.}}
{{KV|ShadowFaceX|intn=ShadowFaceX|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|ShadowFaceX_Minus|intn=ShadowFaceX_Minus|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|ShadowFaceY|intn=ShadowFaceY|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|ShadowFaceY_Minus|intn=ShadowFaceY_Minus|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|ShadowFaceZ|intn=ShadowFaceZ|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|ShadowFaceZ_Minus|intn=ShadowFaceZ_Minus|choices|Shadow Enabled for this Face ?
Determines whether the given side lighting will display shadows.
*0: Enabled
*1: Disabled}}
{{KV|NearZ|intn=NearZ|float|NearZ used by shadowmap camera for this light.
Determines distance at which light source will cast shadows.}}
{{KV|DepthBias|intn=DepthBias|float|DepthBias - Offset added to depth values in shadowmaps.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:DepthBias1.jpg| thumb | left | 510px | DepthBias - 0.0002
File:DepthBias2.jpg| thumb | left | 510px | DepthBias - 0.002
File:DepthBias3.jpg| thumb | left | 510px | DepthBias - 0.0000000002
</gallery>
}}
{{KV|SlopeDepthBias|intn=SlopeDepthBias|float|Slope Depth Bias - For surfaces having aliasing due to steep angles with light}}.
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:SlopeDepthBias1.jpg| thumb | left | 510px | SlopeDepthBias - 0.2
File:SlopeDepthBias2.jpg| thumb | left | 510px | SlopeDepthBias - 8
File:SlopeDepthBias3.jpg| thumb | left | 510px | SlopeDepthBias - 20
</gallery>
}}
{{KV|NormalBias|intn=NormalBias|float|While rendering objects into shadow maps, each vertex will be moved along -ve Normal direction, giving it an appearance of shrinking while rendering to shadow maps. This property determines the amount of Units to be moved. Helps with shadow aliasing.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cNB1.jpg| thumb | left | 510px | NormalBias - 1
File:cNB2.jpg| thumb | left | 510px | NormalBias - 5
File:cNB3.jpg| thumb | left | 510px | NormalBias - 10
</gallery>
}}
{{bug|Numbers lower than 0.8 can cause huge graphics problems.}}
{{expand|title=The bug example|
<br>
<gallery mode=packed heights=720px>
File:cNormalBiasBug.gif| frame | NormalBias - 0
</gallery>
}}
{{KV|ShadowRadius|intn=ShadowRadius|float|Radius of shadow edges for soft shadows. If its value is negative, code will auto assign a value depending on shadowlod. These code based values can be adjusted via convars nr_shadow_rad_High,nr_shadow_rad_Med and nr_shadow_rad_Low.}}
Determines shadow blur. Low numbers are expensive to render.
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cBLUR1.jpg| thumb | left | 510px | ShadowRadius - 0.0001
File:cBLUR2.jpg| thumb | left | 510px | ShadowRadius - 1
File:cBLUR3.jpg| thumb | left | 510px | ShadowRadius - 5
</gallery>
}}
{{KV|Enable Texture Light|intn=bTexLight|choices|Enable Texture Ligh.
Determines whether the given light source uses .vtf texture from game files (just like {{ent|env_projectedtexture}}). With NewLight_Point, this technically works like a cube. A great example is the batteries that use lights/lightcookie_battery.vtf.
*0: Disabled
*1: Enabled}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=410px>
File:cTEDisabled.jpg |Disabled
File:cTEEnabled.jpg |Enabled
File:CLightcookie_battery.jpg |Texture that use batteries.
</gallery>
}}
{{Note|One of the most expensive features, use wisely. If shadows enabled - it can work with lags even with powerful PC.}}
{{KV|Texture name for TexLight|intn=texName|string|Texture name for Texture shadows.
Determines which texture will use light source. It use .vtf files, not .vmt.}}
{{KV|.Enable Prop Only Mode|intn=bNegLight|choices|Enable Prop Only Mode.
{{todo|Document what it does.}}
*0: Disabled
*1: Enabled}}
{{KV|LightnGodRayMode|intn=LightnGodRayMode|choices|0:Light 1:Godrays 2:Both Light and GodRays.
*0: Light
*1: Godrays
*2: Both Light and GodRays}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:cGAL1.jpg| thumb | left | 510px | LightnGodRayMode - Light
File:cGAL2.jpg| thumb | left | 510px | LightnGodRayMode - Godrays
File:cGAL3.jpg| thumb | left | 510px | LightnGodRayMode - Both Light and GodRays
</gallery>
}}
{{KV|EnableGodRays|intn=EnableGodRays|choices|Enable GodRays.
Determines whether godrays are enabled or not at map start.
*0: Disabled
*1: Enabled}}
{{warning|You can have only 40 point lights with godrays enabled simultaneously, otherwise game will crash with this error message.}}
<br>
<gallery mode=packed heights=180px>
File:cRaysLimit.jpg| thumb | left | 510px | If you'll try to enable forty-first light point with enabled Godrays.
</gallery>
{{note|Godrays are draw and process even with closed [[areaportals]].}}
{{expand|title=Example|
<br>
<gallery mode=packed heights=710px>
File:cRaysDraw.jpg| thumb | left | 510px | 
</gallery>
}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cDEN1.gif| thumb |Density - 1.0
File:cDEN2.gif| thumb |Density - 2.0
File:cDEN3.gif| thumb |Density - 0.5
</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|
<br>
<gallery mode=packed heights=710px>
File:cWEI10.gif| thumb |Weight - 1.0
File:cWEI2.gif| thumb |Weight - 2.0
File:cWEI3.gif| thumb |Weight - 5.0
</gallery>
}}
{{KV|Decay|intn=Decay|float|Decay NOT being used.}}
{{todo|Document what does it change.}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cEXP1.jpg| thumb |Exposure - 1.00
File:cEXP2.jpg| thumb |Exposure - 10.0
File:cEXP3.jpg| thumb |Exposure - 0.10
</gallery>
}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cDIST1.gif| thumb |DistFactor - 1.00
File:cDIST2.gif| thumb |DistFactor - 10.0
File:cDIST3.gif| thumb |DistFactor - 50.0
</gallery>
}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cDISKR1.jpg| thumb |DiskRadius - 0.02
File:cDISKR2.jpg| thumb |DiskRadius - 0.10
File:cDISKR3.jpg| thumb |DiskRadius - 1.00
</gallery>
}}
{{Note|With 0 - will not render.}}
{{KV|ColorInner|intn=ColorInner|color255| This is the color of the inner circle.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=710px>
File:cCRAYS1.jpg| thumb |255 0 0 255
File:cCINN2.jpg| thumb |0 255 0 255
File:cCINN3.jpg| thumb |0 0 255 255
</gallery>
}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cCRAYS1.jpg| thumb |0 0 255 120
File:cCRAYS2.jpg| thumb |0 255 0 120
File:cCRAYS3.jpg| thumb | 255 0 0 120
</gallery>
}}
{{Note|Unlike lighting - brightness of rays depends on fourth number which can be written here.}}
{{KV|GodRaysType|intn=GodRaysType|choices|GodRaysType.
*0: Normal
*1: Fancy}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=710px>
File:cGodRaysTypeNormalAlt.jpg| thumb | Normal
File:cGodRaysTypeFancyAlt.jpg| thumb | Fancy
</gallery>
}}
{{KV|DiskInnerSizePercent|intn=DiskInnerSizePercent|float|Used only in Fancy Gaphics Mode. Disk inner circle radius [[=]] DiskRadius * DiskInnerSizePercent.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=710px>
File:cDISKIR1.jpg| thumb |DiskInnerSizePercent - 0.75
File:cDISKIR2.jpg| thumb |DiskInnerSizePercent - 0.50
File:cDISKIR3.jpg| thumb |DiskInnerSizePercent - 0.99
</gallery>
}}
{{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|
<br>
<gallery mode=packed heights=710px>
File:cCRAYS1.jpg| thumb |0 255 0 255
File:cCOUT2.jpg| thumb |255 0 0 255
File:cCOUT3.jpg| thumb |0 0 255 255
</gallery>
}}
{{Note|Unlike lighting - brightness of outer depends on fourth number which can be written here.}}
{{KV|Ell_FR_ConstA|intn=Ell_FR_ConstA|float|This is fancy Godrays disk size.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:C Ell_FR_ConstA1.jpg| thumb | left | 510px | 0.9
File:C Ell_FR_ConstA2.jpg| thumb | left | 510px | 5
File:C Ell_FR_ConstA3.jpg| thumb | left | 510px | 10
</gallery>
}}
{{KV|Ell_FR_ConstB|intn=Ell_FR_ConstB|float|This is fancy Godrays disk distortion.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:C Ell_FR_ConstB1.jpg| thumb | left | 510px | 0.1
File:C Ell_FR_ConstB2.jpg| thumb | left | 510px | 1
File:C Ell_FR_ConstB3.jpg| thumb | left | 510px | 10
</gallery>
}}
{{KV|EEll_SR_ConstA|intn=EEll_SR_ConstA|float|This is fancy Godrays disk hole size.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:Ell_SR_ConstA1.jpg| thumb | left | 510px | 0.9
File:Ell_SR_ConstA2.jpg| thumb | left | 510px | 5
File:Ell_SR_ConstA3.jpg| thumb | left | 510px | 20
</gallery>
}}
{{KV|EEll_SR_ConstB|intn=EEll_SR_ConstB|float|This is fancy Godrays disk hole distortion.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:EEll_SR_ConstB1.jpg| thumb | left | 510px | 0.1
File:EEll_SR_ConstB2.jpg| thumb | left | 510px | 5
File:EEll_SR_ConstB3.jpg| thumb | left | 510px | 20
</gallery>
}}
{{KV|Ell_RRF_ConstA|intn=Ell_RRF_ConstA|float|This is fancy Godrays inner size.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:C Ell_RRF_ConstA1.jpg| thumb | left | 510px | 0.9
File:C Ell_RRF_ConstA2.jpg| thumb | left | 510px | 1.5
File:C Ell RRF ConstA3.jpg| thumb | left | 510px | 42
</gallery>
}}
{{KV|Ell_RRF_ConstB|intn=Ell_RRF_ConstB|float|This is fancy Godrays inner distortion.}}
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=500px>
File:C Ell RRF ConstB1.jpg| thumb | left | 510px | 0.1
File:C Ell RRF ConstB2.jpg| thumb | left | 510px | 0.7
File:C Ell RRF ConstB3.jpg| thumb | left | 510px | 5.0
</gallery>
}}
{{KV|RotSpeed|intn=RotSpeed|float|}}
Determines rotating speed of fancy rays, 0 - don't rotate, negative number - will rotate to left.
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=710px>
File:cRS1.gif| thumb | left | 510px | RotSpeed - 3.14
File:cRS2.gif| thumb | left | 510px | RotSpeed - 0
File:cRS3.gif| thumb | left | 510px | RotSpeed - 40
</gallery>
}}
{{KV|RotPatternFreq|intn=RotPatternFreq|float|}}
Determines count of fancy rays in frame, with negative number will deny RotSpeed +/- effect.
{{Note|For fancy Godrays only.}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=710px>
File:cRPF1.gif| thumb | left | 510px | RotPatternFreq - -40
File:cRPF2.gif| thumb | left | 510px | RotPatternFreq - -4
</gallery>
}}
{{KV|RenderInWorldSpace|intn=m_bEnableWorldSpace|choices|Disables disks if this enabled.|
*0: Disabled
*1: Enabled}}
{{KV|m_fAlphaDiskInner|intn=m_fAlphaDiskInner|float|}}
{{KV|m_fAlphaDiskOuter|intn=m_fAlphaDiskOuter|float| }}
{{KV|UseToneMapRays|intn=m_bUseToneMapRays|choices|
*0: Enabled
*1: Disabled}}
{{KV|UseToneMapDisk|intn=m_bUseToneMapDisk |choices|
*0: Enabled
*1: Disabled}}
{{KV|ShadowPass_Brush|intn=m_bSRO_Brush|choices|Do we want to Render Brushes in shadow passes for this light?
*0: YES
*1: NO}}
{{KV|ShadowPass_StaticProp|intn=m_bSRO_StaticProp|choices|Do we want to Render StaticProps in shadow passes for this light?
*0: YES
*1: NO}}
{{KV|ShadowPass_DynProp|intn=m_bSRO_DynProp|choices|Do we want to Render Dynamic Props in shadow passes for this light?
*0: YES
*1: NO}}
{{KV|ShadowPass_AlphaTest|intn=m_bSRO__Trans|choices|Do we want to Render AlphaTested Objects in shadow passes for this light?
*0: YES
*1: NO}}
{{KV|bUseOldFallOff|intn=bUseOldFallOff|choices|Enable old falloff similar to [[light]]/[[light_spot]].
*0: No
*1: Yes
|nofgd=1|deprecated=1}}
{{KV|falloffConstant|intn=falloffConstant|integer|Constant (work only if bUseOldFallOff enabled).|nofgd=1|deprecated=1}}
{{KV|falloffLinear|intn=falloffLinear|integer|Linear (work only if bUseOldFallOff enabled).|nofgd=1|deprecated=1}}
{{KV|falloffQuadratic|intn=falloffQuadratic|integer|Quadratic (work only if bUseOldFallOff enabled).|nofgd=1|deprecated=1}}
</div>
 
==Inputs==
<div style=overflow:auto;height:500px>
{{IO|SetColorLight|param=color255|Change Light's Color value. Doesnt effect the godrays}}
{{IO|SetIntensityForLight|param=float|Change Light's intensity value. Doesnt effect the godrays}}
{{IO|TurnOnGodRays|param=void|Turn the Godrays on.}}
{{IO|TurnOffGodRays|param=void|Turn the Godrays off.}}
{{IO|TurnOn|param=void|Turn the light on.}}
{{IO|TurnOff|param=void|Turn the light off.}}
{{IO|Toggle|param=void|Toggle the light's current state.}}
{{I BaseEntity}}
</div>
 
==Outputs==
{{O BaseEntity|}}
 
==Bugs/Limitations==
{{todo|make a TOC specifically for this box to make navigation easier}}
<!-- WIP TOC HERE:
<center>{{Expand|title=Table of Contents|1=<span style=color:white>'''Table of Contents'''</span><br>
;[[#Deferred_lighting_incorrect_work_with_.24translucent|Deferred lighting incorrect work with $translucecnt]]
}}</center>
-->
<div style="overflow:auto;height:850px;width:95%;background-color:rgba(38,38,38,85%);border-radius:5px;border:2px solid rgba(82,82,82,255);padding:5px">
====Deferred lighting incorrect work with [[$translucent]] objects====
Deferred lighting all time rendering through walls with [[material]] [[shader]] parameter [[$translucent]]. This happen because of game can't tell the depth of scene because of the transparency, what you are see in the picture is just the lighting layer applied to the color of transparency texture.
<br>
<gallery mode=packed heights=250px>
File:C BugHah.jpg| frame |No [[$translucent]]. Behind the wall placed lighting and some models with small room.
File:C BugDamn.jpg| frame |With [[$translucent]]. Now player see everything, but only what lighted.
</gallery>
<br>
<gallery mode=packed heights=250px>
File:C GargHah1.jpg| frame |Scene behide window. Looks like the gargantua has lost its texture and turned white.
File:C GargDamn1.jpg| frame |Scene out window. This is what should see player.
</gallery>
This problem also applies to brushes which not have [[$translucent]], but which parented to brushes that have this parameter. Similar will happen if brush with [[$translucent]] is part of your brush entity.
<br>
<gallery mode=packed heights=250px>
File:C BSFL1.jpg| frame |This sticker is brush parented to the glass. Flashlight off.
File:C BSFL2.jpg| frame |This sticker is brush parented to the glass. Flashlight on.
</gallery>
Same will happen if you use [[overlays]]/[[decals]] on brushes with [[$translucent]].
<br>
<gallery mode=packed heights=350px>
File:C MS1.jpg| frame |Metal speaker is overlay that use [[$alphatest]], but lighting of the health charger visible anyway, because overlay pasted on the transparency window.
</gallery>
This issues does not happen if replace [[LightmappedGeneric]] to [[ShatteredGlass]] or [[UnlitGeneric]], so, you can use one of them for glass or transparency surfaces when it's needed.
<br>
<gallery mode=packed heights=250px>
File:C HahF1.jpg| frame |[[LightmappedGeneric]].
File:C HahF2.jpg| frame |[[ShatteredGlass]].
</gallery>
In some cases use [[$alphatest]] if it'll give similar to [[$translucent]] resualts, with this your surface also will cast dynamic shadows.
<br>
<gallery mode=packed heights=250px>
File:C AF1.jpg| frame |[[$translucent]].
File:C AF2.jpg| frame |[[$alphatest]].
</gallery>
----
 
====Deferred lighting incorrect work with [[$alphatestreference]] and [[$allowalphatocoverage]]====
[[$alphatestreference]] is a [[material]] [[shader]] parameter that specifies the threshold alpha channel value at which the surface should be transparent instead of opaque, default "0.5". [[$allowalphatocoverage]] creates translucent steps based on alpha values. Both have one and same problems with deferred lighting.
For examples used this texture with this alpha channel.
<br>
<gallery mode=packed heights=250px>
File:C_ATSC_D.jpg| frame |Diffuse texture.
File:C_ATSC_A.jpg| frame |Alpha channel.
</gallery>
Here deferred lighting placed behind wall with the texture, lighting is red and shadows is blue. We can see the circle part of that have alpha channel part which is invisible due to $alphatest, with enabled deferred lighting we see that the invisible part doesn't show through itself deferred lighting with shadows.
<br>
<gallery mode=packed heights=250px>
File:C_ODSL_1_С.jpg| frame |Dynamic light disabled behind wall with the texture, using standart VRAD light.
File:C ODSL_2.jpg| frame |Dynamic light enabled behind wall with the texture, not using standart VRAD light.
</gallery>
From the opposite side the invisible part illuminates everything in itself equally, without taking into account decay of light, it's also don't show shadows and other dynamic lights in itself.
<br>
<gallery mode=packed heights=250px>
File:cIIPSEE_.jpg| frame |Dynamic light disabled, using standart VRAD light.
File:C IIPSEE.jpg| frame |Dynamic light enabled, not using standart VRAD light.
</gallery>
If use very low numbers you will see resualts like in the pictures.
<br>
<gallery mode=packed heights=250px>
File:cCCCC_11.jpg| frame |Dynamic light disabled, using standart VRAD light.
File:C CCCC_12.jpg| frame |Dynamic light enabled, not using standart VRAD light.
</gallery>
<br>
<gallery mode=packed heights=250px>
File:C CCCC_21.jpg| frame |Dynamic light disabled, using standart VRAD light.
File:CCCCC_22.jpg| frame |Dynamic light enabled, not using standart VRAD light.
</gallery>
You can't escape this problem, only minimize effect with <code>$alphatestreference 0.1</code> or if paint alpha correct channel.
----
====Godrays incorrect work with [[$alphatestreference]] and [[$allowalphatocoverage]]====
Godrays process invisable parts, you can't escape this problem, only minimize effect with <code>$alphatestreference 0.1</code> or if paint alpha correct channel.
<br>
<gallery mode=packed heights=350px>
File:c_GIWTAAA.jpg| frame |An example.
</gallery>
You can't escape this problem, only minimize effect with <code>$alphatestreference 0.1</code> or if paint alpha correct channel.
----
 
====Godrays 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 resualts similar to [[$translucent]]. You also can try use some other tricks to escape this problem.
<br>
<gallery mode=packed heights=250px>
File:cGodraysTransBug.jpg| frame |Bug example in bm_c1a3c.
File:cGodraysTransBugSide.jpg| frame |Sign from other side.
</gallery>
----
====Godrays draw through water====
Deferred lighting don't fully draw through water, unlike Godrays.
<br>
<gallery mode=packed heights=350px>
File:C C3m0c.jpg| frame |Black Mesa: Blue Shift - bs_c3m0c.
</gallery>
----
 
====Godrays leaks====
Due to way Godrays works, in some cases they can be drawn through walls, appearing where they should not be visible at all. Disable rays with triggers or minimize effect.
<br>
<gallery mode=packed heights=450px>
File:BmsCodeWeNEED(Someone_from_Valve_please_allow_to_BM_devs_to_publish_the_game_code_to_make_possible_for_us_fix_this_bugs_please).gif| frame |An example.
</gallery>
----
 
====Godrays can't be displayed in monitors and reflections====
Godrays is post process effect that depends on player screen. That means that they can't water reflections or monitors can't show it.
<br>
<gallery mode=packed heights=250px>
File:C GodraysInWater.jpg| frame |An example.
File:C GodraysInMonitor.jpg| frame |An example.
</gallery>
----
====Godrays does not process surface models====
If player underwater - godrays will not process surface models, only inwater models. Doesn't work with [[func_water_analog]] and [[func_water]].
<br>
<gallery mode=packed heights=250px>
File:GodraysInWater_1.jpg| frame |Player not underwater.
File:GodraysInWater_2.jpg| frame |Player underwater.
</gallery>
----
 
====Weird clipping====
Often meeting strange clipping/flickering, strange bug that was in early stages of the game (this can be seen even in videos before new lights release in public), this does not depend on OS or drivers. Somehow related to <code>Range</code> value, since changing its value halfway fixes this bug, because it move away the bugged area.
<br>
<gallery mode=packed heights=350px>
File:cWC1.gif| frame |One of many examples.
File:cWC2.gif| frame |One of many examples.
File:cWC3.gif| frame |One of many examples.
</gallery>
----
 
====Brush polygons may clip deferred lighting====
Rare phenomenon, sometimes brush polygons clip deferred lighting, the reason that cause this is unknown. Can be easy fixed if divide invalid brush into two parts.
<br>
<gallery mode=packed heights=250px>
File:C BPl0.jpg| frame |One of examples (mat_wireframe 0).
File:C BPl1.jpg| frame |One of examples (mat_wireframe 1).
</gallery>
<br>
<gallery mode=packed heights=250px>
File:C BPb0.jpg| frame |One of examples (mat_wireframe 0).
File:C BPb1.jpg| frame |One of examples (mat_wireframe 1).
</gallery>
----
====Shadows incorrect work with [[newLight_Point]] cube edges====
Because [[newLight_Point]] arу cube technically - we get shadows incorrect behavior with edges of this cube, this cause their serious distortion a.k.a. clipping. You only can minimize this if set shadow quality to maximum.
<br>
<gallery mode=packed heights=350px>
File:cC SIWENCE0.jpg| frame |One of many examples.
File:Ccc_SIWENCE1.jpg| frame |One of many examples.
File:cC SIWENCE_2.jpg| frame |One of many examples.
</gallery>
----
 
====Deferred lighting shine through [[nodraw]] texture====
Not a bug, but a pattern. Unfortunately, this cannot be controlled in any way, you should keep in mind this before paint [[nodraw]] to escape situations like in the gifs. If your dynamic light source illuminates face that player never see - use cheap textures with low resolution and which don't use material shader parameters, a good solution would be tools/toolsblack or any {{Shader Name|UnlitGeneric}} texture.
<br>
<gallery mode=packed heights=350px>
File:cSLB1.gif| frame |Black Mesa - bm_c2a2a.
File:cSLB2.gif| frame |Black Mesa: Blue Shift - bs_c0m0c.
</gallery>
----
====Shadows don't appear immediately after reload====
After game save and load shadows don't appear for short time, maybe it has something to do with caching. This appearance duration may vary depending on power of user PC and how much of lights with enabled shadows are turned on at level, but in any case user will get this issue even with most powerful PC. Enable in [[worldspawn]] settings <code>Level Fade In</code> to hide this problem, this setting also will hide some other problems with loads that avaible in{{bms|4}}.
<br>
<gallery mode=packed heights=450px>
File:cSDAIAR1.gif| frame |With no <code>Level Fade In</code>. It seems like the shadows flicker, which makes it unpleasant for eyes.
File:cSDAIAR2.gif| frame |With <code>Level Fade In</code>. Everything looks fine.
</gallery>
----
 
====Shadows don't appear immediately with a lot of lights with shadows====
If your level use a lot of lights with shadows - shadows from enabling lights will not appear immediately, this happens if light source was disabled and if player's camera did not see this light source enabled initially.This happen because shadows use passes per frame for memory, if level use a lot of new lights - game change integer value of cvar <code>nr_shadow_max_passes_per_frame</code> to lower numbers. Can be fixed in some cases if change cvar <code>nr_shadow_max_passes_per_frame</code> value with [[point_servercommand]] to <code>25</code> or if enable light source at level start and keep it enabled before drawing of level allows player's camera to see this light source, disable this light source and than enable when we need this.
<br>
<gallery mode=packed heights=450px>
File:cSDAIWALOLWS1alt.gif| frame |An example.
File:cSDAIWALOLWS2.gif| frame |bm_c2a1a.
</gallery>
----
====Dynamic lights with shadows may buggy====
In some cases your attached lights may have buggy shadows if parent moving, work smart when use this feature. If your moving light is decoration - highly recommended to leave shadows disabled to save limits and performance.
<br>
<gallery mode=packed heights=350px>
File:CSDAIWALOLWS1.gif| frame |An example.
File:cDLWSMB2.gif| frame |bm_c1a1c.
</gallery>
----
====[[Viewmodel]] illuminated by deferred render draw in [[refract]] shader====
Refract shader and [[Water_(shader)|Water]] shader take and refract player screen space without taking into account viewmodel. However - viewmodel illuminated by deferred render draw in refract shader because of game can't tell the depth of viewmodel because of the transparency, what you are see in the pictures is just the lighting layer applied to the color of transparency texture.
<br>
<gallery mode=packed heights=250px>
File:C DFS1Alt.jpg| frame |Clear example in test map, the hivehand illuminated by deferred render draw in the refract texture, plus it's completely discolored there..
File:C DFS2.jpg| frame |Black Mesa - bm_c4a1a.
File:C DFS3.jpg| frame |Black Mesa: Blue Shift - bs_c2m0a.
</gallery>
----
 
====Objects with [[refract]] shader self refract if illuminated by deferred render====
Objects with [[refract]] shader in their own refraction disable self, to escape some problems. However - objects with [[refract]] shader illuminated by deferred render refract self because of game can't tell the depth of objects because of the transparency, what you are see in the pictures is just the lighting layer applied to the color of transparency texture.
<br>
<gallery mode=packed heights=250px>
File:as_c3map01_1.jpg| frame |as_c3map01 - flashlight disabled, everything looks fine.
File:as_c3map01_2.jpg| frame |as_c3map01 - flashlight enabled, now this magnifying lamp refract self.
</gallery>
<br>
Similar issue happen if model with refraction behind wall with refraction.
<br>
<gallery mode=packed heights=250px>
File:RefractBugs_1.jpg| frame |Flashlight disabled, everything looks fine.
File:RefractBugs_2.jpg| frame |Flashlight enabled, now this wall show one of magnifying lamp deferred lighting layers.
</gallery>
----
 
====Viewmodel doesn't support self-shadowing with deferred ligths====
Unlike cascade shadows - viewmodel doesn't support self-shadowing with deferred ligths. Not a bug, but this is not what you expect from real life, it also isn't so with [[env_projectedtexture]].
<br>
<gallery mode=packed heights=250px>
File:C CSMSF.jpg| frame |Here you can see how one of gluon gun switches create shadow that fall on other part of gun.
File:C DFSF.jpg| frame |Light spot illuminates gluon gun, but lighting just ignore viewmodel and fully shine through, although only the side of the gun should be light.
</gallery>
----
====Godrays and deferred lighting incorrect work with cloak====
Cloak is a material shader parameter for <code>VertexLitGeneric</code> shader, female assassins use it to make them transparent when they need it. Godrays all time fully render through them, same for deferred lighting.
<br>
<gallery mode=packed heights=250px>
File:C_ASSASINRAYS.jpg| frame |bm_c2a3c, the sun's rays are not cut off despite the fact that she is completely untransparent right now.
File:C_ASSASINDF.jpg| frame |bm_c2a3c, she is completely untransparent, but we still can see one of lighting layers.
</gallery>
----
====Godrays doesn't refract by refract shader and fully draw through====
Unlike deferred lighting Godrays doesn't refract by refract shader, also fully draw through.
<br>
<gallery mode=packed heights=350px>
File:AnGodexample.gif| frame |An example.
</gallery>
----
 
====Strange "holes" when player's camera is at a great distance====
In some cases may will appear strange "holes" when player's camera is at a great distance. Strange bug that occurs quite rarely. It is affected by game resolution, for example in <code>bm_c4a1b1</code> this bug shows up well with a resolution wtih <code>1920x1080</code>, but with <code>3840x2160</code> the light source from the teleporter flickers, but does not form a hole. Can be fixed if increase <code>NormalBias</code> number.
{{ModernConfirm|Does it happen with [[newLight_Spot]] ?}}
<br>
<gallery mode=packed heights=350px>
File:C_BMSH42.jpg| frame |Example in bm_c4a1b1, the green teleporter light source starts to glitch when player move certain distance (crossbow zoom doesn't effect to this bug, unlike HEV zoom).
</gallery>
<br>
<gallery mode=packed heights=250px>
File:C_BMSH_1.jpg| frame |Black Mesa, map bm_c4a1b1. NormalBias - 1.
File:C_BMSH_2.jpg| frame |Black Mesa, map bm_c4a1b1. NormalBias - 5.
</gallery>
<br>
<gallery mode=packed heights=250px>
File:C_BMOBSH_1.jpg| frame |Black Mesa: Black Ops - Restored, bmops_map_2. NormalBias - 0.5.
File:C_BMOBSH_2.jpg| frame |Black Mesa: Black Ops - Restored, bmops_map_2. NormalBias - 1.5.
</gallery>
----
 
====Weapons dynamic light incorrect work with damaged [[func_breakable_surf]]====
For some reason weapons dynamic light can illuminate damaged [[func_breakable_surf]] even if position of it very far from position of damaged [[func_breakable_surf]].
{{ModernConfirm|Is there a way to fix this?}}
<br>
<gallery mode=packed heights=450px>
File:cAnSexample.gif| frame |An example.
</gallery>
----
====New lights don't work with [[3D Skybox]]====
Don't use new lights in your 3D skyboxes, none of them will work at all.
<br>
<gallery mode=packed heights=350px>
File:C NLDW3DS.jpg| frame |An example. We see that deferred lighting and Godrays works fine, but 3D Skybox don't draw both.
</gallery>
----
====Motion blur blurring viewmodel lighting layer====
For some reason <code>Motion blur</code> blurring viewmodel lighting layer, you can notice this when you just rotate camera.
<br>
<gallery mode=packed heights=550px>
File: cVLLBASUalt.gif| frame |An example.
</gallery>
----
====Deferred lighting incorrect work with [[Customize Character]] window====
For some reason [[Customize Character]] take player's screen, inserts it into character preview window and show one of deferred lighting layers.
<br>
<gallery mode=packed heights=350px>
File: BruhCharacter.jpg| thumb |An example with zombie scientist model.
</gallery>
----
====Deferred render atrociously work with Linux and Linux based OS====
Linux port is atrocious. The only thing that can help is proton. The only platform that works fine with Black Mesa is Windows.
<br>
<gallery mode=packed heights=350px>
File: feois.gif| frame |<code>feois</code>'s video. OS - Manjaro.
File: Deleted_User_d3feb451-3819.gif| frame |<code>Deleted User d3feb451#3819</code>'s video. OS - Linux.
</gallery>
----
====Deferred lighting does not draw with <code>-tools</code>====
If you don't use <code>Full Screen</code> - deferred lighting will not draw.
<br>
<gallery mode=packed heights=250px>
File:DLDNDWT_1.jpg| frame |In <code>Full Screen</code>.
File:DLDNDWT_2.jpg| frame |Out <code>Full Screen</code>.
</gallery>
<br>
----
====Deferred lighting that use shadows disappear after materials reload====
This issue happen when you open Hammer while game is opened, when you disable speculars with <code>mat_specular 0</code>, when you reload all matelias with <code>mat_reloadallmaterials</code>, e. t. c. Can be fixed with save reload.
<br>
<gallery mode=packed heights=250px>
File:DLDAMR_1.jpg| frame |Before <code>mat_reloadallmaterials</code>.
File:DLDAMR_2.jpg| frame |After <code>mat_reloadallmaterials</code>.
</gallery>
<br>
====Broken half-lambertian lighting====
Sources standard model lighting comes with a hacky way of boosting ambient lighting on characters and props. This is called half-lambertian lighting. The light is wrapped around the edges of a model which gives the lighting a softer appearance, prevents overly harsh shadows from normal maps. This was implemented as an easy and performant way to improve the appearance of lighting, at a cost of realism.
Consequentially, newlights also had half-lambertian lighting implemented. However, it is currently left in a broken state. The result is that meshes with [[$phong]] or [[$halflambert]] get lit from ALL sides perpendicular to newlights, including ones with opposing normals. Shadows help to mask this bug, but it still appears glaringly incorrect.
<br>
<gallery mode=packed heights=250px>
File:BHLL_1.jpg| frame |Phong disabled.
File:BHLL_2.jpg| frame |Phong enabled.
</gallery>
<br>
If you want to use [[$phong]] or [[$halflambert]] - you are able to fix this with adding in your [[VMT]] material parameter <code>"$halflambert_gbuffer_off"    "1"</code>.
<br>
<gallery mode=packed heights=250px>
File:BHLL_21.jpg| frame |$halflambert_gbuffer_off disabled.
File:BHLL_22.jpg| frame |$halflambert_gbuffer_off enabled.
</gallery>
<br>
This also makes new lighting with shadows much more realistic, since the light no longer shows through at edges of model.
<br>
<br>
<gallery mode=packed heights=250px>
File:BHLL_31.jpg| frame |$halflambert_gbuffer_off disabled.
File:BHLL_32.jpg| frame |$halflambert_gbuffer_off enabled.
</gallery>
<br>
However it have some limitations:
*As explained, this will only affect models that use $halflambert, which mostly means things with specularity/phong.
*Some areas may not quite bit lit the same as they may have depended on the bug. Notably areas entirely lit by newlights may seemingly lack ambient lighting and have overly dark shadows.
*Xen plant lights for instance have shadows on the bulbs as they did not use illumtextures.
You can use [https://steamcommunity.com/sharedfiles/filedetails/?id=3160360493 this] fix by [[User:Jofoyo|Jofoyo]] for your mods to fix this issue without manual correction for each model.
</div>
 
== See also ==
* [[New Lights Editor]]
* {{ent|newLight_Spot}}
* {{ent|newLight_Dir}}
* {{ent|NewLights_settings}}
* {{ent|godrays_settings}}
* {{ent|env_cascade_light}}
* [[New_Specular|New Specular]]
* [[newxog_volume]]
* [[Lighting]]
* [[Adding Light]]
* [[Intermediate Lighting]]
* [[Advanced Lighting]]
* [[Effect flags]] (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 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 Black Mesa developer about how a frame rendered, include Godrays.)
* [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 [[Xengine]])
{{todo|Investigate and document some keyvalues and functions. Clean up english. Add more issues if you'll find.}}

Latest revision as of 14:35, 18 August 2024

Note.pngNote:Archived rest of page history of page NewLight Point
Icon-Important.pngImportant:These pages are linked often from page history logs so Special:WhatLinksHere will not show anything.