newLight_Spot
Contents
- 1 Keyvalues
- 2 Inputs
- 3 Outputs
- 4 Bugs/Limitations
- 4.1 Deferred lighting incorrect work with $translucent
- 4.2 Deferred lighting incorrect work with $alphatestreference and $allowalphatocoverage
- 4.3 Weird clipping
- 4.4 Brush polygons may clip deferred lighting
- 4.5 Spot lights have sharpness bug if shadows enabled
- 4.6 Deferred lighting shine through nodraw texture
- 4.7 Shadows don't appear immediately after reload
- 4.8 Shadows don't appear immediately with a lot of lights with shadows
- 4.9 Dynamic lights with shadows may buggy
- 4.10 Moving newLight_Spot clipping if shadows enabled
- 4.11 Viewmodel illuminated by deferred render draw in refract shader
- 4.12 Objects with refract shader self refract if illuminated by deferred render
- 4.13 Viewmodel doesn't support self-shadowing with deferred ligths
- 4.14 Godrays and deferred lighting incorrect work with cloak
- 4.15 Strange "holes" when player's camera is at a great distance
- 4.16 Weapons dynamic light incorrect work with damaged func_breakable_surf
- 4.17 New lights don't work with 3D Skybox
- 4.18 Motion blur blurring viewmodel lighting layer
- 4.19 Deferred lighting incorrect work with Customize Character window
- 4.20 Deferred render atrociously work with Linux and Linux based OS
- 4.21 Deferred lighting does not draw with -tools
- 4.22 Deferred lighting that use shadows disappear after materials reload
- 4.23 Broken half-lambertian lighting
- 5 See also
newLight_Spot
is a point entity available in Black Mesa. 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 animated lightcookies.
Represented by class CNewLightSpot
.
Keyvalues
- Name
(targetname)
<targetname> - The name that other entities refer to this entity by.
- Parent
(parentname)
<targetname> - The name of this entity's parent in the movement hierarchy. Entities with parents move with their parent.
- Pitch Yaw Roll (Y Z X)
(angles)
<angle> - This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
- ReverseDir
(ReverseDir)
<choices> - Reverse the direction of spotlight
Reflects Y angle value and applies it.
- 0: No
- 1: Yes
|
- Enabled
(Enabled)
<choices> - Enable/Disable this Entity.
Determines if the light is off at level start.
- 0: Enabled
- 1: Disabled
- Appearance
(FlareStyle)
<choices> - Appearance presets.
Light Appearances Literal Value Description Sequence Preview 0 Normal m
10 Fluorescent flicker mmamammmmammamamaaamammma
2 Slow, strong pulse abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
11 Slow pulse, noblack abcdefghijklmnopqrrqponmlkjihgfedcba
5 Gentle pulse jklmnopqrstuvwxyzyxwvutsrqponmlkj
1 Flicker A mmnmmommommnonmmonqnmmo
6 Flicker B nmonqnmomnmomomno
3 Candle A mmmmmaaaaammmmmaaaaaabcdefgabcdefg
7 Candle B mmmaaaabcdefgmmmmaaaammmaamm
8 Candle C mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa
4 Fast strobe mamamamamama
9 Slow strobe aaaaaaaazzzzzzzz
12 !FGD Underwater light mutation mmnnmmnnnmmnn
- Light Color
(LightColor)
<color255> - This is the color of the sunlight.
Determines color of light.
- Light Ambient Color
(LightColorAmbient)
<color255> - This is the ambient color of the sunlight.
Determines color of shadows that light source creates.
|
- Light Intensity
(Intensity)
<float> - RGB * Intensity.
Brightness of the light.
- SpecularMultiplier
(SpecMultiplier)
<float> - 0 to 1 RGB * Intensity * SpecularMultiplier.
Brightness the specular shader from this light source.
|
- Range
(Range)
<float> - Range.
How far the light source illuminates. Measured in Hammer Units.
|
- OuterAngle
(phi)
<float> - Double the value of lightcone for correct value, if you want 45 degrees in-game, put 90 here. hammer 45 deg = 90 in-game
Outer angle value for spot light.
- InnerAngle
(theta)
<float> - Double the value of lightcone for correct value, if you want 45 degrees in-game, put 90 here. hammer 45 deg = 90 in-game
Inner angle value for spot light.
- AngularFallOff
(angularFallOff)
<float> - AngularFallOff
Angular falloff.
|
- Light Type
(LightType)
<choices> - Determines the light type.
- 0: Static - shadows are cast only by static objects (prop_static, geometry, etc.). Lighting does not update if it has parent (use if part scene has no large moving parts, or shadow accuracy is not important).
- 1: Stationary - shadows are cast by static and dynamic objects, lighting does not update if it has a parent. Important:Shadows for dynamic props update, but baked for geometry. That means that shadows from func_physbox and other dynamic geometry will never update, and shadows from other geometry on them too.
- 2: Dynamic - lighting is not baked at all. Shadows are cast by static and dynamic objects, lighting updates if it does have a parent. This light is quite expensive, and should only be used for moving light sources, or if your scene have moving geometry.
|
- HasShadow
(HasShadow)
<choices> - Do you want this light to have shadows?
Determines whether the light source will cast shadows. Remember that default choices is No.
- 0: No
- 1: Yes
|
Static
and Stationary
new light types. With Dynamic
new light type all shadows disappear.
|
- ShadowMapLOD
(ShadowLod)
<choices> - Resolution of ShadowMap used by this light.
Determines quality of shadows. 1024 is very expensive, use it only in places where it's really needed, in most cases 512 is good alternative. 256 produces the blurriest shadows, but it is also the cheapest.
- 0: 256
- 1: 512
- 2: 1024
|
point_template
, just kill past lights with kill input and spawn new when you need it. Also use different shadow lods.
- NearZ
(NearZ)
<float> - NearZ used by shadowmap camera for this light.
Determines distance at which light source will cast shadows.
- DepthBias
(DepthBias)
<float> - DepthBias - Offset added to depth values in shadowmaps.
|
- SlopeDepthBias
(SlopeDepthBias)
<float> - Slope Depth Bias - For surfaces having aliasing due to steep angles with light.
|
- NormalBias
(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.
|
|
- ShadowFOV
(ShadowFOV)
<float> - Fov used by shadowmap camera for this light. Keep it 0 to use Outer angle as the fov.
|
- 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.
Determines shadow blur. Low numbers are expensive to render.
|
- Enable Texture Light
(bTexLight)
<choices> - Enable Texture Light
Determines whether the given light source uses .vtf texture from game files (just like env_projectedtexture
). A great example is survey scanner that use models/props_equipment/survey_lasercookietex.vtf.
- 0: Disabled
- 1: Enabled
|
- Texture name for TexLight
(texName)
<string> - Texture name for TexLight.
Determines which texture will use light source. It use .vtf files, not .vmt.
- TexCookieFramesX
(TexCookieFramesX)
<integer> - Num of frames in 1 row of Atlas
TexCookieFramesX for LightSpot - class C_NewLightSpot CookieName - TEXTURENAME.vtf is 0. Are you sure this light is using texcookie? If yes then set this property to at least 1.
- TexCookieFramesY
(TexCookieFramesY)
<integer> - Num of frames in 1 column of Atlas
Sets scales for texture, with 2 and higher it allow TexCookieFps to animate texture.
TexCookieFramesY for LightSpot - class C_NewLightSpot CookieName - TEXTURENAME.vtf is 0. Are you sure this light is using texcookie? If yes then set this property to at least 1.
|
- TexCookieFps
(TexCookieFps)
<float> - FPS for Texture anim
Determines frame rate for animation. For animation NewLight_Spot divides texture into several parts (their count is indicated in TexCookieFramesY) and changes them in a specific sequence.
- Tex Cookie Scroll Mode
(bTexCookieScrollMode)
<choices> - Tex Cookie Scroll Mode
Enables texture scrolling function. ScrollSpeedU and ScrollSpeedV sets scrolling speed and direction.
- 0: Disabled
- 1: Enabled
- ScrollSpeedU
(fScrollSpeedU)
<float> - ScrollSpeedU
Determines scrolling speed along Y axis.
|
- ScrollSpeedV
(fScrollSpeedV)
<float> - ScrollSpeedV
Determines scrolling speed along X axis.
|
- Enable Prop Only Mode
(bNegLight)
<choices> - Enable Prop Only Mode.
- 0: Disabled
- 1: Enabled
- ShadowPass_Brush
(m_bSRO_Brush)
<choices> - Do we want to Render Brushes in shadow passes for this light?
- 0: YES
- 1: NO
- ShadowPass_StaticProp
(m_bSRO_StaticProp)
<choices> - Do we want to Render StaticProps in shadow passes for this light?
- 0: YES
- 1: NO
- ShadowPass_DynProp
(m_bSRO_DynProp)
<choices> - Do we want to Render Dynamic Props in shadow passes for this light?
- 0: YES
- 1: NO
- ShadowPass_AlphaTest
(m_bSRO__Trans)
<choices> - Do we want to Render AlphaTested Objects in shadow passes for this light?
- 0: YES
- 1: NO
bUseOldFallOff!FGD(bUseOldFallOff)
<choices>- Deprecated. Enable old falloff similar to light/light_spot.
- 0: No
- 1: Yes
falloffConstant!FGD(falloffConstant)
<integer>- Deprecated. Constant (work only if bUseOldFallOff enabled).
Inputs
SetColorLight
<color255>- Change Light's Color value. Doesnt effect the godrays
SetIntensityForLight
<float>- Change Light's intensity value. Doesnt effect the godrays
TurnOn
<void>- Turn the light on.
TurnOff
<void>- Turn the light off.
Toggle
<void>- Toggle the light's current state.
InputFixRotBugDueToTram
<void>- InputFixRotBugDueToTram
Base:
AddContext
<string>- Adds to the entity's list of response contexts. See Context.
AddOutput
<string>- Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"
// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
|
ClearContext
- Removes all contexts from this entity's list.
ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1
toFireUser4
- Fires the respective
OnUser
outputs; see User Inputs and Outputs.
Kill
- Removes this entity and any entities parented to it from the world.
KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
input.
RemoveContext
<string>- Remove a context from this entity's list. The name should match the key of an existing context.
SetParent
<string>- Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment
<string>- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset
<string>- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
DispatchResponse
<string> !FGD- Dispatches a response to the entity. See Response and Concept.
DispatchEffect
<string> (removed since ) !FGD- Dispatches a special effect from the entity's origin; See also List of Client Effects. Replaced by the particle system since .
RunScriptFile
<script> (in all games since ) (also in )- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode
<string> (in all games since ) (also in )- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.Fix:Remove the string argument manually with a text editor.
CallScriptFunction
<string> (in all games since ) (also in ) !FGD- Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope
(only in ) !FGD- Destroys the script scope of the receving entity.
SetLocalOrigin
<coordinates> (in all games since ) !FGD- Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
Outputs
Base:
OnUser1
toOnUser4
- These outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs.
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.
No $translucent. Behind the wall placed lighting and some models with small room.
With $translucent. Now player see everything, but only what lighted.
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.
Same will happen if you use overlays/decals on brushes with $translucent.
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.
In some cases use $alphatest if it'll give similar to $translucent resualts, with this your surface also will cast dynamic shadows.
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.
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.
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.
If use very low numbers you will see resualts like in the pictures.
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.
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.
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.
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
UnlitGeneric
texture.
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 Black Mesa.
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.
Dynamic lights with shadows may buggy
In some cases your attached lights may have buggy shadows if parent moving, work smart when use this feature. If your moving light is decoration - highly recommended to leave shadows disabled to save limits and performance.
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.
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.
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.
Similar issue happen if model with refraction behind wall with refraction.
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.
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.
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.
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.
New lights don't work with 3D Skybox
Don't use new lights in your 3D skyboxes, none of them will work at all.
Motion blur blurring viewmodel lighting layer
For some reason Motion blur
blurring viewmodel lighting layer, you can notice this when you just rotate camera.
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.
Deferred render atrociously work with Linux and Linux based OS
Linux port is atrocious. The only thing that can help is proton. The only platform that works fine with Black Mesa is Windows.
Deferred lighting does not draw with -tools
If you don't use Full Screen
- deferred lighting will not draw.
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.
Broken half-lambertian lighting
Sources standard model lighting comes with a hacky way of boosting ambient lighting on characters and props. This is called half-lambertian lighting. The light is wrapped around the edges of a model which gives the lighting a softer appearance, prevents overly harsh shadows from normal maps. This was implemented as an easy and performant way to improve the appearance of lighting, at a cost of realism.
Consequentially, newlights also had half-lambertian lighting implemented. However, it is currently left in a broken state. The result is that meshes with $phong or $halflambert get lit from ALL sides perpendicular to newlights, including ones with opposing normals. Shadows help to mask this bug, but it still appears glaringly incorrect.
If you want to use $phong or $halflambert - you are able to fix this with adding in your VMT material parameter "$halflambert_gbuffer_off" "1"
.
This also makes new lighting with shadows much more realistic, since the light no longer shows through at edges of model.
However it have some limitations:
- As explained, this will only affect models that use $halflambert, which mostly means things with specularity/phong.
- Some areas may not quite bit lit the same as they may have depended on the bug. Notably areas entirely lit by newlights may seemingly lack ambient lighting and have overly dark shadows.
- Xen plant lights for instance have shadows on the bulbs as they did not use illumtextures.
You can use this fix by Jofoyo for your mods to fix this issue without manual correction for each model.
See also
- New Lights Editor
newLight_Point
newLight_Dir
NewLights_settings
env_cascade_light
- New Specular
- newxog_volume
- Lighting
- Adding Light
- Intermediate Lighting
- Advanced Lighting
- Effect flags (dynamic light effects)
- Tool textures (for Block light)
- BlackMesa XenEngine: Part 4 – Lighting & Shadows (page from Black Mesa developer about new lights)
- BlackMesa XenEngine: Part2 – How a Frame is Rendered (page from Black Mesa developer about how a frame rendered, include Godrays.)
- BlackMesa XenEngine: Part1 – Heavily Modified Source Engine (page from Black Mesa developer about Black Mesa engine, better known as Xengine)