Class WorldLightingInfo
Namespace: ValveResourceFormat.Renderer.World
Assembly: Renderer.dll
Scene lighting data including lightmaps, reflection probes, and shadow maps.
public class WorldLightingInfoInheritance
Constructors
WorldLightingInfo(Scene)
Scene lighting data including lightmaps, reflection probes, and shadow maps.
public WorldLightingInfo(Scene scene)Parameters
scene Scene
Fields
SunCascadeCount
Number of sun shadow cascades rendered and sampled. Cascade 0 is the tightest.
public const int SunCascadeCount = 2Field Value
Properties
ActiveSunCascadeCount
Gets the number of cascades in use after the last call. Cascades beyond it only keep their layer cleared, which samples as fully lit.
public int ActiveSunCascadeCount { get; }Property Value
BarnLightShadowAtlasSize
Gets the size of the barn light shadow atlas texture, as recorded by the last call.
public int BarnLightShadowAtlasSize { get; }Property Value
BarnLights
Gets the list of real-time barn lights.
public List<SceneLight> BarnLights { get; }Property Value
BinnedBarnLightFaces
Gets which light face each binned slot holds, in the same order as , so a cull bit traces back to the face it culled.
public ReadOnlySpan<BarnLightFaceSlot> BinnedBarnLightFaces { get; }Property Value
ReadOnlySpan<BarnLightFaceSlot>
BinnedBarnLightVolumes
Gets what bounds every binned barn light face, in the order the shading pass indexes them, so a cull item's bit position is its light index.
public ReadOnlySpan<BarnLightCullVolume> BinnedBarnLightVolumes { get; }Property Value
ReadOnlySpan<BarnLightCullVolume>
CubemapType
Gets or sets the storage format used for environment map cubemaps in this scene.
public CubemapType CubemapType { get; set; }Property Value
EnableDynamicShadows
Gets or sets a value indicating whether dynamic shadow rendering is enabled.
public bool EnableDynamicShadows { get; set; }Property Value
EnvMapHandshakes
Gets the environment map lookup by handshake ID.
public Dictionary<int, SceneEnvMap> EnvMapHandshakes { get; }Property Value
EnvMaps
Gets the list of environment map probes.
public List<SceneEnvMap> EnvMaps { get; }Property Value
HasBakedShadowsFromLightmap
Gets a value indicating whether the lightmap contains baked shadow data.
public bool HasBakedShadowsFromLightmap { get; }Property Value
HasValidLightProbes
Gets or sets a value indicating whether the scene has a complete and usable light probe set.
public bool HasValidLightProbes { get; set; }Property Value
HasValidLightmaps
Gets or sets a value indicating whether the scene has a complete and usable lightmap set.
public bool HasValidLightmaps { get; set; }Property Value
LightProbeType
Gets or sets the storage format used for light probe irradiance data in this scene.
public LightProbeType LightProbeType { get; set; }Property Value
LightProbes
Gets the list of scene light probes.
public List<SceneLightProbe> LightProbes { get; }Property Value
LightingData
Gets or sets the GPU lighting constants buffer for the scene.
public LightingConstants LightingData { get; set; }Property Value
LightmapGameVersionNumber
Gets or sets the game-specific lightmap sub-version number.
public int LightmapGameVersionNumber { get; set; }Property Value
LightmapVersionNumber
Gets or sets the lightmap version number from the world data.
public int LightmapVersionNumber { get; set; }Property Value
Lightmaps
Gets the lightmap textures indexed by uniform name.
public Dictionary<string, RenderTexture> Lightmaps { get; }Property Value
Dictionary<string, RenderTexture>
ProbeHandshakes
Gets the light probe lookup by handshake ID.
public Dictionary<int, SceneLightProbe> ProbeHandshakes { get; }Property Value
Dictionary<int, SceneLightProbe>
ShadowMapper
Gets the shadow mapper that culls and packs light shadow faces each frame.
public ShadowMapper ShadowMapper { get; }Property Value
SunCastDirection
Gets the normalized direction sun light travels, away from the sun.
public Vector3 SunCastDirection { get; }Property Value
SunLightFrustums
Gets the frustums used for sun light shadow caster culling, one per cascade.
public Frustum[] SunLightFrustums { get; }Property Value
Frustum[]
SunLightShadowBias
Gets or sets the depth bias applied to sun light shadows to reduce self-shadowing artifacts.
public float SunLightShadowBias { get; set; }Property Value
SunLightShadowCoverageScale
Gets or sets a scale factor applied to the sun light shadow coverage area.
public float SunLightShadowCoverageScale { get; set; }Property Value
SunViewProjections
Gets the combined view-projection matrices used for sun shadow rendering, one per cascade.
public Matrix4x4[] SunViewProjections { get; }Property Value
UseSceneBoundsForSunLightFrustum
Gets or sets a value indicating whether the sun light frustum is fitted to the scene bounds rather than the camera.
public bool UseSceneBoundsForSunLightFrustum { get; set; }Property Value
UsesLegacyBarnBrightness
Gets or sets whether barn, rect and omni lights take their intensity from brightness_legacy.
public bool UsesLegacyBarnBrightness { get; set; }Property Value
Methods
AddEnvironmentMap(SceneEnvMap)
Registers an environment map with the scene, setting the cubemap type on the first entry.
public void AddEnvironmentMap(SceneEnvMap envmap)Parameters
envmap SceneEnvMap
The environment map to add.
AddProbe(SceneLightProbe)
Registers a light probe with the scene, validating its texture set against the lightmap version.
public void AddProbe(SceneLightProbe lightProbe)Parameters
lightProbe SceneLightProbe
The light probe to add.
BinBarnLights(Camera, int)
Culls and bins visible barn lights for the current frame, packing their shadow faces into the atlas.
public void BinBarnLights(Camera camera, int atlasSize)Parameters
camera Camera
The camera used for culling and shadow resolution selection.
atlasSize int
Pixel size of the shadow atlas texture.
BindBarnLightBuffer()
Binds the barn light storage buffer to its reserved shader slot.
public void BindBarnLightBuffer()BindInstanceLightProbeTextures(SceneLightProbe)
Binds the per-draw light probe volume textures. Individual-probe scenes only.
public void BindInstanceLightProbeTextures(SceneLightProbe lightProbe)Parameters
lightProbe SceneLightProbe
BindLightmapTextures()
Binds the scene's lightmap, light probe atlas, and barn light cookie textures to their reserved units.
public void BindLightmapTextures()ClearBarnLights()
Clear renderable barn light lists.
public void ClearBarnLights()CreateBarnLightBuffer()
Allocates the GPU storage buffer used to pass barn light data to shaders.
public void CreateBarnLightBuffer()DisposeBarnLights()
Releases the barn light GPU buffer, cookie atlas texture, and sampler objects.
public void DisposeBarnLights()FitSunLightDepthRange(int, float, float)
Tightens the depth range of a cascade's entry around the collected shadow casters, given their extent along in world units. A tight range shrinks the world-space size of the normalized shadow bias. Receivers outside the range clamp in the shader and still compare correctly against every caster, and since the fit derives from the same culled set that renders, it covers every rendered caster by construction. keeps the generous culling range.
public void FitSunLightDepthRange(int cascade, float casterMin, float casterMax)Parameters
cascade int
The cascade index to tighten.
casterMin float
Smallest caster projection onto the cast direction, or when no casters were collected.
casterMax float
Largest caster projection onto the cast direction.
SetSunDirectionFromAngles(Vector3)
Points the sun uniforms at the given Euler angles, keeping the sun color.
public void SetSunDirectionFromAngles(Vector3 angles)Parameters
angles Vector3
StoreLightMappedLights_V1(List<SceneLight>)
Stores stationary and dynamic light data into using the V1 lightmap format. Stationary lights sit at their baked lightmap index and are lit through the per-texel strength textures; dynamic lights are appended after them and evaluated per pixel.
public void StoreLightMappedLights_V1(List<SceneLight> lights)Parameters
lights List<SceneLight>
The list of scene lights to store.
StoreLightMappedLights_V2(List<SceneLight>)
Stores environment light data and queues real-time barn lights using the V2 lightmap format.
public void StoreLightMappedLights_V2(List<SceneLight> lights)Parameters
lights List<SceneLight>
The list of scene lights to store.
StoreLights(List<SceneLight>)
Initial store of map lights to GPU.
public void StoreLights(List<SceneLight> lights)Parameters
lights List<SceneLight>
UpdateGpuLightBuffers()
Re-stores the GPU light properties.
public void UpdateGpuLightBuffers()UpdateSunLightFrustum(Camera, float)
Recalculates and to fit the current camera view. Cascade extents follow . The frustums get a generous depth range for caster culling; once a cascade's casters are collected, tightens its rendered range around them.
public void UpdateSunLightFrustum(Camera camera, float shadowMapSize = 512)Parameters
camera Camera
The active camera used to position the sun shadow frustum.
shadowMapSize float
The shadow map resolution used to compute coverage and texel snapping.

