Skip to main content
Version: Next (dev)

Guided Direct Lighting

Guided direct lighting (Rendering.DirectLighting.Mode 3) renders shadows for scenes with many local lights—point, spot, rect, disk, and cylinder lights—at a fixed ray budget per pixel instead of rendering an individual shadow map for every light.

Screen tiles learn which lights actually reach visible surfaces and focus future shadow rays on them, while reserving a safety pool of samples to quickly discover lights that appear around corners or through opening doors.

How Guided Direct Lighting works: tile light picking, screen trace, world ray trace, and denoising

Where it fits among direct lighting modes​

Rendering.DirectLighting.Mode defaults to 0 in the engine and across all five shipped quality presets:

ModeNameHow shadows workBest for
0Classic (default)Standard shadow maps for shadowed lights.General scenes and GPUs without ray tracing.
1Probe Direct LightingScreen-space probes trace local-light visibility.Moderate local-light counts with probe reuse.
2ReSTIR Direct LightingSpatiotemporal reservoir resampling.Very large light counts and emissive-mesh lighting.
3Guided Direct LightingThis page. Tile-guided visibility rays + denoiser.Dense local lights with predictable cost and clean denoising.

Quick setup​

  1. Check requirements: Guided direct lighting needs a perspective camera and an active ray tracing backend (hardware or software via Rendering.GI.TraceBackend). Orthographic views and unsupported devices fall back automatically to Classic mode (0).
  2. Enable Mode 3: Set Rendering.DirectLighting.Mode to 3 in your project configuration or the Quality Settings panel.
  3. Verify it is running: Open Render Mode › Direct Lighting (Guided) › Trace Stage (App.ViewRenderMode 108) and check Renderer/GuidedLighting/Status ("Active"), Renderer/GuidedLighting/RaysPerPixel, and Renderer/GuidedLighting/ShadowMapGrant (1 once local shadow maps are turned off).

Quality presets​

All five shipped presets (Data/Base/RuntimeConfigs/QualityPresets.ddl) leave Rendering.DirectLighting.Mode at 0, while pre-configuring per-tier budgets for when you opt in to Mode 3:

PresetSamplesPerCellHalfRes (cell size)AreaSamplesNRD.AtrousIterations
Low2true (2×2 px)43
Medium4true (2×2 px)44
High4true (2×2 px)45
Max4false (1×1 px)45
Mobile1true (2×2 px)42

How it works​

Which lights it handles (and automatic fallback)​

Guided direct lighting handles shadowed local point, spot, rect, disk, and cylinder lights. By default (Rendering.GuidedLighting.UnshadowedInClassicLoop = true), the sun, fill lights, and unshadowed local lights stay on the fast classic lighting loop.

If the guided pass is inactive, has no ray tracing scene, or fails a dispatch on a frame, a coverage gate keeps the classic loop active automatically so the scene never loses lighting.

Tile memory and the hidden-light safety pool​

The screen is split into sampling cells (2×2 pixels when Rendering.GuidedLighting.HalfRes is true, or 1×1 pixels at full resolution), grouped into 8×8-cell tiles. Each tile keeps a rolling list of up to 16 visible lights learned from recent frames.

Every cell draws Rendering.GuidedLighting.SamplesPerCell samples (4 by default) from two pools:

  • Visible list: Lights the tile already knows reach its surfaces, weighted by how much light they contribute.
  • Hidden pool: Up to Rendering.GuidedLighting.HiddenCandidates (8 by default) lights from outside the tile's list. Normally this takes at most 20% (HiddenBudget = 0.2) of the cell's samples, rising to 50% (MissBudget = 0.5) on newly revealed areas (disocclusions, screen edges, or frame 1) so newly uncovered lights appear promptly.

Inline vs. split ray tracing​

Before firing an expensive 3D world ray, each sample checks a short stretch of the screen depth buffer (0.2 m by default) to catch close contact shadows cheaply. Two execution paths are available:

  • Inline path (Rendering.GuidedLighting.Trace.Split = false, default): Runs the screen trace and world ray trace together in a single shader pass.
  • Split path (Rendering.GuidedLighting.Trace.Split = true, opt-in): Compacts active rays in screen order, runs screen tracing separately, and splits surviving world rays into separate opaque-only and alpha-tested dispatches so opaque lights avoid alpha-test shader overhead.
  • Experimental Hi-Z hand-off (Rendering.GuidedLighting.Trace.ExperimentalHandOff, requires Trace.Split): Walks a closest-depth pyramid up to 1.0 m and starts the world ray from the last known clear point, shortening world ray travel.

Denoising and output profiles​

Select a denoiser with Rendering.GuidedLighting.Denoiser:

  • 0 — Built-in temporal + spatial (default): Reuses lighting across up to 32 frames, resets or shortens history automatically when lights change, and runs 3 edge-aware spatial filter passes where noise remains.
  • 1 — NRD ReLAX: Uses the NRD ReLAX denoiser with optional ratio estimation so dimming lights keep smooth history.
  • 2 — Off: Outputs raw 1-frame samples for inspection.

The built-in denoiser adapts automatically to your anti-aliasing setup via Rendering.GuidedLighting.Denoise.Profile:

ProfileValueBehaviour
Auto (default)0Picks Temporal AA when TAA, MEGAA TAA, or a temporal upscaler is active; picks Standalone for SMAA, FXAA, or AA Off.
Temporal AA1Skips the final 4-frame stabilizer because downstream TAA or upscaling smooths remaining shimmer.
Standalone2Uses fixed spatial patterns and a 4-frame post-spatial stabilizer (Denoise.Stabilizer = true) so non-temporal AA modes stay steady.

You can also enable Rendering.GuidedLighting.Denoise.SpatialGate (opt-in, false by default) to run spatial blurring only on 8×8 tiles that still have young history or noisy confidence, keeping converged shadow edges crisp.

Automatic local shadow-map suppression​

Once guided direct lighting produces 4 consecutive valid frames (Renderer/GuidedLighting/ShadowMapGrant = 1) and Rendering.GuidedLighting.SuppressShadowMaps is true (default), the engine stops rendering traditional shadow maps for guided local lights—saving substantial GPU time.

Local shadow maps are automatically kept when any receiver still needs them:

  • All local shadow maps stay on if the scene contains subsurface materials, strand hair, or post-prepass foliage (Rendering.Foliage.PrepassMaxDistance).
  • Per-light volumetric shadow maps stay on for lights with VolumetricIntensity > 0 while volumetric fog or VDB volumes are visible (Rendering.GuidedLighting.FogShadowMaps = true).
  • Per-light transparent shadow maps stay on for lights with TransparentShadows enabled when transparent objects are visible.

Tuning cost and quality​

  • Primary ray budget: Rendering.GuidedLighting.HalfRes (true = 2×2 cells, false = 1×1 cells) and Rendering.GuidedLighting.SamplesPerCell (4 default) directly control rays per pixel (Renderer/GuidedLighting/RaysPerPixel).
  • Fast discovery vs. quieter steady lighting: Raise HiddenCandidates (e.g. 8 → 16) or HiddenBudget in dense multi-light interiors with fast camera turns. Lower HiddenBudget in calmer rooms to put more rays into the learned 16-light list. Set MinTarget (e.g. 0.005) to skip negligible dim lights.
  • Offload more rays to screen space: Enable Rendering.GuidedLighting.Trace.Split to separate opaque and alpha-tested world rays. Raise ScreenTraceLength (0.2 m) and ScreenTraceSteps (8) to catch more close-up shadows before world tracing (ScreenTraceHitShare), or test Trace.ExperimentalHandOff.
  • Sharper shadows: With the built-in denoiser (Denoiser 0), reduce Denoise.SpatialPasses from 3 to 1 or 2, or enable Denoise.SpatialGate.

Diagnostic views​

Open diagnostic overlays from Render Mode › Direct Lighting (Guided) (or via App.ViewRenderMode).

Trace Stage legend (App.ViewRenderMode 108)​

Render Mode › Direct Lighting (Guided) › Trace Stage shows which stage resolved each shadow sample:

ColourMeaning
Light greyNo ray needed (light is behind the surface or casts no shadow).
Dark greyDuplicate sample that reused another ray in the same cell.
BlueBlocked by the fast screen-space depth trace.
TealTraced an opaque-only world ray.
GoldTraced an alpha-tested world ray (brighter when handed further forward by split screen trace).
MagentaPending ray that was never traced (investigate pass status).

Sampling and list diagnostic views​

Render modeConsole commandWhat it shows
GuidedLightingRawSamplesApp.ViewRenderMode 68Raw 1-frame pre-denoiser diffuse + specular signal.
GuidedLightingLightComplexityApp.ViewRenderMode 69Number of guided lights in range per cell (scaled by ComplexityScale).
GuidedLightingListFillApp.ViewRenderMode 70How full each tile's 16-light visible list is.
GuidedLightingSampleOutcomeApp.ViewRenderMode 71Green = visible hit, red = blocked, blue = screen-trace hit.
GuidedLightingHiddenShareApp.ViewRenderMode 72Share of samples drawn from the hidden pool vs. the visible list.
GuidedLightingPickProbabilityApp.ViewRenderMode 73Selection probability of the chosen lights.
GuidedLightingReferenceApp.ViewRenderMode 74Brute-force ground-truth reference render.

Denoiser and reference error views​

Render modeConsole commandWhat it shows
GuidedLightingHistoryLengthApp.ViewRenderMode 75Accumulated temporal history frames per pixel.
GuidedLightingShadingConfidenceApp.ViewRenderMode 76Share of known light energy sampled this frame.
GuidedLightingTemporalVarianceApp.ViewRenderMode 77Post-temporal luminance variance driving spatial filtering.
GuidedLightingHistoryRejectionApp.ViewRenderMode 78Pixels where disocclusion, light changes, or clamping shortened history.
GuidedLightingReferenceErrorApp.ViewRenderMode 79Per-pixel error against the reference pass (Debug.CompareReference).

Console variables​

Core mode and sampling​

CVarDefaultDescription
Rendering.DirectLighting.Mode00 = classic shadow maps (default in all presets), 1 = probe direct lighting, 2 = ReSTIR, 3 = guided direct lighting.
Rendering.GuidedLighting.EnabletrueEnables plGuidedDirectLightingPass while mode is 3.
Rendering.GuidedLighting.SamplesPerCell4Light samples per cell (1–16). Presets: 2 Low, 4 Medium/High/Max, 1 Mobile.
Rendering.GuidedLighting.HalfRestruetrue = 2×2 pixel cells (Low/Medium/High/Mobile); false = 1×1 cells (Max). Shading and denoising always run at full resolution.
Rendering.GuidedLighting.HiddenCandidates8Lights outside the tile's 16-entry list evaluated per cell (0–32; doubled on reprojection miss).
Rendering.GuidedLighting.HiddenBudget0.2Maximum share (0.0–1.0) of samples reserved for hidden-pool lights when visible list weight >= MinVisibleWeight.
Rendering.GuidedLighting.MissBudget0.5Hidden-pool sample share (0.0–1.0) on cells where reprojection missed.
Rendering.GuidedLighting.MinVisibleWeight0.001Visible-list weight below which HiddenBudget no longer caps hidden-pool sampling.
Rendering.GuidedLighting.MinTarget0.0Exposed luminance threshold below which a light skips tracing (0.0 = unbiased).
Rendering.GuidedLighting.WeightCurve0Candidate weight curve: 0 = power (target ^ WeightExponent), 1 = log2(1 + target).
Rendering.GuidedLighting.WeightExponent1.0Exponent for WeightCurve 0 (lower spreads samples toward dimmer lights).
Rendering.GuidedLighting.UnshadowedInClassicLooptrueKeeps unshadowed local lights on the classic loop and guides only shadowed lights.
Rendering.GuidedLighting.ChangeSignal1How changed lights shorten history: 0 = full reset, 1 = proportional to brightness or distance change.
Rendering.GuidedLighting.PointSourceRadius0.0Minimum emitter radius in metres for point/spot lights (each light's PenumbraSize wins when larger).

Ray tracing and screen trace​

CVarDefaultDescription
Rendering.GuidedLighting.Trace.SplitfalseOpt-in: runs compaction, screen trace, separate opaque/alpha-tested world rays, and list build as split stages.
Rendering.GuidedLighting.Trace.ExperimentalHandOfffalseExperimental (requires Trace.Split): walks a Hi-Z depth pyramid up to ScreenTrace.MaxLength and advances surviving world ray origins.
Rendering.GuidedLighting.ScreenTraceLength0.2Short depth-buffer trace distance in metres (0.0 = off).
Rendering.GuidedLighting.ScreenTraceSteps8Depth-buffer steps in the short screen trace.
Rendering.GuidedLighting.ScreenTraceThickness0.15Assumed surface thickness in metres during the short screen trace.
Rendering.GuidedLighting.ScreenTrace.MaxLength1.0Maximum distance in metres for the ExperimentalHandOff pyramid walk.
Rendering.GuidedLighting.ScreenTrace.MaxIterations50Maximum pyramid cells visited per ray in ExperimentalHandOff.
Rendering.GuidedLighting.ScreenTrace.RelativeThickness0.005Relative depth thickness (plus 2 mm) for candidate hits in ExperimentalHandOff.
Rendering.GuidedLighting.ScreenTrace.Pullback0.05Pullback distance in metres before starting the handed-off world ray.
Rendering.GuidedLighting.RayBias0.02Shadow ray origin offset along the ray direction in metres.
Rendering.GuidedLighting.NormalBias0.02Shadow ray origin offset along the geometric normal in metres.

Built-in denoiser​

CVarDefaultDescription
Rendering.GuidedLighting.Denoiser00 = built-in temporal + spatial, 1 = NRD ReLAX, 2 = off (raw signal).
Rendering.GuidedLighting.Denoise.MaxHistory32.0Maximum accumulated temporal history frames (built-in and NRD).
Rendering.GuidedLighting.Denoise.ClipSigma1.0Variance-clipping half-width in standard deviations on moving pixels (1.5× when still).
Rendering.GuidedLighting.Denoise.SpatialPasses3Edge-aware wavelet iterations (0–5; 0 runs a single sparse 8-tap kernel on noisy/young pixels).
Rendering.GuidedLighting.Denoise.Profile0Output profile: 0 = Auto, 1 = Temporal AA, 2 = Standalone.
Rendering.GuidedLighting.Denoise.StabilizertrueEnables the 4-frame post-spatial stabilizer in Standalone mode.
Rendering.GuidedLighting.Denoise.SpatialGatefalseOpt-in: runs wavelet passes only on noisy or young-history 8×8 tiles (plus 1-tile halo).
Rendering.GuidedLighting.Denoise.SpatialGateConfidence0.2Smoothed confidence threshold at or below which a deviating pixel triggers the spatial gate.
Rendering.GuidedLighting.Denoise.SpatialGateDeviation0.5Relative frame-to-frame luminance deviation threshold for the spatial gate.
Rendering.GuidedLighting.Denoise.SpatialThreshold0.02Relative variance above which converged pixels are spatially filtered.
Rendering.GuidedLighting.Denoise.FireflyClamp4.0Standard-deviation cap on bright outliers while history is under 8 frames (0.0 = off).
Rendering.GuidedLighting.Denoise.ConfidencetrueUses per-pixel shading confidence to accelerate temporal convergence.

NRD ReLAX denoiser​

CVarDefaultDescription
Rendering.GuidedLighting.RatioEstimatortrueDenoises the shadowed ratio E / U and multiplies by exact unshadowed light U afterwards.
Rendering.GuidedLighting.NRD.HistoryConfidencetrueFeeds light-change and visibility-change signals into NRD ReLAX history confidence.
Rendering.GuidedLighting.NRD.MinHistory0.0Minimum frames of NRD history kept after a known change.
Rendering.GuidedLighting.NRD.HistoryFixFrames3Frames after a reset (0–3) rebuilt with NRD's sparse 5×5 history-fix kernel.
Rendering.GuidedLighting.NRD.HistoryFixStride14Pixel stride of NRD's history-fix kernel.
Rendering.GuidedLighting.NRD.FastHistory6Frames in NRD ReLAX's fast history window.
Rendering.GuidedLighting.NRD.AntiFireflytrueEnables NRD ReLAX anti-firefly filtering.
Rendering.GuidedLighting.NRD.PrepassDiffuseRadius15.0Diffuse pre-pass blur radius in pixels.
Rendering.GuidedLighting.NRD.PrepassSpecularRadius25.0Specular pre-pass blur radius in pixels.
Rendering.GuidedLighting.NRD.AtrousIterations4A-trous iterations (2–8). Presets: 3 Low, 4 Medium, 5 High/Max, 2 Mobile.
Rendering.GuidedLighting.NRD.SpeculartrueDenoises specular in NRD ReLAX (false runs diffuse-only and composites raw specular).

Shadow-map suppression, reference, and debug​

CVarDefaultDescription
Rendering.GuidedLighting.SuppressShadowMapstrueSuppresses local shadow maps after 4 valid frames when no classic-loop receiver needs them.
Rendering.GuidedLighting.FogShadowMapstrueKeeps shadow maps for local lights with VolumetricIntensity > 0 when fog/VDB volumes are active.
Rendering.GuidedLighting.AreaSamples4Stratified emitter rays per light in the reference path (4 in all presets).
Rendering.GuidedLighting.ReferencefalseRuns the brute-force reference path (every light in range shadowed every frame).
Rendering.GuidedLighting.AccumulatefalseAverages stationary guided frames up to ReferenceMaxFrames to verify convergence.
Rendering.GuidedLighting.ReferenceMaxFrames1024Maximum stationary frames averaged by Reference or Accumulate (1 = no accumulation).
Rendering.GuidedLighting.ComplexityScale32.0Light count mapped to the top of the GuidedLightingLightComplexity colour ramp.
Rendering.GuidedLighting.LogStatsfalsePrints guided lighting stats to the console once per second.
Rendering.GuidedLighting.Debug.CompareReferencefalseRuns the reference pass alongside guided lighting and computes NoiseError, FlickerError, and LagError.

Troubleshooting​

SymptomLikely causeWhat to do
Renderer/GuidedLighting/Status is not "Active" and lights still use classic shadow mapsRendering.DirectLighting.Mode is not 3, the camera is orthographic, or ray tracing is unavailable.Check Renderer/GuidedLighting/Status in the stats overlay; set Mode to 3 and verify Rendering.GI.TraceBackend.
Local shadow maps still render even though Active is 1SuppressShadowMaps keeps shadow maps for subsurface materials, hair, post-prepass foliage, volumetric fog (FogShadowMaps), or TransparentShadows.Check Renderer/GuidedLighting/ShadowMapGrant. Set VolumetricIntensity to 0 on lights that don't need fog shadows, or turn off FogShadowMaps.
Log warning about failed guided frame after shadow maps were skipped (UnshadowedFallbackFrames > 0)A newly activated stage's shader permutation or resource wasn't ready yet.Check Renderer/GuidedLighting/Status for the failing stage and keep Rendering.Pipelines.Manifest enabled to pre-warm pipelines.
A newly revealed light around a corner takes several frames to appearHiddenCandidates, HiddenBudget, or MissBudget is too low for the number of lights in the cluster.Raise Rendering.GuidedLighting.HiddenCandidates (e.g. 8 → 16) and inspect List Fill (App.ViewRenderMode 70).
Subtle 4-frame shimmer when using SMAA, FXAA, or AA OffDenoise.Profile was forced to 1 (Temporal AA) or Denoise.Stabilizer was disabled.Leave Rendering.GuidedLighting.Denoise.Profile at 0 (Auto) and Denoise.Stabilizer at true.
Technical reference: engine internals, shaders, and full stats list

Pipeline, partitioning, and shaders​

  • Pass & light partitioning (plGuidedDirectLightingPass, ClusteredDataExtractor.cpp): Supports plPointLightRenderData, plSpotLightRenderData, plRectLightRenderData, plDiskLightRenderData, and plCylinderLightRenderData. PartitionGuidedLights partitions cluster lists into [0, GuidedCount) and [GuidedCount, TotalCount). GetDirectLightingClusterSubRange() and ShouldSkipClusteredLight() in Data/Base/Shaders/Common/DirectLightingComposite.h skip guided lights once GDL_COVERAGE_GATE_OPEN is written to GDL_COVERAGE_GATE and pixels carry GDL_SELECTED_COVERED.
  • Tile lists & sampling (GDLConstants.h): GDL_TILE_CELLS = 8, GDL_LIST_CAPACITY = 16 (plGuidedDirectLightingPass::m_hLists), GDLRemap.plShader, GDLListBuild.plShader, GDLSample.plShader, GDLReference.plShader.
  • 64-bit sample record (GDL_SAMPLE_BYTES = 8): Word 0 packs GDL_SAMPLE_LIGHT_BITS = 12, GDL_SAMPLE_FLAG_BITS = 9 (GDL_SAMPLE_VALID, GDL_SAMPLE_HIDDEN, GDL_SAMPLE_VISIBLE, GDL_SAMPLE_SCREEN_HIT, GDL_SAMPLE_DUPLICATE, GDL_SAMPLE_WORLD_RAY, GDL_SAMPLE_TRAILING, GDL_SAMPLE_PENDING), GDL_SAMPLE_MASK_BITS = 4, and GDL_SAMPLE_HANDOFF_BITS = 7; word 1 stores GDL_SAMPLE_WEIGHT_BITS = 32.
  • Split trace shaders: GDLCompactScan.plShader, GDLCompactScatter.plShader, GDLScreenTrace.plShader, GDLScreenTraceHiZ.h, GDLWorldTrace.plShader (GDL_WORLD_ALPHA_TESTED = FALSE / TRUE), GDL_DEBUG_TRACE_STAGE = 12.
  • Built-in denoiser shaders: GDLDenoiseTemporal.plShader, GDLDenoiseAtrous.plShader, GDLDenoiseSpatial.plShader, GDLDenoiseStabilize.plShader, GDLRemodulate.plShader, GDLGateClassify.plShader (GDL_DENOISE_GATE_TILE = 8, GDL_DENOISE_STANDALONE). History stored in R11G11B10Float (or RGBA16F fallback).
  • Shadow-map grant: GDLGrantEstablishedFrames = 4, plProbeDirectLightingPass::PublishGuidedGrant, CheckGuidedGrant, WithdrawShadowMapGrant, plGuidedDirectLightingPass::IsSupported(), viewData.m_bUpscalerActive.

Stats (Renderer/GuidedLighting/*)​

  • Pass state & grant: Status, Active, Lights, ChangedLights, ShadowMapGrant, UnshadowedFallbackFrames, ReferenceFrames.
  • Sampling & ray rates: RaysPerPixel, SamplesPerPixel, ScreenTraceHitShare, BlockedRayShare, DuplicateShare, HiddenSampleShare, ReprojectionMissShare, LightsInRangePerCell.
  • Split trace (Renderer/GuidedLighting/Trace/): Path ("Split" or "Inline"), RaysRequested, RaysCompacted, ScreenHits, WorldRays, WorldRaysAlphaTested, HandOffMetres, ScreenStepsPerRay, ScreenCandidates, HiZSource ("View", "Own", "Missing (build Failed)", "Missing (BuildHiZ off)", or "Off").
  • Denoiser & reference comparison: Denoise/GateFilteredShare, HistoryFrames, ShadingConfidence, SpatialShare, Flicker, HistoryRejected, NoiseError, LagError, FlickerError, BiasError, ChangedShare, DisocclusionError, DisoccludedShare.

See Also​