newLight_Dir

From Valve Developer Community
Jump to: navigation, search
NewLight Dir-Icon-Small.png

newLight_Dir is a point entity available in Black Mesa Black Mesa. It is one of the many new lighting entities available. Black Mesa incorporates new post processor that allowed to implement Godrays and lensflares with some other effets. This entity draw in skybox post processing effect called GodRays, also include disk to imitate sun.

NewLight_Dir in bm_c4a1b (sun flare is disabled for clarity).
Warning.pngWarning:New lights use expensive 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 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.pngNote:You maybe seen env_godrays_controller in Hammer or fgd. This is deprecated Crepuscular Rays from the Crossfire Update (22 december 2015 year). With newLight_Dir implementation, this entity is removed with crepuscular rays.

Black Mesa Represented by class CNewLightDir.

Black Mesa Level Creation

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.
LightEnvEnabled (LightEnvEnabled) <choices>
Grab direction and color values from light_env ?

Determines is the entity use Light_environment direction or its own (just like env_sun).

  • 0: Enabled : Fetch Angles from Light_Env
  • 1: Disabled : Use Manual Angles
PushbackDist (PushbackDist) <float>
PushbackDist.

Determines distance from GodRays to player in skybox.

Examples


EnableGodRays (EnableGodRays) <choices>
Enable GodRays.

Determines whether godrays are enabled or not.

  • 0: Disabled
  • 1: Enabled
Density (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.
Examples


Weight (Weight) <float>
Weight Controls the intensity of volumetric shadow. Blocking of rays by geometry. Good values to start from: 0.1 - 10.0.
Examples


Decay (Decay) <float>
Decay NOT being used.
Blank image.pngTodo: Document what does it change.
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.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.
Examples


DiskRadius (DiskRadius) <float>
Radius of Disk/circle of sun in texturespace. 1.0 will be full screen 0.5 is half screen etc.
Examples


Note.pngNote:With 0 - will not render.
ColorInner (ColorInner) <color255>
This is the color of the inner circle.
Examples


Note.pngNote:Unlike lighting - brightness of inner depends on fourth number which can be written here. Max value is 255, higher doesn't draw.
ColorRays (ColorRays) <color255>
This is the color of the rays.
Examples


Note.pngNote:Unlike lighting - brightness of rays depends on fourth number which can be written here. Max value is 255, higher doesn't draw.
DiskInnerSizePercent (DiskInnerSizePercent) <float>
Used only in Fancy Gaphics Mode. Disk inner circle radius = DiskRadius * DiskInnerSizePercent.
Examples


Note.pngNote:With 0 - will not render.
ColorOuter (ColorOuter) <color255>
Used only in Fancy Mode. This is the color of the outer circle.
Examples


Note.pngNote:Unlike lighting - brightness of outer depends on fourth number which can be written here. Max value is 255, higher doesn't draw.
UseToneMapDisk (m_bUseToneMapDisk) <choices>
  • 0: Enabled
  • 1: Disabled

Inputs

TurnOnGodRays
Turn the Godrays on.
TurnOffGodRays
Turn the Godrays off.

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 to FireUser4
Fires the respectiveOnUseroutputs; 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 thanKillinput.
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.
Use  !FGD
Same as a player invoking +use; no effect in most cases.
DispatchResponse <string> !FGD
Dispatches a response to the entity. See Response and Concept.
DispatchEffect <string> (removed since Left 4 Dead) !FGD
Dispatches a special effect from the entity's origin; See also List of Client Effects. Replaced by the particle system since Left 4 Dead.
RunScriptFile <script> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
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 Left 4 Dead 2) (also in Team Fortress 2)
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.
Icon-Bug.pngBug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Note.pngFix:Remove the string argument manually with a text editor.
Note.pngNote:Team Fortress 2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in Team Fortress 2) !FGD
Destroys the script scope of the receving entity.
SetLocalOrigin <coordinates> (in all games since Alien Swarm) !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.
SetLocalAngles <angles> (in all games since Alien Swarm) !FGD
Set this entity's angles.

Outputs

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.

Bugs/Limitations

Engine limit

Level can't have more than one newLight_Dir, otherwise game will crash with this error message. However - you still can spawn new with point_template and kill old if you need to change Godrays position, change color, etc.


Incorrect work with $translucent

Godrays (also disk) all time fully rendering through textures with material shader parameter $translucent, because of this you will see unexpected results like in the picture. Disable Godrays when you need or use $alphatest if it'll give resualts similar to $translucent. You also can try use some other tricks to escape this problem.


Godrays incorrect work with point_viewcontrol

Godrays change position in sky when player move, this affects to what show point_viewcontrol when it's enabled. If you want to see in your background level Godrays - place player on needed position. If your point_viewcontrol moves - attach player to it.


Godrays render through 3D Skybox objects

Unlike env_sun Godrays (also disk) render through any object pasted in 3D Skybox environment. Keep in mind this before you will create 3D Skybox.


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


Godrays draw through water

Deferred lighting don't fully draw through water, unlike Godrays.

Godrays can't be displayed in monitors and reflections

Godrays is post process effect that depends on player screen. That means that they can't water reflections or monitors can't show it.


Godrays 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. For examples used this texture with this alpha channel.

Godrays process invisable parts, you can't escape this problem, only minimize effect with $alphatestreference 0.1 or if paint alpha correct channel.


Godrays does not process surface models

If player underwater - godrays will not process surface models, only inwater models. Doesn't work with func_water_analog and func_water.

See also

Blank image.pngTodo: Fix some stuff. May better describe functions. Investigate and document some keyvalues and functions. Clean up english. Add more issues if you'll find.