Class SceneLight
Namespace: ValveResourceFormat.Renderer.SceneEnvironment
Assembly: Renderer.dll
Scene node representing a light source with type, color, and attenuation.
public class SceneLight : SceneNodeInheritance
object ← SceneNode ← SceneLight
Inherited Members
SceneNode.Tint, SceneNode.Alpha, SceneNode.TintAlpha, SceneNode.Transform, SceneNode.LayerName, SceneNode.LayerEnabled, SceneNode.Visible, SceneNode.BoundingBox, SceneNode.LocalBoundingBox, SceneNode.Name, SceneNode.Id, SceneNode.IsSelected, SceneNode.IsPointMarker, SceneNode.Flags, SceneNode.AdditionalFlags, SceneNode.RenderPasses, SceneNode.UpdateBuffers(Camera), SceneNode.Scene, SceneNode.KeepsMarkerSize, SceneNode.Parent, SceneNode.Children, SceneNode.ParentAttachment, SceneNode.LocalTransform, SceneNode.SetParent(SceneNode?, string?, Matrix4x4?), SceneNode.GetChildFrame(string?), SceneNode.UpdateHierarchy(Scene.UpdateContext), SceneNode.GetRigidTransform(Matrix4x4), SceneNode.ShaderEnvMapVisibility, SceneNode.LightingOrigin, SceneNode.OverlayRenderOrder, SceneNode.CubeMapPrecomputedHandshake, SceneNode.LightProbeVolumePrecomputedHandshake, SceneNode.LightProbeBinding, SceneNode.EnvMapBinding, SceneNode.EntityData, SceneNode.EntityInstance, SceneNode.Update(Scene.UpdateContext), SceneNode.Simulation, SceneNode.Render(Scene.RenderContext), SceneNode.GetSupportedRenderModes(), SceneNode.SetRenderMode(string), SceneNode.Delete(), SceneNode.GetCameraDistance(Camera)
Constructors
SceneLight(Scene)
Scene node representing a light source with type, color, and attenuation.
public SceneLight(Scene scene)Parameters
scene Scene
See Also
Fields
MinSpecularRoughness
The roughness no direct specular highlight is sharper than, whatever a light asks for.
public const float MinSpecularRoughness = 0.04Field Value
float
Properties
AttenuationLinear
Gets or sets the linear attenuation coefficient.
public float AttenuationLinear { get; set; }Property Value
float
AttenuationQuadratic
Gets or sets the quadratic attenuation coefficient.
public float AttenuationQuadratic { get; set; }Property Value
float
BakedShadowMask
Returns the baked shadow mask for this light based on its stationary light index.
public Vector4 BakedShadowMask { get; }Property Value
BarnFaces
Gets the precomputed face data array (1 face for barn lights, 1-6 for omni lights).
public SceneLight.BarnFaceData[] BarnFaces { get; }Property Value
Brightness
Gets or sets the brightness (intensity) of the light.
public float Brightness { get; set; }Property Value
float
BrightnessScale
Gets or sets the additional brightness scale multiplier.
public float BrightnessScale { get; set; }Property Value
float
CastShadows
Gets or sets whether this light casts shadows.
public int CastShadows { get; set; }Property Value
int
Color
Gets or sets the sRGB color of the light.
public Vector3 Color { get; set; }Property Value
ColorTemperature
Gets or sets the color temperature in Kelvin that SceneLight.Color comes from, or null when the light uses its color as is.
public float? ColorTemperature { get; set; }Property Value
float?
CookieTexturePath
Gets or sets the material path of the cookie texture, or null if none.
public string? CookieTexturePath { get; set; }Property Value
string?
Cost
What this light costs to render, which is SceneLight.DirectLight resolved against SceneLight.StationaryLightIndex.
public SceneLight.LightCost Cost { get; }Property Value
DirectLight
Gets or sets the direct lighting type.
public SceneLight.DirectLightType DirectLight { get; set; }Property Value
Direction
Gets or sets the normalized direction the light faces.
public Vector3 Direction { get; set; }Property Value
Enabled
Gets or sets whether this light is enabled at spawn.
public bool Enabled { get; set; }Property Value
bool
Entity
Gets or sets the entity class that created this light.
public SceneLight.EntityType Entity { get; set; }Property Value
FadeSizeEnd
Gets or sets the fraction of the screen at which the light has faded out.
public float FadeSizeEnd { get; set; }Property Value
float
FadeSizeStart
Gets or sets the fraction of the screen below which the light starts fading out, zero to never fade.
public float FadeSizeStart { get; set; }Property Value
float
FallOff
Gets or sets the distance falloff skirt fraction.
public float FallOff { get; set; }Property Value
float
IsDirty
Gets or sets whether this light's face data needs to be recomputed. Setting it recalculates all faces.
public bool IsDirty { get; set; }Property Value
bool
IsLight2
Returns whether this is a barn, rect or omni2 light, which takes its brightness as an exposure value and is lit through SceneLight.BarnFaces when it renders in real time.
public bool IsLight2 { get; }Property Value
bool
IsVisible
Returns whether this light will produce energy based on its properties.
public bool IsVisible { get; }Property Value
bool
LinearBrightness
Gets or sets the linear intensity a barn, rect or omni2 light reaches SceneLight.LinearBrightnessDistance units in front of its luminaire, which is what their faces are lit with.
public float LinearBrightness { get; set; }Property Value
float
LuminaireAnisotropy
Gets or sets the luminaire anisotropy for capsule-shaped area lights.
public float LuminaireAnisotropy { get; set; }Property Value
float
LuminaireShape
Gets or sets the luminaire shape index. Barn lights: 0 = point, 1 = disk, 2 = rectangle. Omni2 lights: -1 or 3 = point, 0 = sphere, 1 = tube, 2 = tube with end caps.
public int LuminaireShape { get; set; }Property Value
int
LuminaireSize
Gets or sets the luminaire (source) size used for area light calculations.
public float LuminaireSize { get; set; }Property Value
float
MinRoughness
Gets or sets the minimum roughness clamped for specular highlight calculations.
public float MinRoughness { get; set; }Property Value
float
Position
Gets or sets the world-space position of the light.
public Vector3 Position { get; set; }Property Value
PrecomputedBounds
Gets or sets the axis-aligned precomputed world bounds.
public AABB PrecomputedBounds { get; set; }Property Value
PrecomputedFieldsValid
Gets or sets whether the precomputed OBB fields below are valid.
public bool PrecomputedFieldsValid { get; set; }Property Value
bool
PrecomputedObbAngles
Gets or sets the Euler angles of the precomputed oriented bounding box.
public Vector3 PrecomputedObbAngles { get; set; }Property Value
PrecomputedObbExtent
Gets or sets the half-extents of the precomputed oriented bounding box.
public Vector3 PrecomputedObbExtent { get; set; }Property Value
PrecomputedObbOrigin
Gets or sets the center of the precomputed oriented bounding box.
public Vector3 PrecomputedObbOrigin { get; set; }Property Value
PrecomputedSubObbAngles
Gets or sets the Euler angles of the precomputed sub-OBBs, one per frustum.
public Vector3[]? PrecomputedSubObbAngles { get; set; }Property Value
Vector3[]?
PrecomputedSubObbExtents
Gets or sets the half-extents of the precomputed sub-OBBs, one per frustum.
public Vector3[]? PrecomputedSubObbExtents { get; set; }Property Value
Vector3[]?
PrecomputedSubObbOrigins
Gets or sets the centers of the precomputed sub-OBBs, one per frustum.
public Vector3[]? PrecomputedSubObbOrigins { get; set; }Property Value
Vector3[]?
PrecomputedSubfrusta
Gets or sets the number of precomputed sub-frusta for omni lights.
public int PrecomputedSubfrusta { get; set; }Property Value
int
Range
Gets or sets the maximum range of the light in world units.
public float Range { get; set; }Property Value
float
RenderDiffuse
Gets or sets whether this light contributes diffuse lighting.
public bool RenderDiffuse { get; set; }Property Value
bool
RenderSpecular
Gets or sets whether this light contributes specular lighting.
public bool RenderSpecular { get; set; }Property Value
bool
RenderTransmissive
Gets or sets whether this light passes through transmissive materials.
public bool RenderTransmissive { get; set; }Property Value
bool
ShadowFadeSizeEnd
Gets or sets the fraction of the screen at which the light's shadows have faded out.
public float ShadowFadeSizeEnd { get; set; }Property Value
float
ShadowFadeSizeStart
Gets or sets the fraction of the screen below which the light's shadows start fading out, zero to never fade.
public float ShadowFadeSizeStart { get; set; }Property Value
float
ShadowMapSize
Gets or sets the shadow map resolution in texels.
public int ShadowMapSize { get; set; }Property Value
int
Shape
Gets or sets the shape blend factor for barn lights.
public float Shape { get; set; }Property Value
float
Shear
Gets or sets the 2D shear offset for barn lights.
public Vector2 Shear { get; set; }Property Value
SizeParams
Gets or sets the half-width, half-height, and near-plane reciprocal for barn lights.
public Vector3 SizeParams { get; set; }Property Value
SkirtNear
Gets or sets the near skirt distance for perspective barn lights.
public float SkirtNear { get; set; }Property Value
float
SkyAmbientBounce
Gets or sets the sRGB color the ground bounces an environment light's sun and sky back up with.
public Vector3 SkyAmbientBounce { get; set; }Property Value
SkyColor
Gets or sets the sRGB color of the sky an environment light fills shadows with.
public Vector3 SkyColor { get; set; }Property Value
SkyIntensity
Gets or sets the intensity of SceneLight.SkyColor.
public float SkyIntensity { get; set; }Property Value
float
SoftX
Gets or sets the horizontal soft edge width for barn lights.
public float SoftX { get; set; }Property Value
float
SoftY
Gets or sets the vertical soft edge width for barn lights.
public float SoftY { get; set; }Property Value
float
SpotInnerAngle
Gets or sets the inner cone half-angle for spot lights in degrees.
public float SpotInnerAngle { get; set; }Property Value
float
SpotOuterAngle
Gets or sets the outer cone half-angle for spot lights in degrees.
public float SpotOuterAngle { get; set; }Property Value
float
StationaryLightIndex
Light index to a baked lightmap. Range: 0..255 for LightmapGameVersion 1 and 0..3 for LightmapGameVersion 2.
public int StationaryLightIndex { get; set; }Property Value
int
StyleBrightness
Gets or sets the brightness multiplier of the current light style.
public float StyleBrightness { get; set; }Property Value
float
Type
Gets or sets the shader light type used during rendering.
public SceneLight.LightType Type { get; set; }Property Value
Methods
ComputeBarnFaces(Dictionary<string, int>)
Recomputes the SceneLight.BarnFaces array from the current light properties.
public void ComputeBarnFaces(Dictionary<string, int> cookiePaths)Parameters
cookiePaths Dictionary<string, int>
Map from cookie material path to cookie atlas index.
ComputeConeSolidAngle()
Calculates the effective solid angle of a spotlight cone, clamped to a maximum of 4pi steradians (full sphere).
public float ComputeConeSolidAngle()Returns
float
ComputeConeSolidAngle(float, float)
Calculates the effective solid angle of a spotlight cone, clamped to a maximum of 4pi steradians (full sphere).
public static float ComputeConeSolidAngle(float spotOuterAngle, float spotInnerAngle)Parameters
spotOuterAngle float
The outer cone angle, in degrees.
spotInnerAngle float
The inner cone angle, in degrees.
Returns
float
FromEntityProperties(Scene, EntityType, Entity)
Creates a SceneLight populated from entity key-value properties.
public static SceneLight FromEntityProperties(Scene scene, SceneLight.EntityType type, EntityLump.Entity entity)Parameters
scene Scene
type SceneLight.EntityType
entity EntityLump.Entity
Returns
GetCost(DirectLightType, int)
What this light costs to render, which is SceneLight.DirectLight resolved against SceneLight.StationaryLightIndex.
public static SceneLight.LightCost GetCost(SceneLight.DirectLightType directLight, int stationaryLightIndex)Parameters
directLight SceneLight.DirectLightType
stationaryLightIndex int
Returns
GetCost(Entity)
What this light costs to render, which is SceneLight.DirectLight resolved against SceneLight.StationaryLightIndex.
public static SceneLight.LightCost GetCost(EntityLump.Entity entity)Parameters
entity EntityLump.Entity
Light entity to read the direct lighting key values from.
Returns
GetEditorTint(Entity)
Editor model tint for a light entity, keyed on how expensive it is: teal for static, amber for stationary, red for dynamic.
public static Vector3 GetEditorTint(EntityLump.Entity entity)Parameters
entity EntityLump.Entity
Light entity to read the direct lighting key values from.
Returns
GetShadowFaceDimensions(int)
Returns the shadow map pixel dimensions for this light at the given long-axis resolution, accounting for aspect ratio.
public (int W, int H) GetShadowFaceDimensions(int size)Parameters
size int
Target resolution in texels along the longer axis.
Returns
IsAccepted(string)
Returns whether the given entity classname is a recognized light type, and which SceneLight.EntityType it maps to.
public static (bool Accepted, SceneLight.EntityType Type) IsAccepted(string classname)Parameters
classname string
Returns
(bool Accepted, SceneLight.EntityType Type)
PlaceAt(in Matrix4x4)
Places the light, setting SceneNode.Transform, SceneLight.Position and SceneLight.Direction from one transform so a parent transform applies to all three.
public void PlaceAt(in Matrix4x4 transform)Parameters
transform Matrix4x4
The light's world transform; its first row is the direction it faces.

