NewLight Spot

It is a cone-shaped, invisible deferred light source, includes lightcookies with animations for them. The animations is based on row and column atlases or scroll mode.
Represented by class CNewLightSpot.
==Keyvalues==
==Inputs==
==Lighting 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.
File:staticlight_0.jpg| frame |Areaportal is open.
File:staticlight_1.jpg| frame |Areaportal is closed.
===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.
File:stationlight_0.jpg| frame |Areaportal is open.
File:stationlight_1.jpg| frame |Areaportal is closed.
In some cases, this can be noticeable if dynamic model creates a large shadow.
File:Theboxshadow_0.jpg| frame |Areaportal hides the box, note that there is no shadow.
File:Theboxshadow_1.jpg| frame |Areaportal shows the box, now there is a shadow of the box.
File:thewireboxshadow_0.jpg| frame |Areaportal hides the box.
File:thewireboxshadow_1.jpg| frame |Areaportal shows the box.
===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.
File:dynlight_0.jpg| frame |Areaportal is open.
File:dynlight_1.jpg| frame |Areaportal is closed.
==Bugs/Limitations==
====Deferred lighting incorrect work with $translucent====
Deferred lighting all time rendering through walls with material shader parameter $translucent. This happen because of game can't tell the depth of scene because of the transparency, what you are see in the picture is just the lighting layer applied to the color of transparency texture. 
File:C BugHah.jpg| frame | No $translucent. Behind the wall placed lighting and some models with small room.
File:C BugDamn.jpg| frame | With $translucent. Now player see everything, but only what lighted.
File:C GargHah1.jpg| frame | Scene behide window. Looks like the gargantua has lost its texture and turned white.
File:C GargDamn1.jpg| frame | Scene out window. This is what should see player.
This problem also applies to brushes which not have $translucent, but which parented to brushes that have this parameter. Similar will happen if brush with $translucent is part of your brush entity.
File:C BSFL1.jpg| frame | This sticker is brush parented to the glass. Flashlight off.
File:C BSFL2.jpg| frame | This sticker is brush parented to the glass. Flashlight on.
Same will happen if you use overlays/decals on brushes with $translucent.
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.
This issues does not happen if replace LightmappedGeneric to ShatteredGlass or UnlitGeneric, so, you can use one of them for glass or transparency surfaces when it's needed.
File:C HahF1.jpg| frame | LightmappedGeneric.
File:C HahF2.jpg| frame | ShatteredGlass.
In some cases use $alphatest if it'll give similar to $translucent resualts, with this your surface also will cast dynamic shadows.
File:C AF1.jpg| frame | $translucent.
File:C AF2.jpg| frame | $alphatest.
----
====Deferred lighting incorrect work with $alphatestreference and $allowalphatocoverage====
$alphatestreference is a material shader parameter that specifies the threshold alpha channel value at which the surface should be transparent instead of opaque, default "0.5". $allowalphatocoverage creates translucent steps based on alpha values. Both have one and same problems with deferred lighting.
For examples used this texture with this alpha channel.
File:C_ATSC_D.jpg| frame | Diffuse texture.
File:C_ATSC_A.jpg| frame | Alpha channel.
Here deferred lighting placed behind wall with the texture, lighting is red and shadows is blue. We can see the circle part of that have alpha channel part which is invisible due to $alphatest, with enabled deferred lighting we see that the invisible part doesn't show through itself deferred lighting with shadows.
File:C_ODSL_1_С.jpg| frame | Dynamic light disabled behind wall with the texture, using standart VRAD light.
File:C ODSL_2.jpg| frame | Dynamic light enabled behind wall with the texture, not using standart VRAD light.
From the opposite side the invisible part illuminates everything in itself equally, without taking into account decay of light, it's also don't show shadows and other dynamic lights in itself.
File:cIIPSEE_.jpg| frame | Dynamic light disabled, using standart VRAD light.
File:C IIPSEE.jpg| frame | Dynamic light enabled, not using standart VRAD light.
If use very low numbers you will see resualts like in the pictures.
File:cCCCC_11.jpg| frame | Dynamic light disabled, using standart VRAD light.
File:C CCCC_12.jpg| frame | Dynamic light enabled, not using standart VRAD light.
File:C CCCC_21.jpg| frame | Dynamic light disabled, using standart VRAD light.
File:CCCCC_22.jpg| frame | Dynamic light enabled, not using standart VRAD light.
You can't escape this problem, only minimize effect with $alphatestreference 0.1 or if paint alpha correct channel.
----
====Weird clipping====
Often meeting strange clipping/flickering, strange bug that was in early stages of the game (this can be seen even in videos before new lights release in public), this does not depend on OS or drivers. Somehow related to Range value, since changing its value halfway fixes this bug, because it move away the bugged area.
File:cWC1.gif| frame |One of many examples.
File:cWC2.gif| frame |One of many examples.
File:cWC3.gif| frame |One of many examples.
----
====Brush polygons may clip deferred lighting====
Rare phenomenon, sometimes brush polygons clip deferred lighting, the reason that cause this is unknown. Can be easy fixed if divide invalid brush into two parts.
File:C BPl0.jpg| frame | One of examples (mat_wireframe 0).
File:C BPl1.jpg| frame | One of examples (mat_wireframe 1).
File:C BPb0.jpg| frame | One of examples (mat_wireframe 0).
File:C BPb1.jpg| frame | One of examples (mat_wireframe 1).
----
====Spot lights have sharpness bug if shadows enabled====
It is most noticeable if spot light is at not a right angle. It greatly degrades quality of shadows. Issue can be partially fixed if make NormalBias value bigger. Also can be minimized with shadow quality, range, outer and inner angles.
File:)BUGSUCK1.jpg| frame | An example.
File:)BUGSUCK2.jpg| frame | bm_c1a2b.
----
====Deferred lighting shine through nodraw texture====
Not a bug, but a pattern. Unfortunately, this cannot be controlled in any way, you should keep in mind this before paint nodraw to escape situations like in the gifs. If your dynamic light source illuminates face that player never see - use cheap textures with low resolution and which don't use material shader parameters, a good solution would be tools/toolsblack or any texture.
File:cSLB1.gif| frame | Black Mesa - bm_c2a2a.
File:cSLB2.gif| frame | Black Mesa: Blue Shift - bs_c0m0c.
----
====Shadows don't appear immediately after reload====
After game save and load shadows don't appear for short time, maybe it has something to do with caching. This appearance duration may vary depending on power of user PC and how much of lights with enabled shadows are turned on at level, but in any case user will get this issue even with most powerful PC. Enable in worldspawn settings Level Fade In to hide this problem, this setting also will hide some other problems with loads that avaible in.
File:cSDAIAR1.gif| frame | With no Level Fade In. It seems like the shadows flicker, which makes it unpleasant for eyes.
File:cSDAIAR2.gif| frame | With Level Fade In. Everything looks fine.
----
====Shadows don't appear immediately with a lot of lights with shadows====
If your level use a lot of lights with shadows - shadows from enabling lights will not appear immediately, this happens if light source was disabled and if player's camera did not see this light source enabled initially.This happen because shadows use passes per frame for memory, if level use a lot of new lights - game change integer value of cvar nr_shadow_max_passes_per_frame to lower numbers. Can be fixed if change cvar value with point_servercommand to 25 or if enable light source at level start and keep it enabled before drawing of level allows player's camera to see this light source, disable this light source and than enable when we need this.
File:cSDAIWALOLWS1alt.gif| frame | An example.
File:cSDAIWALOLWS2.gif| frame | bm_c2a1a.
----
====Dynamic lights with shadows may buggy====
In some cases your attached lights may have buggy shadows if parent is moving, work smart when use this feature. If your moving light is decoration - highly recommended to leave shadows disabled to save limits and performance.
File:CSDAIWALOLWS1.gif| frame | An example.
File:cDLWSMB2.gif| frame | bm_c1a1c.
----
====Moving newLight_Spot clipping if shadows enabled====
Even with low speed, newLight_Spot clipping when rotating, but only if shadows enabled. With pause this bug get fix.
File:DamnCrowbarCollective2.gif| frame | An example.
File:DamnCrowbarCollective1.gif| frame | bm_c1a3a - emergency light sources.
File:CrowbarPickUpSceneBuggy.gif| frame | bs_c3m0a - scene with the stucked scientist.
File:RosenberAndFlashLight.gif| frame | bs_c3m2a - Dr. Rosenberg scene.
----
====Viewmodel illuminated by deferred render draw in refract shader====
Refract shader and 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.
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.
----
====Objects with refract shader self refract if illuminated by deferred render====
Objects with refract shader in their own refraction disable self, to escape some problems. However - objects with refract shader illuminated by deferred render refract self because of game can't tell the depth of objects because of the transparency, what you are see in the pictures is just the lighting layer applied to the color of transparency texture.
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.
Similar issue happen if model with refraction behind wall with refraction.
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.
----
====Viewmodel doesn't support self-shadowing with deferred ligths====
Unlike cascade shadows - viewmodel doesn't support self-shadowing with deferred ligths. Not a bug, but this is not what you expect from real life, it also isn't so with env_projectedtexture.
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.
----
====Godrays and deferred lighting incorrect work with cloak====
Cloak is a material shader parameter for VertexLitGeneric shader, female assassins use it to make them transparent when they need it. Godrays all time fully render through them, same for deferred lighting.
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.
----
====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 bm_c4a1b1 this bug shows up well with a resolution wtih 1920x1080, but with 3840x2160 the light source from the teleporter flickers, but does not form a hole. Can be fixed if increase NormalBias number.
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).
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.
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.
----
====Weapons dynamic light incorrect work with damaged func_breakable_surf====
For some reason weapons dynamic light can illuminate damaged func_breakable_surf even if position of it very far from position of damaged func_breakable_surf.
File:cAnSexample.gif| frame |An example.
----
====New lights don't work with 3D Skybox====
Don't use new lights in your 3D skyboxes, none of them will work at all.
File:C NLDW3DS.jpg| frame |An example. We see that deferred lighting and Godrays works fine, but 3D Skybox don't draw both.
----
====Motion blur blurring viewmodel lighting layer====
For some reason Motion blur blurring viewmodel lighting layer, you can notice this when you just rotate camera.
File: cVLLBASUalt.gif| frame | An example.
----
====Deferred lighting incorrect work with Customize Character window====
For some reason Customize Character take player's screen, inserts it into character preview window and show one of deferred lighting layers.
File: BruhCharacter.jpg| thumb | An example with zombie scientist model.
----
====Deferred lighting does not draw with -tools====
If you don't use Full Screen - deferred lighting will not draw.
File:DLDNDWT_1.jpg| frame |In Full Screen.
File:DLDNDWT_2.jpg| frame |Out Full Screen.
----
====Deferred lighting that use shadows disappear after materials reload====
This issue happen when you open Hammer while game is opened, when you disable speculars with mat_specular 0, when you reload all matelias with mat_reloadallmaterials, e. t. c. Can be fixed with save reload.
File:DLDAMR_1.jpg| frame |Before mat_reloadallmaterials.
File:DLDAMR_2.jpg| frame |After mat_reloadallmaterials.
== See also ==
* - point deferred light entity.
* - spawner of deferred point lights.
* - cinematic dynamic lens flare.
* - directional sun light with godrays only.
* - entity that changes deferred light settings.
* - entity that changes godrays settings.
* - deferred cascade sun light entity.
* New Lights Editor - in game deferred lights editor.
* Effect flags - effects flags, some of them are dynamic light effects.
* BlackMesa XenEngine: Part 4 – Lighting & Shadows - page from Chetan (lead programmer for Black Mesa) about new lights.
* BlackMesa XenEngine: Part2 – How a Frame is Rendered - page from Chetan (lead programmer for Black Mesa) about how a frame is rendered.
* BlackMesa XenEngine: Part1 – Heavily Modified Source Engine page from Chetan (lead programmer for Black Mesa) about .