NewLight Point: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(badly moved multipage rest of page history at Archived Page History/NewLight Point)
 
(92 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LanguageBar}}
{{this is a|point entity|name=newLight_Point|game=Black Mesa|sprite=NewLight Point.png}} It creates an invisible [[Deferred lighting|deferred light]] source that shines in all directions, includes godrays and lightcookies.
{{Toc-right}}{{this is a|point entity|name=newLight_Point|game=Black Mesa|sprite=NewLight Point.png{{!}}45px}}{{Multiple issues}}
{{CDA|CNewLightPoint|CBaseEntity|}}
[[File:NewLight_PointMain.jpg|720px||thumb|right|NewLight_Point in {{code|End Game}} chapter (used for the portal).]]
{{Note|You can have only 512 point light entities placed in the map editor.}}
{{todo|Rework this page.}}


It is one of the many new lighting entities available. Black Mesa incorporates a new lighting system which utilizes [[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.
{{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=450px>
File:NewLight_PointGIFNEW.gif| frame | center | 510px |NewLight_Point in <code>Endgame</code> chapter.
</gallery>
==Keyvalues==
==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 Targetname}}
{{KV|Name|intn=targetname|target_source|The name that other entities refer to this entity by.}}
{{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.
{{KV|Parent|intn=parentname|target_destination|The name of this entity's parent in the movement hierarchy. Entities with parents move with their parent.}}
:{{note|There is almost no differences if you're using point light with no texture. Things changes if you're using textures.}}
{{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 BmNewLightOldFalloff}}
{{KV BmNewLightBaseMain}}
{{KV BmNewLightShadowMain}}
{{KV BmNewLightShadowFace}}
{{KV BmNewLightShadowBias}}
{{KV BmNewLightCookieMain}}
{{KV|LightnGodRayMode|intn=LightnGodRayMode|choices|This determines what effects will be available to use for the light source. Keep in mind that the default choice is Light.
:*0: Light - light only.
:*1: Godrays - godrays only.
:*2: Both Light and GodRays - both light and godrays.
:{{bug|hidetested=1|Even if godrays is turned off, the game will still think that the godrays is used if choice is <code>Godrays</code> or <code>Both Light and GodRays</code>.}}
}}
}}
{{KV|Light Color|intn=LightColor|color255|This is the color of the sunlight.
{{KV BmGodraysNormal}}
Determines color of light.}}
{{KV BmGodraysFancy}}
{{KV|Light Ambient Color|intn=LightColorAmbient|color255|This is the ambient color of the sunlight.
{{KV BmNewLightShadowPasses‎}}
Determines color of shadows that light source creates.}}
 
{{expand|title=Examples|
==Inputs==
<br>
{{I|SetColorLight|param=color255|Change light's color value. Doesn't affect the godrays.}}
<gallery mode=packed heights=500px>
{{I|SetIntensityForLight|param=float|Change light's intensity value. Doesn't affect the godrays.}}
File:cShadowC1.jpg| thumb | left | 510px | 0 0 0
{{I|TurnOnGodRays|param=void|Turn the godrays on.}}
File:cShadowC2.jpg| thumb | left | 510px | 255 0 0
{{I|TurnOffGodRays|param=void|Turn the godrays off.}}
File:cShadowC3.jpg| thumb | left | 510px | 255 128 128
{{I|TurnOn|param=void|Turn the light on.}}
{{I|TurnOff|param=void|Turn the light off.}}
{{I|Toggle|param=void|Toggle the light's current state.}}
 
==Lightcookies==
===What is a lightcookie texture ?===
Lightcookie (a. k. a. "Texture Light") a texture or mask applied to a light source. It is usually used to shape the light's output or fake shadows with specific patterns (which, unlike shadowmaps, can be translucent and look more accurate). It also can be used for stuff like projectors, cautists, disco spheres, etc.
 
In Black Mesa, it can be used via "'''Texture name for TexLight''' ''(texName)''" property (to specify the texture) and "'''Enable Texture Light''' ''(bTexLight)''" (to enable the feature).
 
This game used lightcookies mainly for fake shadowmaps and cautists. They are used for some entities by default ([[Item battery (Black Mesa)|batteries]] and grunt pods for example).
 
<gallery mode=packed heights=290px>
File:lightcookie0.jpg |Lightcookie is disabled.
File:lightcookie1.jpg |Lightcookie is enabled.
</gallery>
</gallery>
}}
 
{{KV|Light Intensity|intn=Intensity|float|RGB * Intensity.
Lightcookies are disabled with 2 ('''Low''') value for {{cmd|nr_shadow_quality}} ('''Dynamic Shadow Quality''').
Brightness of the light.}}
===Texture mask===
{{Note|With 0 will not draw, process and specular shader be disabled.}}
The texture mask defines which pixels will display the lighting and also affects their color. Black pixel color will not render the light at all, white will render the light and its color value, other colors (red, blue, yellow, etc.) will be mixed with the light color value, depending on their intensity and how close they are to white. Alpha channel doesn't affect anything, so make sure you don't use it in your texture.  
{{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.}}
Point lights requires "Environment Map" texture to work with lightcookies, because point lights are using 6 separate faces, so each face requires separate texture. Follow [[$envmap#Creating_a_custom_static_cubemap_texture|these steps]] to create "Environment Map" texture.
{{expand|title=Examples|
 
<br>
Spot lights can use any texture basically.
<gallery mode=packed heights=500px>
 
File:cBS IN1.jpg| thumb | left | 510px | SpecularMultiplier - 1
It is recommended to use '''No Mipmap''' and '''No Level Of Detail''' flags for your [[VTF]] file, so the texture will not cause aliasing issues.
File:cBS IN10.jpg| thumb | left | 510px | SpecularMultiplier - 10
 
File:cBS IN20.jpg| thumb | left | 510px | SpecularMultiplier - 20
<gallery mode=packed heights=290px>
File:lightcookie_aliasing.jpg |Two point lights with two different lightcookie textures. The left don't use the flags, unlike the right texture.
</gallery>
</gallery>
}}
 
{{KV|Range|intn=Range|float|Range.
{{important|Lightcookies are not using [[VMT]] materials, you only need texture.}}
How far the light source illuminates. Measured in Hammer Units.}}
 
{{Important|It greatly affects optimization, less is better.}}
===Animation===
{{expand|title=Examples|
Spot lights also support 2 different animation types, which allow you to animate a texture in two different ways.
<br>
 
<gallery mode=packed heights=500px>
====Texture Cookie FPS====
File:cL1.jpg| thumb | left | 510px | Range - 150
In this mode, a spot light will split image into specified amount of frames (so called atlases) and change frames with specified speed (FPS).
File:cL2.jpg| thumb | left | 510px | Range - 300
 
File:cL3.jpg| thumb | left | 510px | Range - 500
The splitting of specified texture into separate parts is done using two-dimensional arrays (in this context, this can also be called a two-dimensional table). The value from '''TexCookieFramesX''' (''TexCookieFramesX'') creates the specified number of rows, the value from '''TexCookieFramesY''' (''TexCookieFramesY'') creates the specified number of columns.  
 
The final number of frames is the value from '''TexCookieFramesX''' multiplied by '''TexCookieFramesY'''. For example, value 3 in both '''TexCookieFramesX''' and '''TexCookieFramesY''' will split image into 9 parts.
 
<gallery mode=packed heights=290px>
File:Background01.jpg |''console\background01.vtf'' original image.
File:background01_lightcookie_spit.jpg |''console\background01.vtf'' splitted into 9 parts (3 by 3).
</gallery>
</gallery>
}}
 
{{KV|Light Type|intn=LightType|choices|
The spot light will change frames from top to bottom and left to right. The frames from the top row are shown first, the spot light passes over them from left to right, then moves down to the next row. If it showed the last frame, it will restart the process. The amount of time it takes to move to the next frame depends on specified value from '''TexCookieFps''' (''TexCookieFps'').
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).  
====Texture Cookie Scroll Mode====
*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.}}
In this mode, lightcookie texture can scroll in X and Y directions. This feature can be enabled with '''Tex Cookie Scroll Mode''' (''bTexCookieScrollMode'') property.
*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|
X direction controlled by '''ScrollSpeedU''' (''fScrollSpeedU'') property. Y direction controlled by '''ScrollSpeedV''' (''fScrollSpeedV'') property. Both takes a float value. The default X direction is left, Y is up. Using a value multiplied by -1 will reverse direction, this allows you to use 8 different scroll directions. 0 means don't move in this direction. The size of the value affects the scroll speed.
<br>
 
<gallery mode=packed heights=420px>
Here is the [https://youtu.be/FkUFF6CLTq8 video] showcase of all 8 directions and how the feature look like.
File:B-1.gif|| thumb | left | 510px | Light Type - Static
 
File:B0.gif| thumb | left | 510px | Light Type - Stationary
{{note|Combing this mode with previous will result in using first atlas frame for scroll mode.}}
File:B1.gif| thumb | left | 510px | Light Type - Dynamic
 
==Shadow Mapping==
To cast dynamic shadows, Black Mesa uses {{WP|shadow mapping}} (shadow maps for short) technique for new point and spot light entities when '''HasShadow''' property is enabled. Used local shadowmap camera and [[Depth buffer|depth buffer]].
<gallery mode=packed heights=310px>
File:BmsShadowMapBuffer.jpg| frame |Flashlight's shadowmap camera in depth buffer.
File:BmsShadowMapFinnal.jpg| frame |The final image.
</gallery>
</gallery>
}}
Spot light uses only one camera, while point lights 6 for 6 different directions to make more accurate shadows for omnidirectional light, this is why it takes 6 shadowmap slots ([[NewLight_Point#Shadow_map_slots|see below]]) and 6 times the cost of new spot light. You can disable each shadowmap individually for a new point light entity.
{{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.
The shadowmaps stored in a large shadowmap atlas, which makes having lots of shadowmap textures a lot cheaper for GPU. There is two of them, one for static shadowmaps ([[NewLight_Point#Static_shadow_maps|see below]]) and one more for dynamic shadowmaps.
*0: No
*1: Yes}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:cBM NO.jpg| thumb | left | 510px | Has Shadow - NO
File:BmsShadowMapAtlas.jpg| frame |One of the shadow atlases.
File:cBM YES.jpg| thumb | left | 510px | Has Shadow - YES
</gallery>
</gallery>
}}
 
{{KV|ShadowMapLOD|intn=ShadowLod|choices|Resolution of ShadowMap used by this light.
Because shadowmap is a texture with limited amount of pixels in it, distance from the light source and objects makes it less accurate a distance.
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.
<gallery mode=packed heights=410px>
*0: 256
File:BmsShadowMapDist1.jpg| frame |Small distance between the light source and [[Npc barney|Barney]]'s model.
*1: 512
File:BmsShadowMapDist2.jpg| frame |Large distance between the light source and [[Npc barney|Barney]]'s model.
*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>
</gallery>
}}
 
{{KV|ShadowFaceX|intn=ShadowFaceX|choices|Shadow Enabled for this Face ?
Shadow [[Field of View|FOV]], which can be changed with '''OuterAngle''' property or '''ShadowFOV''' property, also affects shadowmap quality. Due to the pixels spread, shadows are less accurate with large FOV values.
Determines whether the given side lighting will display shadows.
<gallery mode=packed heights=410px>
*0: Enabled
File:BmsShadowMapFovQ1.jpg| frame |60 '''OuterAngle''' value.
*1: Disabled}}
File:BmsShadowMapFovQ2.jpg| frame |170 '''OuterAngle''' value.
{{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>
</gallery>
}}
 
{{KV|SlopeDepthBias|intn=SlopeDepthBias|float|Slope Depth Bias - For surfaces having aliasing due to steep angles with light}}.
There is 3 shadowmap resolutions, small (256), medium (512) and big (1024). Higher values create sharper, more accurate shadows, but cost much more to render. Sharp shadows may not be appropriate for all situations either, sometimes soft shadows look more accurate. They are defined by '''ShadowMapLOD''' property, which uses hard coded choice (0, 1, 2), this is why it's not possible to use custom shadowmap resolutions. Each shadowmap resolution takes one shadowmap slot.
{{expand|title=Examples|
<gallery mode=packed heights=310px>
<br>
File:ShadowMapLOD256.jpg| 510px | 256
<gallery mode=packed heights=500px>
File:ShadowMapLOD512.jpg| 510px | 512
File:SlopeDepthBias1.jpg| thumb | left | 510px | SlopeDepthBias - 0.2
File:ShadowMapLOD1024.jpg| 510px | 1024
File:SlopeDepthBias2.jpg| thumb | left | 510px | SlopeDepthBias - 8
File:SlopeDepthBias3.jpg| thumb | left | 510px | SlopeDepthBias - 20
</gallery>
</gallery>
}}
The edges of the shadows can be made smoother (or more stepped) with '''ShadowRadius''' property. It determines the 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 {{command|nr_shadow_rad_High}}, {{command|nr_shadow_rad_Med}} and {{command|nr_shadow_rad_Low}}.
{{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.}}
<gallery mode=packed heights=290px>
{{expand|title=Examples|
File:ShadowRaduis1.jpg| 510px | ShadowRadius - 0.0001
<br>
File:ShadowRaduis2.jpg| 510px | ShadowRadius - 1
<gallery mode=packed heights=500px>
File:ShadowRaduis3.jpg| 510px | ShadowRadius - 5
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>
</gallery>
The '''NearZ''' distance used by shadowmap camera (distance at which the light source will start cast shadows) can be controlled with '''NearZ''' property. The '''FarZ''' distance uses value from '''Range''' property.
Console variable {{cmd|nr_shadow_quality}} sets shadow quality and enable/disable shadows for all or certain objects. Controlled by Dynamic Shadow Quality option. Only 5 values are available for it:
* 0 (Disabled) - Shadows and lightcookies are completely disabled.
* 1 (POTATO) - Shadows are available for world geometry and displacements, only for Static and Stationary light types. The shadows are very pixelated. The player's flashlight also gets very simple shadows with "stairs".
* 2 (Low) - Added brush entities and static props in shadowmaps, only for Static and Stationary light types. Enabled lightcookies.
* 3 (Medium) - All the shadows are also available for Dynamic light type.
* 4 (Hight) - Added dynamic models in shadowmaps for Stationary and Dynamic.
Console variable {{cmd|nr_shadow_res}} affects the quality of shadows. Controlled by Dynamic Shadow Memory option. Only 4 values are available for  it:
* 0 (Hight) - Hight quality.
* 1 (Medium) - Medium quality.
* 2 (Low) - Low quality.
* 3 (POTATO) - Very low quality.
{{bug|hidetested=1|If there are too many shadowmaps in a frame, this can lead to laggy shadow atlas update.
{{todo|How many ?}}
}}
}}
{{bug|Numbers lower than 0.8 can cause huge graphics problems.}}
 
{{expand|title=The bug example|
===Shadow filtering===
<br>
Versions of the game before Necro Patch uses PСF filter. The shadow edges are sharper and exhibit a more distinct transition. There are visible aliasing artifacts, particularly on the edges. Shadows from small or thin objects were also indistinguishable. However, it was pretty good for shadows with low resolution, because they looked blurry. The shadows are somewhat similar to those that can be seen from the [[projected texture|projected textures]] in {{portal2|4}}.
<gallery mode=packed heights=720px>
<gallery mode=packed heights=410px>
File:cNormalBiasBug.gif| frame | NormalBias - 0
File:shadowfilter_old.jpg| frame |Barney's hand with old shadow filtering.
</gallery>
</gallery>
}}
The Necro Patch replaced PСF filter with PCSS filter. The shadow edges appear smoother and less jagged. The transition from the shadow to the lit area has more gradient-like softening. Shadows have become more detailed for small objects. Because of this, you have to adjust the shadows more carefully.
{{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. The best example is the batteries that use lights/lightcookie_battery.vtf.
*0: Disabled
*1: Enabled}}
{{expand|title=Examples|
<br>
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:cTEDisabled.jpg |Disabled
File:shadowfilter_new.jpg| frame |Barney's hand with new shadow filtering.
File:cTEEnabled.jpg |Enabled
File:CLightcookie_battery.jpg |Texture that use batteries.
</gallery>
</gallery>
}}
This filter has one significant issue: there is now noticeable noise in the shadows. This is mostly noticeable in low resolution shadows, this spoils them quite a lot (although it makes them more detailed). There is no way to disable this effect. The noise also makes the shadows more similar to shadows from flashlight in {{hl2|4}}. It is worth noting that such thing exists in more modern engines ([https://en.wikipedia.org/wiki/Unreal_Engine Unreal Engine 5] for example, even though they are not easily visible due to [[Anti-aliasing#TAA/TSSAA|temporal anti-aliasing]] smoothing the artifact), so you can ignore the noise if it's not very noticeable, especially on shadows with high quality.
{{tip|Lightcookie texture works just like static cubemap textures. Follow [[$envmap#Creating_a_custom_static_cubemap_texture|this]] steps to create your own lightcookie texture.}}
 
{{Note|One of the most expensive features, use wisely. If shadows enabled - it can work with lags even with powerful PC.}}
The noise is adjusted via ShadowRadius and ShadowMapLOD values, mainly via ShadowRadius; you even can disable the noise with 0 value, but this will make your shadows will look like stairs/pixels.  
{{KV|Texture name for TexLight|intn=texName|string|Determines which texture will use light source. It use .vtf files, not .vmt.}}
<gallery mode=packed heights=310px>
{{KV|.Enable Prop Only Mode|intn=bNegLight|choices|Enable Prop Only Mode.
File:shadowfilter_new1.jpg| frame |The noise example.
{{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>
</gallery>
}}
{{note|It is not entirely clear which term is correct, '''PCSS''' or '''PCCS''', since it could be orgography, but it is possible (though unlikely) that they created their own filter.}}
{{note|The game will think that the godrays is used if choice is <code>Godrays</code> or <code>Both Light and GodRays</code>, even if godrays is turned off.}}
 
{{KV|EnableGodRays|intn=EnableGodRays|choices|Enable GodRays.
===Static shadow maps===
Determines whether godrays are enabled or not at map start.
If our light source remains in the same position and never changes it, we expect that shadows from world geometry, [[displacement]], {{ent|prop_static}} and even [[bmodel|bmodels]] (brush entities) are completely static, this means that we don't need to update shadows for them every frame, so it would be nice to bake shadows for all such objects to save performance. This is why we need static shadow maps.  
*0: Disabled
 
*1: Enabled}}
When your light appears, static shadow maps skip all the dynamic models in their pass and take 1-6 pictures of everything mentioned above, then static shadow maps applies to the lighting from the light source and never change again (until save reload).
{{warning|You can have only 40 point lights with godrays enabled simultaneously, otherwise game will crash with this error message.}}
 
<br>
This doesn't happen if your light source is disabled, so you need to keep it enabled on spawn around 1 second. If you need disabled light source - set intensity value to 0 and then after 1 second turn off light source (don't forget to set required intensity value).
<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==
Static shadow maps are used for Static and Stationary light type. For Stationary type, engine also disable shadows passes in dynamic shadows for everything mentioned above, so that the use of static shadow maps makes sense (this still saves performance quite well). Dynamic light type don't use static shadow maps at all, because it can move, so we need to have dynamic shadows for everything.
{{IO|SetColorLight|param=color255|Change Light's Color value. Doesn't affect the godrays.}}
{{IO|SetIntensityForLight|param=float|Change Light's intensity value. Doesn't affect 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}}


==Outputs==
Important to note that bmodels are also in static shadows maps, including {{ent|func_physbox}}, {{ent|func_door}}, {{ent|func_breakable}}, etc. This is true, despite the fact that such objects can be removed or moved. Most likely this is due to {{ent|func_detail}}, which is very similar in principle to regular world geometry, but cannot be removed or moved, unlike all other brush entities. It gives some problems, because shadows from lab doors or elevators will remain static, while these objects are moving. There are 2 good ways to workaround this issue, "lazy" method and " time-consuming" method. The first is very simple and quick, just use Dynamic light type, this will reduce performance but will completely fix the problem and save your time. The second is using [[Propper]] with converting your brush to model, you'll need spend time on {{ent|propper_model}} setting and brush replacing, but this will also save performance and solve the problem.
{{O BaseEntity|}}


==Shadow map slots==
===Shadow map slots===
Shadow map slots is how many lights with shadows you can have per level. There are 3 separate shadow map slots, <code>High</code> (for lights with <code>1024</code> value for <code>ShadowMap LOD</code> property), <code>Medium</code> (for lights with <code>512</code> value for <code>ShadowMap LOD</code> property) and <code>Low</code> (for lights with <code>256</code> value for <code>ShadowMap LOD</code> property).
Shadow map slots is how many lights with shadows you can have per level. There are 3 separate shadow map slots, <code>High</code> (for lights with <code>1024</code> value for <code>ShadowMap LOD</code> property), <code>Medium</code> (for lights with <code>512</code> value for <code>ShadowMap LOD</code> property) and <code>Low</code> (for lights with <code>256</code> value for <code>ShadowMap LOD</code> property).


Line 448: Line 182:
Each spot light with shadows takes 1 shadow map slot, so you can have 48/47 spot lights with shadows, if they are using the same value for <code>ShadowMap LOD</code> property.
Each spot light with shadows takes 1 shadow map slot, so you can have 48/47 spot lights with shadows, if they are using the same value for <code>ShadowMap LOD</code> property.


Each point light with shadows takes 6 shadow map slots. This is due to point light isn't just omnidirectional light source, it's 6 spot lights in one entity. This means that you can have 8 point lights with shadows, if they are using the same value for <code>ShadowMap LOD</code> property. You can increase this value if you need, just disable shadows for one of the shadow face properties.
Each point light with shadows takes 6 shadow map slots, because point light uses 6 separate shadow maps to render shadows. This means that you can have 8 point lights with shadows, if they are using the same value for <code>ShadowMap LOD</code> property. You can increase this value if you need, just disable shadows for one of the shadow face properties.


If one of the shadow map slots is full - you will not be able to have shadows for more lights with such shadow quality, you will need to use other value for <code>ShadowMap LOD</code> property.
If one of the shadow map slots is full - you will not be able to have shadows for more lights with such shadow quality, you will need to use other value for <code>ShadowMap LOD</code> property.
Line 463: Line 197:
It looks like you can workaround it if you will switch <code>ShadowMap LOD</code> property values from higher to lower.
It looks like you can workaround it if you will switch <code>ShadowMap LOD</code> property values from higher to lower.


==Lighting behavior With [[VIS]] and [[areaportals]]==
{{tip|You can use {{command|nr_debug_print_shadow_slots_info}} to get full info about shadowmap slots.}}
===Static type===
 
===Shadow map passes per frame===
Instead of using the current value from the [[FPS]], shadows use the value from {{cmd|nr_shadow_max_passes_per_frame}} console variable. It stagger the updation of shadow maps, for both static and dynamic, over a few frames. This feature adjustable via '''Dynamic Shadow Memory''' graphics settings. This solution preserves performance, since instead of using 300 from FPS value, the shadow will be updated only 24 times per second, which is enough to display most scenes in dynamic shadows.
{{bug|hidetested=1|'''"End Game"''' chapter crashes at some moment with 29 and higher values.}}
 
===Shadows behavior with [[VIS]] and [[areaportals]]===
====Static type====
Static type is the most stable, since its shadows are baked in and updates only with save loads or while lighting  turning on. It shows all shadows even with closed [[areaportal]].
Static type is the most stable, since its shadows are baked in and updates only with save loads or while lighting  turning on. It shows all shadows even with closed [[areaportal]].
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
Line 470: Line 210:
File:staticlight_1.jpg| frame |Areaportal is closed.
File:staticlight_1.jpg| frame |Areaportal is closed.
</gallery>
</gallery>
===Stationary type===
====Stationary type====
Shadows for static props and brushes are baked, but not for physics props and other dynamic models. This means that shadows from dynamic models will disappear if they are hidden by a closed areaportal or if [[VIS]] is hiding such objects. Shadows for static props and brushes will not disappear.
Shadows for static props and brushes are baked, but not for physics props and other dynamic models. This means that shadows from dynamic models will disappear if they are hidden by a closed areaportal or if [[VIS]] is hiding such objects. Shadows for static props and brushes will not disappear.
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
Line 480: Line 220:
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:Theboxshadow_0.jpg| frame |Areaportal hides the box, note that there is no shadow.
File:Theboxshadow_0.jpg| frame |Areaportal hides the box, note that there is no shadow.
</gallery>
<gallery mode=packed heights=410px>
File:Theboxshadow_1.jpg| frame |Areaportal shows the box, now there is a shadow of the box.
File:Theboxshadow_1.jpg| frame |Areaportal shows the box, now there is a shadow of the box.
</gallery>
</gallery>
With {{command|mat_wireframe|1}}.
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
File:thewireboxshadow_0.jpg| frame |Areaportal hides the box.
File:thewireboxshadow_0.jpg| frame |Areaportal hides the box.
</gallery>
<gallery mode=packed heights=410px>
File:thewireboxshadow_1.jpg| frame |Areaportal shows the box.
File:thewireboxshadow_1.jpg| frame |Areaportal shows the box.
</gallery>
</gallery>


===Dynamic type===
====Dynamic type====
Shadows for static props and world geometry are baked, but not for dynamic models and brushes. This means that shadows from dynamic models and brushes will disappear if they are hidden by a closed areaportal or if [[VIS]] is hiding such objects. Shadows for static props and world geometry will not disappear. Moving lighting will update shadows for static props and world geometry, even with closed areaportal.
Shadows for static props and world geometry are baked, but not for dynamic models and brushes. This means that shadows from dynamic models and brushes will disappear if they are hidden by a closed areaportal or if [[VIS]] is hiding such objects. Shadows for static props and world geometry will not disappear. Moving lighting will update shadows for static props and world geometry, even with closed areaportal.
<gallery mode=packed heights=410px>
<gallery mode=packed heights=410px>
Line 498: Line 235:
</gallery>
</gallery>


==Bugs/Limitations==
===Player spawn and areaportals===
{{todo|make a TOC specifically for this box to make navigation easier}}
If player spawned in position where areaportal don't hide objects - shadows will be fine. Otherwise, static shadowmap will not see models with [[bmodel|bmodels]] and will bake shadows only for world geometry and displacements. This problem is not relevant only for Dynamic light type. The problem disappears after save reload from proper position.
<!-- WIP TOC HERE:
<gallery mode=packed heights=410px>
<center>{{Expand|title=Table of Contents|1=<span style=color:white>'''Table of Contents'''</span><br>
File:psaa_0.jpg| frame |Player spawned in position where areaportal don't hide objects. The columns are {{ent|func_detail}}, the pipes are {{ent|prop_static}}.
;[[#Deferred_lighting_incorrect_work_with_.24translucent|Deferred lighting incorrect work with $translucecnt]]
File:psaa_1.jpg| frame |Player spawned in position where areaportal hide objects. Note that the columns and pipes don't have any shadows.
}}</center>
</gallery>
-->
<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 have issues with transparency====
Deferred lighting is incompatible with transparency. In some cases, it shows one of the lighting layers applied to the color of the transparent texture.


This bug is currently available by default for [[VertexLitGeneric]] and [[Lightmapped_4WayBlend]], if they are using [[$translucent]] material parameter.
===Shadows behavior with start/end fade dist for prop_static===
<br>
This mechanic has some issues with static shadowmaps. It seems that there are limitations that don't allow to fix these issues, or this issues was not noticed at the development stage.
<gallery mode=packed heights=250px>
====Static type====
File:C BugHah.jpg| frame |No [[$translucent]]. Behind the wall placed lighting and some models with small room.
If player spawns in fade radius - shadows will never disappear (until save reload if out of radius).
File:C BugDamn.jpg| frame |With [[$translucent]]. Now player see everything, but only what lighted.
<gallery mode=packed heights=410px>
File:fadepropstaticlight_1.jpg| frame |In radius.
File:fadepropstaticlight_0.jpg| frame |Out of radius.
</gallery>
</gallery>
<br>
If player spawns out of radius. - shadows will never appear (until save reload in radius).
<gallery mode=packed heights=250px>
<gallery mode=packed heights=410px>
File:firethinghaha.jpg| frame |An example with model.
File:fadepropstaticlight_3.jpg| frame |
</gallery>
</gallery>
The same happen if used [[$decal]] material parameter.
The same for props with both Start and End fade dist.
<br>
====Stationary type====
<gallery mode=packed heights=250px>
The above mentioned issues are also available for this type.
File:GbufferDecalBrush.jpg| frame |An example.
 
Appears issue for prop_static with both Start and End fade dist.
 
If player spawns in Start fade radius - shadows will never disappear (until save reload if out of radius). The same happens if player spawns in End fade radius.
 
If player spawns out of radius - shadows will appear if you are in End fade radius and disappear if you are in Start fade radius (until save reload in radius). This happens because prop_static actually disappears completely, and creates a separate object as a fading model (this is also why decals disappear if player is out of Start fade radius).
 
<gallery mode=packed heights=210px>
File:fadepropstatiorlight_1.jpg| frame |In radius.
File:fadepropstatiorlight_2.jpg| frame |Out of Start fade radius.
File:fadepropstatiorlight_3.jpg| frame |Out of End fade radius.
</gallery>
</gallery>
This problem also applies to brushes which don't use [[$translucent]], but which is a part of a [[func]] entity with a transparency brush (the only exception is {{ent|func_detail}}). This happen even if transparency used for shader that doesn't shows one of the lighting layers.
 
<br>
====Dynamic type====
<gallery mode=packed heights=250px>
Dynamic type don't use static shadowmaps at all. This means that there is no problems with fading prop_static at all.
File:C BSFL1.jpg| frame |This sticker is brush, that is part of [[func_brush]], which uses glass as part of itself. Flashlight off.
{{important|All the issues are also available for {{ent|func_lod}}.}}
File:C BSFL2.jpg| frame |This sticker is brush, that is part of [[func_brush]], which uses glass as part of itself. Flashlight on.
 
==Godrays Implementation==
===Implementation===
Godrays in this game are based on [[Sprite|sprite]] entities. They are a post-processed 2D plane that always turns to player's camera. The size of such plane is consistent with the screen size making it appear larger at a distance, in comparison to the world, similar to how '''Glow''' render mode works for {{ent|env_sprite}}, but unlike the render mode, such plane is rendered so that the sprite will cut through any surrounding geometry, similar to how '''Additive''' render mode works for {{ent|env_sprite}}.
<gallery mode=packed heights=210px>
File:grandsprite_0.jpg| frame |Sprite.
File:grandsprite_1.jpg| frame |Godrays.
</gallery>
</gallery>
If a func entity or model uses [[render mode]] {{code|Glow}} (3) or {{code|World Space Glow}} (9) - they will show one of the lighting layers. This means that you can't use this renders to make your brush transparent, you will have to create a separate texture.
This plane is also not affected by VIS, which means that you will always see it, even if your area in which your light source is located is closed by an areoportal.
<br>
<gallery mode=packed heights=290px>
<gallery mode=packed heights=250px>
File:cRaysDraw.jpg| thumb | left | 510px | 
File:WSGAGFI.jpg| frame |Clear example. The box with fire extinguisher and brush uses the render modes.
</gallery>
</gallery>
Other render modes will have similar effect, but only for brushes.
Such implementation has several  consequences that limits amount of cases when you can use it.
<br>
===Limitations And Use Tips===
<gallery mode=packed heights=250px>
Local point light godrays can "leak" (example on the pictures), since nothing limits the rendering and the size of the plane. The only you can do is place triggers that will turn on/off godrays, but this also basically means  you can't use godrays in multiplayer levels, because multiple players can be located in different places of your map (there is no way to disable godrays for each client separately).
File:RenderModesBuggyMine.gif| frame |Clear example.
<gallery mode=packed heights=310px>
File:godraysleak0.jpg| frame |
File:godraysleak1.jpg| frame |
</gallery>
</gallery>
Similar issue happen with [[overlays]]/[[decals]] on brushes with [[$translucent]].
Because godrays always turns to player's camera, make sure you are using this effect in areas where view angle for player is very limited. The reason is showed in this short video [https://youtu.be/YvhWpE_X4RU clip], note how battery stops processing at some moment.
<br>
<gallery mode=packed heights=310px>
<gallery mode=packed heights=350px>
File:godrayslimiting0.jpg| frame |Bad example, player's view angle is not limited, the player also can walk around in any direction. Both factors are making godrays leaking and bad clipping most of the time.
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.
File:godrayslimiting1.jpg| frame |Good example, player can look at the godrays forwardly only. The player also can walk only back or forward in this area. Both factors making the godrays nice looking.
</gallery>
</gallery>
In some cases, use [[$alphatest]], if it'll give similar to [[$translucent]] resualts, with this your surface also will cast dynamic shadows.
{{note|Everything mentioned here also applies to the disks.}}
<br>
 
<gallery mode=packed heights=250px>
==Dedicated [[ConVars]]==
File:C AF1.jpg| frame |[[$translucent]].
{{varcom|start}}
File:C AF2.jpg| frame |[[$alphatest]].
{{varcom|nr_allow_hammer_nerfs|0|[[Integer]]|Allow new lights nerfs via {{ent|Newlights_gbuffersettings}} entity.
</gallery>
 
{{ModernConfirm|Is there more shaders with this issue ?}}
0 - Disabled.
{{ModernConfirm|Is there more ways to get this bug ?}}
 
----
1 - Allowed.
 
2 - Enabled/Forced.
}}
{{varcom|nr_allow_hammer_nerfs_4ways|0|Integer|Allow {{code|Enable4WaysFastPath}} property from {{ent|Newlights_gbuffersettings}} entity.
 
0 - Disabled.
 
1 - Allowed.
 
2 - Enabled/Forced.
}}
{{varcom|nr_shadow_max_passes_per_frame|16|[[Float]]|Frame per second in shadowmaps. The higher the value, the smoother and faster the shadows from objects can change. The recommended value is 24-28, not higher.}}
{{varcom|nr_shadow_quality|4|Integer|Sets shadow quality and enable/disable shadows for all or certain objects. Controlled by '''Dynamic Shadow Quality''' option. Only 5 values are available here.
 
0 (Disabled) - Shadows and lightcookies are completely disabled.
 
1 (POTATO) - Shadows are available for world geometry and displacements, only for '''Static''' and '''Stationary''' light types. The shadows are very pixelated. The player's flashlight also gets very simple shadows with "stairs".
 
2 (Low) - Added brush entities and static props in shadowmaps, only for '''Static''' and '''Stationary''' light types. Enabled lightcookies.
 
3 (Medium) - All the shadows are also available for '''Dynamic''' light type.
 
4 (Hight) - Added dynamic models in shadowmaps for '''Stationary''' and '''Dynamic'''.
}}
{{varcom|mat_unlock_gfx_highend_unsupported|0|[[Bool]]|When enabled this convar will unlock extreme graphics options. There will be a significant FPS drop when running game on ULTRA or INSANE configs. Game will consume upto 3 gigs of VRAM when some of the extreme graphics options have been enabled. These high end graphics config options are not officially supported. Don't enable this unless you have at least 3.5 GHZ quad core CPU with GTX 1080. These options are mainly for debugging and modders.}}
 
{{varcom|nr_lights_quality|4|Integer|Sets lights quality, state (for specific entities), enable/disable effects. Controlled by '''Dynamic Light Quality''' option. Only 7 values are available here.
 
0 (POTATO) - Disabled muzzle flash light (regardless of {{command|muzzleflash_light}}), lighting from batteries (regardless of {{command|cl_battery_dlights}}), light sources from [[dynlightscript.txt]], dynamic lights are also disabled for some other entities. Halflambertion is disabled. New specular is disabled. Bumpmaps are disabled. Lights are disabled completely in secondary cameras (monitors, water, etc). Overlaying on viewmodel looks pretty broken. Light is not smoothed out (most noticeable in the least bright areas).
 
1 (Low) - Allowed muzzle flash light, lighting from batteries, enabled light sources from [[dynlightscript.txt]], other dynamic lights are also enabled for some other entities. Enabled bumpmaps for models.
 
2 (Medium) - Enabled bumpmaps for brushes. Lights in secondary cameras, but most effects is disabled.
 
3 (Hight) - Halflambertion with new specular is enabled. Fixed overlaying on viewmodel. Light is smoothed out.
 
4 (Very Hight) - Bumpmaps are also uncompressed, this makes lighting on surfaces more detailed.
 
5 (INSANE) - All the effects is enabled in secondary cameras.
 
6 (DevOnly) - This one for developers only. Includes uncompressed buffers and 32-bit depth. Don't use if you are general player or modder.
}}
{{varcom|nr_shadow_res|0|Integer|Affects the quality of shadows. Controlled by '''Dynamic Shadow Memory''' option. Only 4 values are available here.
 
0 (Hight) - Hight quality.
 
1 (Medium) - Medium quality.
 
2 (Low) - Low quality.
 
3 (POTATO) - Very low quality.
}}
{{varcom|nr_shadow_res_dkvk|0|Integer|It doesn't seem to work.}}
 
{{varcom|r_4way_minimal_mode_override|-1|Integer|Enable/disable bumpmaps for {{ent|Lightmapped_4WayBlend}}. Since one material of this shader provides 4 bumpmaps at once, disabling them will significantly affect performance.
 
-1/0 - Enabled.
1/2 - Disabled.
{{note|This cvar needs {{command|mat_reloadallmaterials}} to see changes.}}}}
{{varcom|np_gr_quality|2|Integer|Enable/disable godrays. Controlled by '''God Rays''' option or '''Enable God Rays''' button (if used [[VGUI]]).
 
0 - Disabled.
 
1/2 - Enabled. 1 supposed to enable godrays only for {{ent|newLight_Dir}}, 2 for both point lights and {{ent|newLight_Dir}}, but currently both values enable both types.}}
{{varcom|np_gr_quality_sample_count|3|Integer|Amount of samples for godrays. This affects the quality/detail of the rays. Controlled by '''God Rays''' option, although the original game never changes the value (always 3). Min value is 0, max is 4. The max value is not recommended, it has a huge impact on frame rate, at the same time it does not create a big difference in the game.}}
{{varcom|np_gr_quality_pass_count|1|Integer|Pass count. Not very clear what exactly this affects, but it significantly reduces performance, and Fancy Rays also become pretty buggy. Controlled by '''God Rays''' option, although the original game never changes the value (always 1). Min value is 0, max is 4. Use the default value only.}}
 
{{varcom|nr_gbuffer_for_reflection_enabled|1|Bool|Enable/disable gbuffer for water reflections.}}
{{varcom|nr_gbuffer_for_refraction_enabled|1|Bool|Enable/disable gbuffer for refractions.}}
{{varcom|nr_gbuffer_for_secondary_cams_enabled|1|Bool|Enable/disable gbuffer for secondary cameras (monitors, etc).}}
{{varcom|nr_gbuffer_for_secondary_cams_quality|-1|Bool|New lights quality in secondary cameras and water reflections. With -1 it will use quality from {{command|nr_lights_quality}} cvar. With 0-5 it will use itown quality settings (in the same way as {{command|nr_lights_quality}}).}}
 
{{varcom|nr_shadow_filter_quality|2|Integer|Sets shadow filter quality. Min value is 0, max is 3.
 
0 (POTATO) - Shadow filter disabled.
 
1 (Medium) - Medium quality.
 
2 (Hight) - Hight quality.
 
3 (INSANE) - Best filter quality.


====Deferred lighting doesn't shows on transparency materials====
}}
Very noticeable with shaders that doesn't shows one of the lighting layers applied to the color of the transparent texture. Properly works with [[$alphatest]].
<gallery mode=packed heights=250px>
File:LDSOTM_.jpg| frame |An example. Expected that you will see shadows from the ropes and the plastic road cone on the window.
File:LDSOTM_p2ce.jpg| frame |The same moment, but in {{p2ce|4}} (this game uses {{ent|env_cascade_light}} from {{csgo|4}}.)
</gallery>
----


====Flicker near light volume edges====
{{varcom|nr_shadow_rad_Low|1.0|Float|Sets shadow filter quality scale for lights with 256 ShadowLOD value.}}
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). Somehow related to <code>Range</code> value, since changing its value halfway fixes this bug, because it move away the bugged area. With [https://store.steampowered.com/news/app/362890/view/4174347361777844150?l Necro Patch], this is fixed for {{ent|newLight_Spot}}.
{{varcom|nr_shadow_rad_Med|1.5|Float|Sets shadow filter quality scale for lights with 512 ShadowLOD value.}}
<br>
{{varcom|nr_shadow_rad_Hight|1.5|Float|Sets shadow filter quality scale for lights with 1024 ShadowLOD value.}}
<gallery mode=packed heights=350px>
File:cWC1.gif| frame |One of many examples.
File:cWC3.gif| frame |One of many examples.
</gallery>
----


====Brush polygons may clip deferred lighting====
{{varcom|nr_shadow_biasoverwrite|0|Bool|Used by [[New Lights Editor]]. Allows/disallows to overwrite bias related values.}}
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.
{{varcom|nr_shadow_nearz_overrite|-1.0|Float|Used by [[New Lights Editor]]. Changes NearZ value for all new lights.}}
{{note|Most often happen if map used fast compile settings.}}
{{varcom|nr_shadow_rad_override|0|Bool|Used by [[New Lights Editor]]. Allows/disallows to overwrite shadow radius related values.}}
<br>
{{varcom|nr_shadow_fov_overrite|-1|Float|Used by [[New Lights Editor]]. If the value of this convar is higher than -1 it will overrite FOV for shadowed lights.}}
<gallery mode=packed heights=250px>
{{varcom|nr_shadow_biasdepth|0.0002|Float|Used by [[New Lights Editor]]. Changes Depth Bias value for all new lights.}}
File:C BPl0.jpg| frame |One of examples (mat_wireframe 0).
{{varcom|nr_shadow_biasnormaloffset|1|Float|Used by [[New Lights Editor]]. Changes Normal Bias value for all new lights.}}
File:C BPl1.jpg| frame |One of examples (mat_wireframe 1).
{{varcom|nr_shadow_biasslope|0.2|Float|Used by [[New Lights Editor]]. Changes Slope Depth Bias value for all new lights.}}
</gallery>
{{varcom|nr_shadow_active|666|Integer|Sets max active shadowmaps. The value seems hardcoded.}}
<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>
----


====Deferred lighting shines 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.
{{workaround|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 [[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>
----


====Objects with [[refract]] shader self refract if illuminated by deferred render====
{{varcom|nr_debug_print_shadow_slots_info||[[Void]]|Prints text to the console about shadowmap slots and their light sources.
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>
{{workaround|Divide model into two separate parts, one should use only textures with refraction, the second without textures with refractions.}}
----


====[[Viewmodel]] illuminated by deferred render draw in [[refract]] shader====
It prints light type (point or spot) with their index, shadowmap enabled state (for each face), shadowmaps number, new light's targetname and position of it.
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>
----


====<code>Motion Blur</code> blurring viewmodel lighting layer====
Below it also prints information about free shadowmap slots for each shadow resolution.
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>
----


====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.
{{ModernConfirm|Does it happen with [[newLight_Spot]] ?}}
{{workaround|Can be fixed with <code>NormalBias</code> value increasing.}}
<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>
----


====Gbuffer doesn't draw while cubemaps is building====
{{varcom|nr_debug_force_shadowmap_res|-1|Bool|Only for debugging. Forces all new lights to use specified shadowmap resolution. -1 means use value from the property.}}
Deferred lighting, godrays, xog and other gbuffer effects doesn't draw while cubemaps is building. This means that you will not see any lighting from new lights in cubemaps.
{{varcom|nr_debug_force_dynamic_on_all_stationary_lights|0|Bool|Only for debugging. Forces all stationary new lights to be fully dynamic and update even baked shadows.}}
<br>
{{varcom|nr_debug_force_lightstyle|0|Integer|Only for debugging. Forces all new lights to use specified appearance/light style. Possible values are 0-13. 13 for custom style from {{command|nr_debug_force_lightstyle_custom_string}}. 0 means use use value from the property.}}
<gallery mode=packed heights=250px>
{{varcom|nr_debug_force_lightstyle_custom_string|1|[[String]]|Only for debugging. Forces all new lights to use custom appearance/light style. Works the same as with lightmapped lights.}}
File:GDDWCiB_1.jpg| frame |This is what see player.
{{varcom|nr_debug_shadow_render_internal_disable|0|Bool|Only for debugging. Forces all new lights to disable shadowmaps rendering.}}
File:GDDWCiB_2.jpg| frame |This is what shows cubemap reflection (note the reflection on the [[weapon_rpg|RPG]] doesn't shows any lighting from this crystal).
{{varcom|nr_debug_shadow_print_indices_assignment|0|Bool|Only for debugging. Prints text to the console about all new light sources and shadowmaps after level/save loading.}}
File:GDDWCiB_3.jpg| frame |This is how it looks while cubemaps is building.
{{varcom|nr_debug_lights_mesh|0|Bool|Only for debugging. Enable/disable new lights mesh.}}
</gallery>
{{varcom|nr_debug_lights_mesh_fullscreen|0|Bool|{{todo|}}}}
----
{{varcom|nr_debug_light_mesh_volumesize_large|0|Bool|Only for debugging. Enable/disable new lights large mesh volume size mesh.}}


====New lights doesn't work with [[3D Skybox]]====
{{varcom|nr_debug_cull_deferred_lights|1|Bool|{{todo|}}}}
Don't use new lights in your 3D skyboxes, none of them will work at all.
{{varcom|nr_debug_cull_deferred_code_lights_via_bsp|1|Bool|{{todo|}}}}
<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 doesn't draw both.
</gallery>
----


====Materials reload cause new lights disappear====
{{varcom|nr_dev_shoot_lights_enabled|0|Bool|Enable/disable point lights on each shoot. Only for player and only for bullet weapons. Shotgun can create several at once. Disappears after save reload.{{warning|Kills performance.}}}}
Only for new lights which uses shadows. 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.
{{varcom|nr_dev_lights_quality_override|0|Bool|Enable/disable light quality override. Required for some cvars with {{code|nr_dev_}} prefix.}}
<br>
{{varcom|nr_dev_gb_debug_type|4|Integer|0 - DepthOnly. 1 - GBuffer_Fast 2 - GBuffer_Fast2. 3 - GBuffer_Fast3. 4 - Gbuffer_Slow.}}
<gallery mode=packed heights=250px>
{{varcom|nr_dev_gb_quality|2|Integer|Changes gbuffer quality.}}
File:DLDAMR_1.jpg| frame |Before <code>mat_reloadallmaterials</code>.
{{varcom|nr_dev_lb_quality|1|Integer|0 is broken. 1 - default mode. 2 - debug materials with new specular.}}
File:DLDAMR_2.jpg| frame |After <code>mat_reloadallmaterials</code>.
</gallery>
----


====Gbuffer incorrect work with cloak====
{{varcom|nr_disable_setting_auto_reload|0|Bool|{{todo|}}}}
Cloak is a material shader parameter for <code>VertexLitGeneric</code> shader, female assassins uses it to make self transparent when they need it. Godrays all time fully render through them, same for deferred lighting and xog, even
<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>
----


====Deferred lighting incorrect work with [[Customize Character]] window====
{{varcom|nr_fps_spam|0|Bool|For devolopers only. Spamming in the console performance values. Numbers aren't accurate.}}
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 lighting does not draw with <code>-tools</code>====
{{varcom|nr_light_spot_bbox_optimizie|2|Intenger|Sets BBOX type for spot lights. Min value is 0, max is 3. There are note that 1 is broken. 3 makes BBOX size very small, so spot light sources will disappear even if they are in the player's field of vision.}}
If you don't use <code>Full Screen</code> - deferred lighting will not draw.
{{varcom|nr_light_spot_mesh_volumesize_large|0|Intenger|This makes BBOX larger than it needs to be.}}
<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>
----


====Broken water transition in [[viewmodel]]====
{{varcom|nr_lights_info||Void|Used by the game when you launch it. Prints in the console info about hardware support for texture formats, allocated formats and quality settings.}}
You can note the broken lighting transition when you go into water (only if water is world geometry and uses refractions).
<gallery mode=packed heights=450px>
File:watertransbug.gif| frame |An example.
</gallery>
----


====Godrays incorrect work with [[$translucent]]====
{{varcom|nr_lights_vol_check_threshold|10|Float|{{todo|}}}}
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 (the same issue happen if used material shader parameter [[$decal]]). 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.
{{varcom|nr_light_settings_transition_exp|2|Integer|Affects the quality of the transition for changes from {{ent|newLights_settings}}. 0 - no transition. 1 - transition. 2 - smooth transition.}}
<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 fully draws through water====
{{varcom|nr_lights_procedural_disable_all_lights|0|Bool|Disable all proceduraly created new lights ({{ent|npc_zombie_hev}}, {{ent|item_battery}}, weapons, etc).}}
Deferred lighting doesn't fully draws through water, unlike godrays.
{{varcom|nr_lights_procedural_enable_lights_priority_check|1|Bool|If enabled - all the code based procedural lights will go through priority based check before adding to render queue.}}
<br>
<gallery mode=packed heights=350px>
File:C C3m0c.jpg| frame |Black Mesa: Blue Shift - bs_c3m0c.
</gallery>
----


====Godrays leaks====
{{varcom|r_nr_deffered_debug_normals|0|Bool|Enable/disable normals debug.}}
Due to way how godrays works, in some cases you can note the leaking. Can be drawn even through walls, appearing where they should not be visible at all. Disable rays with triggers or minimize effect.
{{varcom|r_nr_deffered_force_diffuse_only|0|Bool|Forces new lights to use diffuse texture only.}}
<br>
{{varcom|r_nr_deffered_lights_hlslclip_range_on|1|Bool|Enable/disable actual new light range in normals debug.}}
<gallery mode=packed heights=450px>
{{varcom|r_nr_deffered_lights_hlslclip_dir_on|0|Bool|{{todo|}}}}
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 doesn't process [[viewmodel]] if player is underwater====
[https://store.steampowered.com/news/app/362890/view/4174347361777844150?l Necro Patch] fixed the old issue with godrays that wasn't processing models above water. This fix caused new issue, now godrays doesn't process [[viewmodel]] if player is underwater. Doesn't happen with [[func_water]] and [[func_water_analog]].
<br>
<gallery mode=packed heights=250px>
File:GDPVIPUU_0.jpg| frame |Player is not underwater.
File:GDPVIPUU_1.jpg| frame |Player is underwater.
</gallery>
----


====Godrays can't be displayed in monitors and reflections====
{{varcom|r_nr_deferred_AA_fix_multiplier|1|Bool|Fixes anti aliasing issues.
Godrays is post process effect that depends on player screen. That means that they can't water reflections or monitors can't show it.
{{note|Godrays for monitors and reflections was added with [https://store.steampowered.com/news/app/362890/view/4174347361777844150?l Necro Patch]. However, this is disabled in the code by default, because it didn't work correctly. There is no way to enable this feature.}}
<br>
<gallery mode=packed heights=250px>
File:C GodraysInWater.jpg| frame |An example.
File:C GodraysInMonitor.jpg| frame |An example.
</gallery>
----


====Godrays doesn't refracting by refract shader and fully draws through====
:{{expand|title=Example|
Unlike deferred lighting, godrays doesn't refracting by refract shader, also fully draws through.
<br>
<br>
<gallery mode=packed heights=350px>
<gallery mode=packed heights=500px>
File:AnGodexample.gif| frame |An example.
File:deferred_AA_fix_multiplier0.jpg| thumb | left | 510px | Disabled.
File:deferred_AA_fix_multiplier1.jpg| thumb | left | 510px | Enabled.
</gallery>
</gallery>
----
}}
{{varcom|sv_ignite_light_mode|2|Integer|Sets fire light source availability for ignited objects. Min value is 0, max is 3.


====Moving lights with shadows are buggy====
0 - Fully disabled.
In some cases, your attached lights may have buggy shadows if parent is moving.
<br>
<gallery mode=packed heights=350px>
File:CSDAIWALOLWS1.gif| frame |An example.
File:cDLWSMB2.gif| frame |bm_c1a1c.
</gallery>
Can be partially fixed with <code>NormalBias</code> value increasing. Also, if your moving light is just simple decoration (the puzzle crystals from [[Xen]] is great example) - highly recommended to leave shadows disabled to save limits and performance.
<gallery mode=packed heights=350px>
File:MLWSAR1.jpg| frame |<code>NormalBias</code> - 1
File:MLWSAR2.jpg| frame |<code>NormalBias</code> - 10
</gallery>
----


====Shadows incorrect work with [[newLight_Point]] cube edges====
1 - Available for marines, doesn't work.
Because [[newLight_Point]] is 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>
----


====Shadows have noise====
2 - Available for all NPCs.
This noise appeared with [https://store.steampowered.com/news/app/362890/view/4174347361777844150?l Necro Patch], greatly spoils blurry shadows. The only workaround is to make <code>ShadowRadius</code> value very low, but then the shadows will become extremely sharp and stepped.
<br>
<gallery mode=packed heights=450px>
File:20240320202853_1.jpg| frame |An example.
</gallery>
----


====Shadows doesn't appear immediately after reload====
3 - Available for everything, including physics objects and player.
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.
{{bug|Doesn't work with {{ent|env_shooter}}.|hidetested=1}}
{{workaround|Enable in [[worldspawn]] settings <code>Level Fade In</code> to hide this problem, this setting also will hide some other issues 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.
}}
{{workaround|Before turning on light, set the intensity for light (via <code>SetIntensityForLight</code> input) to 0, then turn on light source and set the intensity to the desired value with delay of 0.5 seconds. Also, {{command|nr_shadow_max_passes_per_frame}} set to 25 can help in some cases.}}
<br>
<gallery mode=packed heights=450px>
File:cSDAIWALOLWS1alt.gif| frame |An example.
File:cSDAIWALOLWS2.gif| frame |bm_c2a1a.
</gallery>
----
====Shadows low passes per frame if used a lot of lights with shadows====
Sometimes many lights with shadows sets low values for {{command|nr_shadow_max_passes_per_frame}} cvar. This cause shadows to be looking a lot less natural.
{{workaround|Very easy to fix with {{ent|point_servercommand}}, just place {{ent|logic_timer}} which will fire {{command|nr_shadow_max_passes_per_frame|28}} command each 2 seconds.}}
<br>
<gallery mode=packed heights=420px>
File:shadowpascom.gif| frame |nr_shadow_max_passes_per_frame - 16
File:shadowpascom2.gif| frame |nr_shadow_max_passes_per_frame - 28
</gallery>
----


====Viewmodel doesn't support self-shadowing with deferred ligths====
{{varcom|end}}
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]].
{{note|
<br>
* It's not full list.
<gallery mode=packed heights=250px>
* Some of these console variables needs save reload for changes.
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>
----


====Weapons dynamic light incorrect work with damaged [[func_breakable_surf]]====
==Bugs/Limitations==
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]].
See [[/Bugs and limitations]]
{{ModernConfirm|Is there a way to fix this?}}
<br>
<gallery mode=packed heights=450px>
File:cAnSexample.gif| frame |An example.
</gallery>
----
<br>
</div>


== See also ==
== See also ==
* [[New Lights Editor]]
* {{ent|newLight_Dir}} - directional sun light with godrays only.
* {{ent|newLight_Spot}}
* {{ent|NewLights_Spawner}} - spawner of deferred point lights.
* {{ent|newLight_Dir}}
* {{ent|env_lensflare}} - cinematic dynamic lens flare.
* {{ent|NewLights_settings}}
* {{ent|newLight_Spot}} - spot deferred light entity.
* {{ent|godrays_settings}}
* {{ent|newLights_settings}} - entity that changes deferred light settings.
* {{ent|env_cascade_light}}
* {{ent|godrays_settings}} - entity that changes godrays settings.
* [[New_Specular|New Specular]]
* {{ent|env_cascade_light}} - deferred cascade sun light entity.
* [[newxog_volume]]
* [[New Lights Editor]] - in game deferred lights editor.
* [[Lighting]]
* [[Effect flags]] - effects flags, some of them are dynamic light effects.
* [[Adding 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.
* [[Intermediate Lighting]]
* [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.
* [[Advanced Lighting]]
* [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}}.
* [[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 15:36, 10 July 2025

NewLight Point.png

newLight_Point is a point entity available in Black Mesa Black Mesa. It creates an invisible deferred light source that shines in all directions, includes godrays and lightcookies.

C++ Class hierarchy
CNewLightPoint
CBaseEntity
NewLight_Point in End Game chapter (used for the portal).
Note.pngNote:You can have only 512 point light entities placed in the map editor.
Todo: Rework this 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

Pitch Yaw Roll (Y Z X) (angles) <angle> !FGD
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.
Note.pngNote:There is almost no differences if you're using point light with no texture. Things changes if you're using textures.


Use old Falloff ? (bUseOldFallOff) <choices> !FGD Obsolete
Deprecated.
Sets old falloff state, disabled or enabled. This feature is disabled in the code, so you can't use old falloff (although it is still used for the flashlight).
  • 0: Disabled
  • 1: Enabled


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).


Light Type (LightType) <choices>
Type of the light. This affects the behavior of the light source with parent, enable/disable dynamic models in shadowmaps, enable/disable static shadowmaps.
  • 0: Static - used only static shadowmaps, this means that shadows are cast only by static objects (prop_static, geometry, etc). Cannot move with parent.
Icon-Important.pngImportant:Brush entities and bmodels are also included in static shadowmaps and they never update (including func_physbox).
Note.pngNote:Static shadowmaps will update after save reload (only once).
  • 1: Stationary - the same as Static, but with dynamic shadows for dynamic models.
  • 2: Dynamic - lighting don't use static shadowmaps at all. It uses dynamic shadows for static objects and dynamic models. This type also can move with parent. This type is expensive, usually used for moving lights, but also can be used if you're getting issues due to static shadowmaps.
Examples
Note.pngNote:Note that shadow from metal box and grate box are flying on first and second pictures, that's because both was placed in air on map spawn. Doesn't happen on third picture, because the light updated shadow for both.
HasShadow (HasShadow) <choices>
Sets shadows state for the light, enabled or disabled. Remember that the default choices is No.
  • 0: No
  • 1: Yes
Examples
ShadowMapLOD (ShadowLod) <choices>
Resolution of shadowmap used by this light. This affects the quality of the shadows.
  • 0: 256
  • 1: 512
  • 2: 1024
Examples
Icon-Important.pngImportant:You cannot use any value from here an unlimited number of times. More information below.
ShadowRadius (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.
Examples
Tip.pngTip:Don't use very low values, because the shadows will look like stairs. Also don't use very high values, because the noise will spoil them a lot, or you'll see only noise.
NearZ (NearZ) <float>
NearZ used by shadowmap camera for this light. This is the distance at which the light source will start cast shadows.


ShadowFaceX (ShadowFaceX) <choices>
Sets shadow state (enabled or disabled) for X face.
  • 0: Enabled
  • 1: Disabled
ShadowFaceX_Minus (ShadowFaceX_Minus) <choices>
Sets shadow state (enabled or disabled) for -X face.
  • 0: Enabled
  • 1: Disabled
ShadowFaceY (ShadowFaceY) <choices>
Sets shadow state (enabled or disabled) for Y face.
  • 0: Enabled
  • 1: Disabled
ShadowFaceY_Minus (ShadowFaceY_Minus) <choices>
Sets shadow state (enabled or disabled) for -Y face.
  • 0: Enabled
  • 1: Disabled
ShadowFaceZ (ShadowFaceZ) <choices>
Sets shadow state (enabled or disabled) for Z face.
  • 0: Enabled
  • 1: Disabled
ShadowFaceZ_Minus (ShadowFaceZ_Minus) <choices>
Sets shadow state (enabled or disabled) for -Z face.
  • 0: Enabled
  • 1: Disabled


DepthBias (DepthBias) <float>
DepthBias is offset added to depth values in shadowmaps.
Examples


SlopeDepthBias (SlopeDepthBias) <float>
Slope Depth Bias used for surfaces having aliasing due to steep angles with light.
Examples
NormalBias (NormalBias) <float>
While rendering objects into shadowmaps, each vertex will be moved along -ve Normal direction, giving it an appearance of shrinking while rendering to shadowmaps. This property determines the amount of Units to be moved. Helps with shadow aliasing.
Examples
Note.pngNote:You will not see any changes if your material doesn't not provide bumpmap.
Icon-Important.pngImportant:Increasing this value will make shadows between different surfaces less accurate, greate example is third picture in examples, there you can see "two" shadows from railing.
Icon-Bug.pngBug:Numbers lower than 0.8 can cause huge graphics issues. Example.
Tip.pngTip:Increase this value if you are getting aliasing issues like this.


Enable Texture Light (bTexLight) <choices>
Sets lightcookie (texture lights) state, enabled or disabled.
  • 0: Disabled
  • 1: Enabled
Examples
Warning.pngWarning:This is one of the most expensive features, use wisely.
Texture name for TexLight (texName) <string>
Determines which texture will use the light source. Lightcookies are using .vtf (not .vmt) texture from files (just like env_projectedtexture).
.Enable Prop Only Mode (bNegLight) <choices> Obsolete
Deprecated.
Sets prop only mode, which supposed to disable shadows for world geometry. Doesn't work. The same effect can be achieved with shadow pass settings.
  • 0: Disabled
  • 1: Enabled
LightnGodRayMode (LightnGodRayMode) <choices>
This determines what effects will be available to use for the light source. Keep in mind that the default choice is Light.
  • 0: Light - light only.
  • 1: Godrays - godrays only.
  • 2: Both Light and GodRays - both light and godrays.
Icon-Bug.pngBug:Even if godrays is turned off, the game will still think that the godrays is used if choice is Godrays or Both Light and GodRays.


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).


GodRaysType (GodRaysType) <choices>
Sets godrays type, normal or fancy.
  • 0: Normal
  • 1: Fancy
Examples
RenderInWorldSpace (m_bEnableWorldSpace) <choices>
Disables disks if this enabled.
  • 0: Disabled
  • 1: Enabled
Confirm:Does it affect anything else ?
Ell_FR_ConstA (Ell_FR_ConstA) <float>
This is fancy godrays disk size.
Examples
Ell_FR_ConstB (Ell_FR_ConstB) <float>
This is fancy godrays disk distortion.
Examples
EEll_SR_ConstA (EEll_SR_ConstA) <float>
This is fancy godrays disk hole size.
Examples
EEll_SR_ConstB (EEll_SR_ConstB) <float>
This is fancy godrays disk hole distortion.
Examples
Ell_RRF_ConstA (Ell_RRF_ConstA) <float>
This is fancy godrays inner size.
Examples


Ell_RRF_ConstB (Ell_RRF_ConstB) <float>
This is fancy godrays inner distortion.
Examples
RotSpeed (RotSpeed) <float>
Rotating speed of fancy godrays, 0 means don't rotate, with negative number it will rotate to left. Examples (link to a video that showcase different values).
RotPatternFreq (RotPatternFreq) <integer>
Count of fancy godrays, with negative number will deny RotSpeed +/- effect. Examples (link to a video that showcase different values).
m_fAlphaDiskInner (m_fAlphaDiskInner) <float> Obsolete
Deprecated.
Alpha inner value for disk. Doesn't work.
m_fAlphaDiskOuter (m_fAlphaDiskOuter) <float> Obsolete
Deprecated.
Alpha outer value for disk. Doesn't work.
UseToneMapRays (m_bUseToneMapRays) <choices> Obsolete
Deprecated.
Sets tonemap state for rays, enabled or disabled. Doesn't work.
  • 0: Enabled
  • 1: Disabled
UseToneMapDisk (m_bUseToneMapDisk) <choices> Obsolete
Deprecated.
Sets tonemap state for disk, enabled or disabled. Doesn't work.
  • 0: Enabled
  • 1: Disabled


ShadowPass_Brush (m_bSRO_Brush) <choices>
Do we want to render world geometry in shadow passes for this light ? Doesn't affect bmodels.
  • 0: YES
  • 1: NO
ShadowPass_StaticProp (m_bSRO_StaticProp) <choices>
Do we want to render prop_static in shadow passes for this light ? This also affect bmodels.
  • 0: YES
  • 1: NO
ShadowPass_DynProp (m_bSRO_DynProp) <choices>
Do we want to render dynamic models in shadow passes for this light ?
  • 0: YES
  • 1: NO
ShadowPass_AlphaTest (m_bSRO__Trans) <choices>
Do we want to render models with transparency materials in shadow passes for this light ? Objects with transparency can cast shadows if your model includes a material without transparency.
  • 0: YES
  • 1: NO

Inputs

SetColorLight <color255RedirectInput/color32>
Change light's color value. Doesn't affect the godrays.
SetIntensityForLight <floatRedirectInput/float>
Change light's intensity value. Doesn't affect the godrays.
TurnOnGodRays <void>
Turn the godrays on.
TurnOffGodRays <void>
Turn the godrays off.
TurnOn <void>
Turn the light on.
TurnOff <void>
Turn the light off.
Toggle <void>
Toggle the light's current state.

Lightcookies

What is a lightcookie texture ?

Lightcookie (a. k. a. "Texture Light") a texture or mask applied to a light source. It is usually used to shape the light's output or fake shadows with specific patterns (which, unlike shadowmaps, can be translucent and look more accurate). It also can be used for stuff like projectors, cautists, disco spheres, etc.

In Black Mesa, it can be used via "Texture name for TexLight (texName)" property (to specify the texture) and "Enable Texture Light (bTexLight)" (to enable the feature).

This game used lightcookies mainly for fake shadowmaps and cautists. They are used for some entities by default (batteries and grunt pods for example).

Lightcookies are disabled with 2 (Low) value for nr_shadow_quality (Dynamic Shadow Quality).

Texture mask

The texture mask defines which pixels will display the lighting and also affects their color. Black pixel color will not render the light at all, white will render the light and its color value, other colors (red, blue, yellow, etc.) will be mixed with the light color value, depending on their intensity and how close they are to white. Alpha channel doesn't affect anything, so make sure you don't use it in your texture.

Point lights requires "Environment Map" texture to work with lightcookies, because point lights are using 6 separate faces, so each face requires separate texture. Follow these steps to create "Environment Map" texture.

Spot lights can use any texture basically.

It is recommended to use No Mipmap and No Level Of Detail flags for your VTF file, so the texture will not cause aliasing issues.

Icon-Important.pngImportant:Lightcookies are not using VMT materials, you only need texture.

Animation

Spot lights also support 2 different animation types, which allow you to animate a texture in two different ways.

Texture Cookie FPS

In this mode, a spot light will split image into specified amount of frames (so called atlases) and change frames with specified speed (FPS).

The splitting of specified texture into separate parts is done using two-dimensional arrays (in this context, this can also be called a two-dimensional table). The value from TexCookieFramesX (TexCookieFramesX) creates the specified number of rows, the value from TexCookieFramesY (TexCookieFramesY) creates the specified number of columns.

The final number of frames is the value from TexCookieFramesX multiplied by TexCookieFramesY. For example, value 3 in both TexCookieFramesX and TexCookieFramesY will split image into 9 parts.

The spot light will change frames from top to bottom and left to right. The frames from the top row are shown first, the spot light passes over them from left to right, then moves down to the next row. If it showed the last frame, it will restart the process. The amount of time it takes to move to the next frame depends on specified value from TexCookieFps (TexCookieFps).

Texture Cookie Scroll Mode

In this mode, lightcookie texture can scroll in X and Y directions. This feature can be enabled with Tex Cookie Scroll Mode (bTexCookieScrollMode) property.

X direction controlled by ScrollSpeedU (fScrollSpeedU) property. Y direction controlled by ScrollSpeedV (fScrollSpeedV) property. Both takes a float value. The default X direction is left, Y is up. Using a value multiplied by -1 will reverse direction, this allows you to use 8 different scroll directions. 0 means don't move in this direction. The size of the value affects the scroll speed.

Here is the video showcase of all 8 directions and how the feature look like.

Note.pngNote:Combing this mode with previous will result in using first atlas frame for scroll mode.

Shadow Mapping

To cast dynamic shadows, Black Mesa uses Wikipedia icon shadow mapping (shadow maps for short) technique for new point and spot light entities when HasShadow property is enabled. Used local shadowmap camera and depth buffer.

Spot light uses only one camera, while point lights 6 for 6 different directions to make more accurate shadows for omnidirectional light, this is why it takes 6 shadowmap slots (see below) and 6 times the cost of new spot light. You can disable each shadowmap individually for a new point light entity.

The shadowmaps stored in a large shadowmap atlas, which makes having lots of shadowmap textures a lot cheaper for GPU. There is two of them, one for static shadowmaps (see below) and one more for dynamic shadowmaps.

Because shadowmap is a texture with limited amount of pixels in it, distance from the light source and objects makes it less accurate a distance.

Shadow FOV, which can be changed with OuterAngle property or ShadowFOV property, also affects shadowmap quality. Due to the pixels spread, shadows are less accurate with large FOV values.

There is 3 shadowmap resolutions, small (256), medium (512) and big (1024). Higher values create sharper, more accurate shadows, but cost much more to render. Sharp shadows may not be appropriate for all situations either, sometimes soft shadows look more accurate. They are defined by ShadowMapLOD property, which uses hard coded choice (0, 1, 2), this is why it's not possible to use custom shadowmap resolutions. Each shadowmap resolution takes one shadowmap slot.

The edges of the shadows can be made smoother (or more stepped) with ShadowRadius property. It determines the 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.

The NearZ distance used by shadowmap camera (distance at which the light source will start cast shadows) can be controlled with NearZ property. The FarZ distance uses value from Range property.

Console variable nr_shadow_quality sets shadow quality and enable/disable shadows for all or certain objects. Controlled by Dynamic Shadow Quality option. Only 5 values are available for it:

  • 0 (Disabled) - Shadows and lightcookies are completely disabled.
  • 1 (POTATO) - Shadows are available for world geometry and displacements, only for Static and Stationary light types. The shadows are very pixelated. The player's flashlight also gets very simple shadows with "stairs".
  • 2 (Low) - Added brush entities and static props in shadowmaps, only for Static and Stationary light types. Enabled lightcookies.
  • 3 (Medium) - All the shadows are also available for Dynamic light type.
  • 4 (Hight) - Added dynamic models in shadowmaps for Stationary and Dynamic.

Console variable nr_shadow_res affects the quality of shadows. Controlled by Dynamic Shadow Memory option. Only 4 values are available for it:

  • 0 (Hight) - Hight quality.
  • 1 (Medium) - Medium quality.
  • 2 (Low) - Low quality.
  • 3 (POTATO) - Very low quality.
Icon-Bug.pngBug:If there are too many shadowmaps in a frame, this can lead to laggy shadow atlas update.
Todo: How many ?

Shadow filtering

Versions of the game before Necro Patch uses PСF filter. The shadow edges are sharper and exhibit a more distinct transition. There are visible aliasing artifacts, particularly on the edges. Shadows from small or thin objects were also indistinguishable. However, it was pretty good for shadows with low resolution, because they looked blurry. The shadows are somewhat similar to those that can be seen from the projected textures in Portal 2 Portal 2.

The Necro Patch replaced PСF filter with PCSS filter. The shadow edges appear smoother and less jagged. The transition from the shadow to the lit area has more gradient-like softening. Shadows have become more detailed for small objects. Because of this, you have to adjust the shadows more carefully.

This filter has one significant issue: there is now noticeable noise in the shadows. This is mostly noticeable in low resolution shadows, this spoils them quite a lot (although it makes them more detailed). There is no way to disable this effect. The noise also makes the shadows more similar to shadows from flashlight in Half-Life 2 Half-Life 2. It is worth noting that such thing exists in more modern engines (Unreal Engine 5 for example, even though they are not easily visible due to temporal anti-aliasing smoothing the artifact), so you can ignore the noise if it's not very noticeable, especially on shadows with high quality.

The noise is adjusted via ShadowRadius and ShadowMapLOD values, mainly via ShadowRadius; you even can disable the noise with 0 value, but this will make your shadows will look like stairs/pixels.

Note.pngNote:It is not entirely clear which term is correct, PCSS or PCCS, since it could be orgography, but it is possible (though unlikely) that they created their own filter.

Static shadow maps

If our light source remains in the same position and never changes it, we expect that shadows from world geometry, displacement, prop_static and even bmodels (brush entities) are completely static, this means that we don't need to update shadows for them every frame, so it would be nice to bake shadows for all such objects to save performance. This is why we need static shadow maps.

When your light appears, static shadow maps skip all the dynamic models in their pass and take 1-6 pictures of everything mentioned above, then static shadow maps applies to the lighting from the light source and never change again (until save reload).

This doesn't happen if your light source is disabled, so you need to keep it enabled on spawn around 1 second. If you need disabled light source - set intensity value to 0 and then after 1 second turn off light source (don't forget to set required intensity value).

Static shadow maps are used for Static and Stationary light type. For Stationary type, engine also disable shadows passes in dynamic shadows for everything mentioned above, so that the use of static shadow maps makes sense (this still saves performance quite well). Dynamic light type don't use static shadow maps at all, because it can move, so we need to have dynamic shadows for everything.

Important to note that bmodels are also in static shadows maps, including func_physbox, func_door, func_breakable, etc. This is true, despite the fact that such objects can be removed or moved. Most likely this is due to func_detail, which is very similar in principle to regular world geometry, but cannot be removed or moved, unlike all other brush entities. It gives some problems, because shadows from lab doors or elevators will remain static, while these objects are moving. There are 2 good ways to workaround this issue, "lazy" method and " time-consuming" method. The first is very simple and quick, just use Dynamic light type, this will reduce performance but will completely fix the problem and save your time. The second is using Propper with converting your brush to model, you'll need spend time on propper_model setting and brush replacing, but this will also save performance and solve the problem.

Shadow map slots

Shadow map slots is how many lights with shadows you can have per level. There are 3 separate shadow map slots, High (for lights with 1024 value for ShadowMap LOD property), Medium (for lights with 512 value for ShadowMap LOD property) and Low (for lights with 256 value for ShadowMap LOD property).

In High and Medium you can have 48 separate shadow maps, for Low you can have 47 separate shadow maps (143 shadow maps in total).

Each spot light with shadows takes 1 shadow map slot, so you can have 48/47 spot lights with shadows, if they are using the same value for ShadowMap LOD property.

Each point light with shadows takes 6 shadow map slots, because point light uses 6 separate shadow maps to render shadows. This means that you can have 8 point lights with shadows, if they are using the same value for ShadowMap LOD property. You can increase this value if you need, just disable shadows for one of the shadow face properties.

If one of the shadow map slots is full - you will not be able to have shadows for more lights with such shadow quality, you will need to use other value for ShadowMap LOD property.

Point lights and spot lights doesn't counts separately. You can't have 48 spot lights with 8 point lights, but you can have 6 spot lights with 7 point lights.

You can free up shadow map slots with Kill input. So, you can place triggers which will Kill lights that player can't see and spawn new lights via point_template (uncheck the second flag for point_template, this prevents some bugs). This helps a lot when you want to have many dynamic lights in different areas.

Important to note that due to some engine bugs you can't use many lights with shadows. Some tests show that 9th point light cause lights with shadows to be very glitchy. This can be done with spot lights as well. So don't be surprised if at some point you find something like this.

It looks like you can workaround it if you will switch ShadowMap LOD property values from higher to lower.

Tip.pngTip:You can use nr_debug_print_shadow_slots_info to get full info about shadowmap slots.

Shadow map passes per frame

Instead of using the current value from the FPS, shadows use the value from nr_shadow_max_passes_per_frame console variable. It stagger the updation of shadow maps, for both static and dynamic, over a few frames. This feature adjustable via Dynamic Shadow Memory graphics settings. This solution preserves performance, since instead of using 300 from FPS value, the shadow will be updated only 24 times per second, which is enough to display most scenes in dynamic shadows.

Icon-Bug.pngBug:"End Game" chapter crashes at some moment with 29 and higher values.

Shadows behavior with VIS and areaportals

Static type

Static type is the most stable, since its shadows are baked in and updates only with save loads or while lighting turning on. It shows all shadows even with closed areaportal.

Stationary type

Shadows for static props and brushes are baked, but not for physics props and other dynamic models. This means that shadows from dynamic models will disappear if they are hidden by a closed areaportal or if VIS is hiding such objects. Shadows for static props and brushes will not disappear.

In some cases, this can be noticeable if dynamic model creates a large shadow.

With mat_wireframe 1.

Dynamic type

Shadows for static props and world geometry are baked, but not for dynamic models and brushes. This means that shadows from dynamic models and brushes will disappear if they are hidden by a closed areaportal or if VIS is hiding such objects. Shadows for static props and world geometry will not disappear. Moving lighting will update shadows for static props and world geometry, even with closed areaportal.

Player spawn and areaportals

If player spawned in position where areaportal don't hide objects - shadows will be fine. Otherwise, static shadowmap will not see models with bmodels and will bake shadows only for world geometry and displacements. This problem is not relevant only for Dynamic light type. The problem disappears after save reload from proper position.

Shadows behavior with start/end fade dist for prop_static

This mechanic has some issues with static shadowmaps. It seems that there are limitations that don't allow to fix these issues, or this issues was not noticed at the development stage.

Static type

If player spawns in fade radius - shadows will never disappear (until save reload if out of radius).

If player spawns out of radius. - shadows will never appear (until save reload in radius).

The same for props with both Start and End fade dist.

Stationary type

The above mentioned issues are also available for this type.

Appears issue for prop_static with both Start and End fade dist.

If player spawns in Start fade radius - shadows will never disappear (until save reload if out of radius). The same happens if player spawns in End fade radius.

If player spawns out of radius - shadows will appear if you are in End fade radius and disappear if you are in Start fade radius (until save reload in radius). This happens because prop_static actually disappears completely, and creates a separate object as a fading model (this is also why decals disappear if player is out of Start fade radius).

Dynamic type

Dynamic type don't use static shadowmaps at all. This means that there is no problems with fading prop_static at all.

Icon-Important.pngImportant:All the issues are also available for func_lod.

Godrays Implementation

Implementation

Godrays in this game are based on sprite entities. They are a post-processed 2D plane that always turns to player's camera. The size of such plane is consistent with the screen size making it appear larger at a distance, in comparison to the world, similar to how Glow render mode works for env_sprite, but unlike the render mode, such plane is rendered so that the sprite will cut through any surrounding geometry, similar to how Additive render mode works for env_sprite.

This plane is also not affected by VIS, which means that you will always see it, even if your area in which your light source is located is closed by an areoportal.

Such implementation has several consequences that limits amount of cases when you can use it.

Limitations And Use Tips

Local point light godrays can "leak" (example on the pictures), since nothing limits the rendering and the size of the plane. The only you can do is place triggers that will turn on/off godrays, but this also basically means you can't use godrays in multiplayer levels, because multiple players can be located in different places of your map (there is no way to disable godrays for each client separately).

Because godrays always turns to player's camera, make sure you are using this effect in areas where view angle for player is very limited. The reason is showed in this short video clip, note how battery stops processing at some moment.

Note.pngNote:Everything mentioned here also applies to the disks.

Dedicated ConVars

Cvar/Command Parameters or default value Descriptor Effect
nr_allow_hammer_nerfs 0 Integer Allow new lights nerfs via Newlights_gbuffersettings entity.

0 - Disabled.

1 - Allowed.

2 - Enabled/Forced.

nr_allow_hammer_nerfs_4ways 0 Integer Allow Enable4WaysFastPath property from Newlights_gbuffersettings entity.

0 - Disabled.

1 - Allowed.

2 - Enabled/Forced.

nr_shadow_max_passes_per_frame 16 Float Frame per second in shadowmaps. The higher the value, the smoother and faster the shadows from objects can change. The recommended value is 24-28, not higher.
nr_shadow_quality 4 Integer Sets shadow quality and enable/disable shadows for all or certain objects. Controlled by Dynamic Shadow Quality option. Only 5 values are available here.

0 (Disabled) - Shadows and lightcookies are completely disabled.

1 (POTATO) - Shadows are available for world geometry and displacements, only for Static and Stationary light types. The shadows are very pixelated. The player's flashlight also gets very simple shadows with "stairs".

2 (Low) - Added brush entities and static props in shadowmaps, only for Static and Stationary light types. Enabled lightcookies.

3 (Medium) - All the shadows are also available for Dynamic light type.

4 (Hight) - Added dynamic models in shadowmaps for Stationary and Dynamic.

mat_unlock_gfx_highend_unsupported 0 Bool When enabled this convar will unlock extreme graphics options. There will be a significant FPS drop when running game on ULTRA or INSANE configs. Game will consume upto 3 gigs of VRAM when some of the extreme graphics options have been enabled. These high end graphics config options are not officially supported. Don't enable this unless you have at least 3.5 GHZ quad core CPU with GTX 1080. These options are mainly for debugging and modders.
nr_lights_quality 4 Integer Sets lights quality, state (for specific entities), enable/disable effects. Controlled by Dynamic Light Quality option. Only 7 values are available here.

0 (POTATO) - Disabled muzzle flash light (regardless of muzzleflash_light), lighting from batteries (regardless of cl_battery_dlights), light sources from dynlightscript.txt, dynamic lights are also disabled for some other entities. Halflambertion is disabled. New specular is disabled. Bumpmaps are disabled. Lights are disabled completely in secondary cameras (monitors, water, etc). Overlaying on viewmodel looks pretty broken. Light is not smoothed out (most noticeable in the least bright areas).

1 (Low) - Allowed muzzle flash light, lighting from batteries, enabled light sources from dynlightscript.txt, other dynamic lights are also enabled for some other entities. Enabled bumpmaps for models.

2 (Medium) - Enabled bumpmaps for brushes. Lights in secondary cameras, but most effects is disabled.

3 (Hight) - Halflambertion with new specular is enabled. Fixed overlaying on viewmodel. Light is smoothed out.

4 (Very Hight) - Bumpmaps are also uncompressed, this makes lighting on surfaces more detailed.

5 (INSANE) - All the effects is enabled in secondary cameras.

6 (DevOnly) - This one for developers only. Includes uncompressed buffers and 32-bit depth. Don't use if you are general player or modder.

nr_shadow_res 0 Integer Affects the quality of shadows. Controlled by Dynamic Shadow Memory option. Only 4 values are available here.

0 (Hight) - Hight quality.

1 (Medium) - Medium quality.

2 (Low) - Low quality.

3 (POTATO) - Very low quality.

nr_shadow_res_dkvk 0 Integer It doesn't seem to work.
r_4way_minimal_mode_override -1 Integer Enable/disable bumpmaps for Lightmapped_4WayBlend. Since one material of this shader provides 4 bumpmaps at once, disabling them will significantly affect performance.

-1/0 - Enabled. 1/2 - Disabled.

Note.pngNote:This cvar needs mat_reloadallmaterials to see changes.
np_gr_quality 2 Integer Enable/disable godrays. Controlled by God Rays option or Enable God Rays button (if used VGUI).

0 - Disabled.

1/2 - Enabled. 1 supposed to enable godrays only for newLight_Dir, 2 for both point lights and newLight_Dir, but currently both values enable both types.
np_gr_quality_sample_count 3 Integer Amount of samples for godrays. This affects the quality/detail of the rays. Controlled by God Rays option, although the original game never changes the value (always 3). Min value is 0, max is 4. The max value is not recommended, it has a huge impact on frame rate, at the same time it does not create a big difference in the game.
np_gr_quality_pass_count 1 Integer Pass count. Not very clear what exactly this affects, but it significantly reduces performance, and Fancy Rays also become pretty buggy. Controlled by God Rays option, although the original game never changes the value (always 1). Min value is 0, max is 4. Use the default value only.
nr_gbuffer_for_reflection_enabled 1 Bool Enable/disable gbuffer for water reflections.
nr_gbuffer_for_refraction_enabled 1 Bool Enable/disable gbuffer for refractions.
nr_gbuffer_for_secondary_cams_enabled 1 Bool Enable/disable gbuffer for secondary cameras (monitors, etc).
nr_gbuffer_for_secondary_cams_quality -1 Bool New lights quality in secondary cameras and water reflections. With -1 it will use quality from nr_lights_quality cvar. With 0-5 it will use itown quality settings (in the same way as nr_lights_quality).
nr_shadow_filter_quality 2 Integer Sets shadow filter quality. Min value is 0, max is 3.

0 (POTATO) - Shadow filter disabled.

1 (Medium) - Medium quality.

2 (Hight) - Hight quality.

3 (INSANE) - Best filter quality.

nr_shadow_rad_Low 1.0 Float Sets shadow filter quality scale for lights with 256 ShadowLOD value.
nr_shadow_rad_Med 1.5 Float Sets shadow filter quality scale for lights with 512 ShadowLOD value.
nr_shadow_rad_Hight 1.5 Float Sets shadow filter quality scale for lights with 1024 ShadowLOD value.
nr_shadow_biasoverwrite 0 Bool Used by New Lights Editor. Allows/disallows to overwrite bias related values.
nr_shadow_nearz_overrite -1.0 Float Used by New Lights Editor. Changes NearZ value for all new lights.
nr_shadow_rad_override 0 Bool Used by New Lights Editor. Allows/disallows to overwrite shadow radius related values.
nr_shadow_fov_overrite -1 Float Used by New Lights Editor. If the value of this convar is higher than -1 it will overrite FOV for shadowed lights.
nr_shadow_biasdepth 0.0002 Float Used by New Lights Editor. Changes Depth Bias value for all new lights.
nr_shadow_biasnormaloffset 1 Float Used by New Lights Editor. Changes Normal Bias value for all new lights.
nr_shadow_biasslope 0.2 Float Used by New Lights Editor. Changes Slope Depth Bias value for all new lights.
nr_shadow_active 666 Integer Sets max active shadowmaps. The value seems hardcoded.
nr_debug_print_shadow_slots_info Void Prints text to the console about shadowmap slots and their light sources.

It prints light type (point or spot) with their index, shadowmap enabled state (for each face), shadowmaps number, new light's targetname and position of it.

Below it also prints information about free shadowmap slots for each shadow resolution.

nr_debug_force_shadowmap_res -1 Bool Only for debugging. Forces all new lights to use specified shadowmap resolution. -1 means use value from the property.
nr_debug_force_dynamic_on_all_stationary_lights 0 Bool Only for debugging. Forces all stationary new lights to be fully dynamic and update even baked shadows.
nr_debug_force_lightstyle 0 Integer Only for debugging. Forces all new lights to use specified appearance/light style. Possible values are 0-13. 13 for custom style from nr_debug_force_lightstyle_custom_string. 0 means use use value from the property.
nr_debug_force_lightstyle_custom_string 1 String Only for debugging. Forces all new lights to use custom appearance/light style. Works the same as with lightmapped lights.
nr_debug_shadow_render_internal_disable 0 Bool Only for debugging. Forces all new lights to disable shadowmaps rendering.
nr_debug_shadow_print_indices_assignment 0 Bool Only for debugging. Prints text to the console about all new light sources and shadowmaps after level/save loading.
nr_debug_lights_mesh 0 Bool Only for debugging. Enable/disable new lights mesh.
nr_debug_lights_mesh_fullscreen 0 Bool [Todo]
nr_debug_light_mesh_volumesize_large 0 Bool Only for debugging. Enable/disable new lights large mesh volume size mesh.
nr_debug_cull_deferred_lights 1 Bool [Todo]
nr_debug_cull_deferred_code_lights_via_bsp 1 Bool [Todo]
nr_dev_shoot_lights_enabled 0 Bool Enable/disable point lights on each shoot. Only for player and only for bullet weapons. Shotgun can create several at once. Disappears after save reload.
Warning.pngWarning:Kills performance.
nr_dev_lights_quality_override 0 Bool Enable/disable light quality override. Required for some cvars with nr_dev_ prefix.
nr_dev_gb_debug_type 4 Integer 0 - DepthOnly. 1 - GBuffer_Fast 2 - GBuffer_Fast2. 3 - GBuffer_Fast3. 4 - Gbuffer_Slow.
nr_dev_gb_quality 2 Integer Changes gbuffer quality.
nr_dev_lb_quality 1 Integer 0 is broken. 1 - default mode. 2 - debug materials with new specular.
nr_disable_setting_auto_reload 0 Bool [Todo]
nr_fps_spam 0 Bool For devolopers only. Spamming in the console performance values. Numbers aren't accurate.
nr_light_spot_bbox_optimizie 2 Intenger Sets BBOX type for spot lights. Min value is 0, max is 3. There are note that 1 is broken. 3 makes BBOX size very small, so spot light sources will disappear even if they are in the player's field of vision.
nr_light_spot_mesh_volumesize_large 0 Intenger This makes BBOX larger than it needs to be.
nr_lights_info Void Used by the game when you launch it. Prints in the console info about hardware support for texture formats, allocated formats and quality settings.
nr_lights_vol_check_threshold 10 Float [Todo]
nr_light_settings_transition_exp 2 Integer Affects the quality of the transition for changes from newLights_settings. 0 - no transition. 1 - transition. 2 - smooth transition.
nr_lights_procedural_disable_all_lights 0 Bool Disable all proceduraly created new lights (npc_zombie_hev, item_battery, weapons, etc).
nr_lights_procedural_enable_lights_priority_check 1 Bool If enabled - all the code based procedural lights will go through priority based check before adding to render queue.
r_nr_deffered_debug_normals 0 Bool Enable/disable normals debug.
r_nr_deffered_force_diffuse_only 0 Bool Forces new lights to use diffuse texture only.
r_nr_deffered_lights_hlslclip_range_on 1 Bool Enable/disable actual new light range in normals debug.
r_nr_deffered_lights_hlslclip_dir_on 0 Bool [Todo]
r_nr_deferred_AA_fix_multiplier 1 Bool Fixes anti aliasing issues.
Example


sv_ignite_light_mode 2 Integer Sets fire light source availability for ignited objects. Min value is 0, max is 3.

0 - Fully disabled.

1 - Available for marines, doesn't work.

2 - Available for all NPCs.

3 - Available for everything, including physics objects and player.

Icon-Bug.pngBug:Doesn't work with env_shooter.
Note.pngNote:
  • It's not full list.
  • Some of these console variables needs save reload for changes.

Bugs/Limitations

See /Bugs and limitations

See also