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.
Where it fits among direct lighting modes
Rendering.DirectLighting.Mode defaults to 0 in the engine and across all five shipped quality presets:
| Mode | Name | How shadows work | Best for |
|---|---|---|---|
0 | Classic (default) | Standard shadow maps for shadowed lights. | General scenes and GPUs without ray tracing. |
1 | Probe Direct Lighting | Screen-space probes trace local-light visibility. | Moderate local-light counts with probe reuse. |
2 | ReSTIR Direct Lighting | Spatiotemporal reservoir resampling. | Very large light counts and emissive-mesh lighting. |
3 | Guided Direct Lighting | This page. Tile-guided visibility rays + denoiser. | Dense local lights with predictable cost and clean denoising. |
Quick setup
- 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). - Enable Mode 3: Set
Rendering.DirectLighting.Modeto3in your project configuration or the Quality Settings panel. - Verify it is running: Open Render Mode › Direct Lighting (Guided) › Trace Stage (
App.ViewRenderMode 108) and checkRenderer/GuidedLighting/Status("Active"),Renderer/GuidedLighting/RaysPerPixel, andRenderer/GuidedLighting/ShadowMapGrant(1once 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:
| Preset | SamplesPerCell | HalfRes (cell size) | AreaSamples | NRD.AtrousIterations |
|---|---|---|---|---|
| Low | 2 | true (2×2 px) | 4 | 3 |
| Medium | 4 | true (2×2 px) | 4 | 4 |
| High | 4 | true (2×2 px) | 4 | 5 |
| Max | 4 | false (1×1 px) | 4 | 5 |
| Mobile | 1 | true (2×2 px) | 4 | 2 |
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(8by default) lights from outside the tile's list. Normally this takes at most20%(HiddenBudget = 0.2) of the cell's samples, rising to50%(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, requiresTrace.Split): Walks a closest-depth pyramid up to1.0m 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 to32frames, resets or shortens history automatically when lights change, and runs3edge-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:
| Profile | Value | Behaviour |
|---|---|---|
| Auto (default) | 0 | Picks Temporal AA when TAA, MEGAA TAA, or a temporal upscaler is active; picks Standalone for SMAA, FXAA, or AA Off. |
| Temporal AA | 1 | Skips the final 4-frame stabilizer because downstream TAA or upscaling smooths remaining shimmer. |
| Standalone | 2 | Uses 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 > 0while volumetric fog or VDB volumes are visible (Rendering.GuidedLighting.FogShadowMaps = true). - Per-light transparent shadow maps stay on for lights with
TransparentShadowsenabled when transparent objects are visible.
Tuning cost and quality
- Primary ray budget:
Rendering.GuidedLighting.HalfRes(true= 2×2 cells,false= 1×1 cells) andRendering.GuidedLighting.SamplesPerCell(4default) directly control rays per pixel (Renderer/GuidedLighting/RaysPerPixel). - Fast discovery vs. quieter steady lighting: Raise
HiddenCandidates(e.g.8→16) orHiddenBudgetin dense multi-light interiors with fast camera turns. LowerHiddenBudgetin calmer rooms to put more rays into the learned 16-light list. SetMinTarget(e.g.0.005) to skip negligible dim lights. - Offload more rays to screen space: Enable
Rendering.GuidedLighting.Trace.Splitto separate opaque and alpha-tested world rays. RaiseScreenTraceLength(0.2m) andScreenTraceSteps(8) to catch more close-up shadows before world tracing (ScreenTraceHitShare), or testTrace.ExperimentalHandOff. - Sharper shadows: With the built-in denoiser (
Denoiser 0), reduceDenoise.SpatialPassesfrom3to1or2, or enableDenoise.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:
| Colour | Meaning |
|---|---|
| Light grey | No ray needed (light is behind the surface or casts no shadow). |
| Dark grey | Duplicate sample that reused another ray in the same cell. |
| Blue | Blocked by the fast screen-space depth trace. |
| Teal | Traced an opaque-only world ray. |
| Gold | Traced an alpha-tested world ray (brighter when handed further forward by split screen trace). |
| Magenta | Pending ray that was never traced (investigate pass status). |
Sampling and list diagnostic views
| Render mode | Console command | What it shows |
|---|---|---|
GuidedLightingRawSamples | App.ViewRenderMode 68 | Raw 1-frame pre-denoiser diffuse + specular signal. |
GuidedLightingLightComplexity | App.ViewRenderMode 69 | Number of guided lights in range per cell (scaled by ComplexityScale). |
GuidedLightingListFill | App.ViewRenderMode 70 | How full each tile's 16-light visible list is. |
GuidedLightingSampleOutcome | App.ViewRenderMode 71 | Green = visible hit, red = blocked, blue = screen-trace hit. |
GuidedLightingHiddenShare | App.ViewRenderMode 72 | Share of samples drawn from the hidden pool vs. the visible list. |
GuidedLightingPickProbability | App.ViewRenderMode 73 | Selection probability of the chosen lights. |
GuidedLightingReference | App.ViewRenderMode 74 | Brute-force ground-truth reference render. |
Denoiser and reference error views
| Render mode | Console command | What it shows |
|---|---|---|
GuidedLightingHistoryLength | App.ViewRenderMode 75 | Accumulated temporal history frames per pixel. |
GuidedLightingShadingConfidence | App.ViewRenderMode 76 | Share of known light energy sampled this frame. |
GuidedLightingTemporalVariance | App.ViewRenderMode 77 | Post-temporal luminance variance driving spatial filtering. |
GuidedLightingHistoryRejection | App.ViewRenderMode 78 | Pixels where disocclusion, light changes, or clamping shortened history. |
GuidedLightingReferenceError | App.ViewRenderMode 79 | Per-pixel error against the reference pass (Debug.CompareReference). |
Console variables
Core mode and sampling
| CVar | Default | Description |
|---|---|---|
Rendering.DirectLighting.Mode | 0 | 0 = classic shadow maps (default in all presets), 1 = probe direct lighting, 2 = ReSTIR, 3 = guided direct lighting. |
Rendering.GuidedLighting.Enable | true | Enables plGuidedDirectLightingPass while mode is 3. |
Rendering.GuidedLighting.SamplesPerCell | 4 | Light samples per cell (1–16). Presets: 2 Low, 4 Medium/High/Max, 1 Mobile. |
Rendering.GuidedLighting.HalfRes | true | true = 2×2 pixel cells (Low/Medium/High/Mobile); false = 1×1 cells (Max). Shading and denoising always run at full resolution. |
Rendering.GuidedLighting.HiddenCandidates | 8 | Lights outside the tile's 16-entry list evaluated per cell (0–32; doubled on reprojection miss). |
Rendering.GuidedLighting.HiddenBudget | 0.2 | Maximum share (0.0–1.0) of samples reserved for hidden-pool lights when visible list weight >= MinVisibleWeight. |
Rendering.GuidedLighting.MissBudget | 0.5 | Hidden-pool sample share (0.0–1.0) on cells where reprojection missed. |
Rendering.GuidedLighting.MinVisibleWeight | 0.001 | Visible-list weight below which HiddenBudget no longer caps hidden-pool sampling. |
Rendering.GuidedLighting.MinTarget | 0.0 | Exposed luminance threshold below which a light skips tracing (0.0 = unbiased). |
Rendering.GuidedLighting.WeightCurve | 0 | Candidate weight curve: 0 = power (target ^ WeightExponent), 1 = log2(1 + target). |
Rendering.GuidedLighting.WeightExponent | 1.0 | Exponent for WeightCurve 0 (lower spreads samples toward dimmer lights). |
Rendering.GuidedLighting.UnshadowedInClassicLoop | true | Keeps unshadowed local lights on the classic loop and guides only shadowed lights. |
Rendering.GuidedLighting.ChangeSignal | 1 | How changed lights shorten history: 0 = full reset, 1 = proportional to brightness or distance change. |
Rendering.GuidedLighting.PointSourceRadius | 0.0 | Minimum emitter radius in metres for point/spot lights (each light's PenumbraSize wins when larger). |
Ray tracing and screen trace
| CVar | Default | Description |
|---|---|---|
Rendering.GuidedLighting.Trace.Split | false | Opt-in: runs compaction, screen trace, separate opaque/alpha-tested world rays, and list build as split stages. |
Rendering.GuidedLighting.Trace.ExperimentalHandOff | false | Experimental (requires Trace.Split): walks a Hi-Z depth pyramid up to ScreenTrace.MaxLength and advances surviving world ray origins. |
Rendering.GuidedLighting.ScreenTraceLength | 0.2 | Short depth-buffer trace distance in metres (0.0 = off). |
Rendering.GuidedLighting.ScreenTraceSteps | 8 | Depth-buffer steps in the short screen trace. |
Rendering.GuidedLighting.ScreenTraceThickness | 0.15 | Assumed surface thickness in metres during the short screen trace. |
Rendering.GuidedLighting.ScreenTrace.MaxLength | 1.0 | Maximum distance in metres for the ExperimentalHandOff pyramid walk. |
Rendering.GuidedLighting.ScreenTrace.MaxIterations | 50 | Maximum pyramid cells visited per ray in ExperimentalHandOff. |
Rendering.GuidedLighting.ScreenTrace.RelativeThickness | 0.005 | Relative depth thickness (plus 2 mm) for candidate hits in ExperimentalHandOff. |
Rendering.GuidedLighting.ScreenTrace.Pullback | 0.05 | Pullback distance in metres before starting the handed-off world ray. |
Rendering.GuidedLighting.RayBias | 0.02 | Shadow ray origin offset along the ray direction in metres. |
Rendering.GuidedLighting.NormalBias | 0.02 | Shadow ray origin offset along the geometric normal in metres. |
Built-in denoiser
| CVar | Default | Description |
|---|---|---|
Rendering.GuidedLighting.Denoiser | 0 | 0 = built-in temporal + spatial, 1 = NRD ReLAX, 2 = off (raw signal). |
Rendering.GuidedLighting.Denoise.MaxHistory | 32.0 | Maximum accumulated temporal history frames (built-in and NRD). |
Rendering.GuidedLighting.Denoise.ClipSigma | 1.0 | Variance-clipping half-width in standard deviations on moving pixels (1.5× when still). |
Rendering.GuidedLighting.Denoise.SpatialPasses | 3 | Edge-aware wavelet iterations (0–5; 0 runs a single sparse 8-tap kernel on noisy/young pixels). |
Rendering.GuidedLighting.Denoise.Profile | 0 | Output profile: 0 = Auto, 1 = Temporal AA, 2 = Standalone. |
Rendering.GuidedLighting.Denoise.Stabilizer | true | Enables the 4-frame post-spatial stabilizer in Standalone mode. |
Rendering.GuidedLighting.Denoise.SpatialGate | false | Opt-in: runs wavelet passes only on noisy or young-history 8×8 tiles (plus 1-tile halo). |
Rendering.GuidedLighting.Denoise.SpatialGateConfidence | 0.2 | Smoothed confidence threshold at or below which a deviating pixel triggers the spatial gate. |
Rendering.GuidedLighting.Denoise.SpatialGateDeviation | 0.5 | Relative frame-to-frame luminance deviation threshold for the spatial gate. |
Rendering.GuidedLighting.Denoise.SpatialThreshold | 0.02 | Relative variance above which converged pixels are spatially filtered. |
Rendering.GuidedLighting.Denoise.FireflyClamp | 4.0 | Standard-deviation cap on bright outliers while history is under 8 frames (0.0 = off). |
Rendering.GuidedLighting.Denoise.Confidence | true | Uses per-pixel shading confidence to accelerate temporal convergence. |
NRD ReLAX denoiser
| CVar | Default | Description |
|---|---|---|
Rendering.GuidedLighting.RatioEstimator | true | Denoises the shadowed ratio E / U and multiplies by exact unshadowed light U afterwards. |
Rendering.GuidedLighting.NRD.HistoryConfidence | true | Feeds light-change and visibility-change signals into NRD ReLAX history confidence. |
Rendering.GuidedLighting.NRD.MinHistory | 0.0 | Minimum frames of NRD history kept after a known change. |
Rendering.GuidedLighting.NRD.HistoryFixFrames | 3 | Frames after a reset (0–3) rebuilt with NRD's sparse 5×5 history-fix kernel. |
Rendering.GuidedLighting.NRD.HistoryFixStride | 14 | Pixel stride of NRD's history-fix kernel. |
Rendering.GuidedLighting.NRD.FastHistory | 6 | Frames in NRD ReLAX's fast history window. |
Rendering.GuidedLighting.NRD.AntiFirefly | true | Enables NRD ReLAX anti-firefly filtering. |
Rendering.GuidedLighting.NRD.PrepassDiffuseRadius | 15.0 | Diffuse pre-pass blur radius in pixels. |
Rendering.GuidedLighting.NRD.PrepassSpecularRadius | 25.0 | Specular pre-pass blur radius in pixels. |
Rendering.GuidedLighting.NRD.AtrousIterations | 4 | A-trous iterations (2–8). Presets: 3 Low, 4 Medium, 5 High/Max, 2 Mobile. |
Rendering.GuidedLighting.NRD.Specular | true | Denoises specular in NRD ReLAX (false runs diffuse-only and composites raw specular). |
Shadow-map suppression, reference, and debug
| CVar | Default | Description |
|---|---|---|
Rendering.GuidedLighting.SuppressShadowMaps | true | Suppresses local shadow maps after 4 valid frames when no classic-loop receiver needs them. |
Rendering.GuidedLighting.FogShadowMaps | true | Keeps shadow maps for local lights with VolumetricIntensity > 0 when fog/VDB volumes are active. |
Rendering.GuidedLighting.AreaSamples | 4 | Stratified emitter rays per light in the reference path (4 in all presets). |
Rendering.GuidedLighting.Reference | false | Runs the brute-force reference path (every light in range shadowed every frame). |
Rendering.GuidedLighting.Accumulate | false | Averages stationary guided frames up to ReferenceMaxFrames to verify convergence. |
Rendering.GuidedLighting.ReferenceMaxFrames | 1024 | Maximum stationary frames averaged by Reference or Accumulate (1 = no accumulation). |
Rendering.GuidedLighting.ComplexityScale | 32.0 | Light count mapped to the top of the GuidedLightingLightComplexity colour ramp. |
Rendering.GuidedLighting.LogStats | false | Prints guided lighting stats to the console once per second. |
Rendering.GuidedLighting.Debug.CompareReference | false | Runs the reference pass alongside guided lighting and computes NoiseError, FlickerError, and LagError. |
Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
Renderer/GuidedLighting/Status is not "Active" and lights still use classic shadow maps | Rendering.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 1 | SuppressShadowMaps 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 appear | HiddenCandidates, 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 Off | Denoise.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): SupportsplPointLightRenderData,plSpotLightRenderData,plRectLightRenderData,plDiskLightRenderData, andplCylinderLightRenderData.PartitionGuidedLightspartitions cluster lists into[0, GuidedCount)and[GuidedCount, TotalCount).GetDirectLightingClusterSubRange()andShouldSkipClusteredLight()inData/Base/Shaders/Common/DirectLightingComposite.hskip guided lights onceGDL_COVERAGE_GATE_OPENis written toGDL_COVERAGE_GATEand pixels carryGDL_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 packsGDL_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, andGDL_SAMPLE_HANDOFF_BITS = 7; word 1 storesGDL_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 inR11G11B10Float(orRGBA16Ffallback). - 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.