Taos API Reference
    Preparing search index...

    Class DeferredLightingPass

    Deferred lighting pass (render-graph version).

    Samples the G-Buffer, cascade shadow maps, AO/SSGI and IBL textures, then composites direct + indirect lighting into an HDR target. The camera and light uniform buffers are persistent in the graph cache so downstream passes (composite, godray) can read them via handles.

    Hierarchy (View Summary)

    • Pass<DeferredLightingDeps, DeferredLightingOutputs>
      • DeferredLightingPass
    Index

    Properties

    name: "DeferredLightingPass" = 'DeferredLightingPass'

    Human-readable identifier used in graph node labels and error messages.

    Accessors

    Methods

    • Parameters

      • ctx: RenderContext
      • opts: { useSphericalHarmonics?: boolean; shadowFilter?: "pcss" | "vsm" } = {}
        • OptionaluseSphericalHarmonics?: boolean

          when true, the diffuse IBL term is read from order-3 SH coefficients (IblTextures.shBuffer) instead of the irradiance cube (the IBL_DIFFUSE_SH shader variant). Default false — the pass behaves exactly as before. Specular IBL is unaffected either way.

        • OptionalshadowFilter?: "pcss" | "vsm"

      Returns DeferredLightingPass

    • Put the aerial-perspective fog into curved-horizon (planet) mode. Pass the world-space position of the planet center — altitudes and the local "up" the fog uses are then measured radially from it, instead of along world +Y — so the haze stays consistent with the sky dome on a curved-horizon / floating-origin globe. In this mode fogHeight (see AerialAtmosphereParams) is interpreted as an altitude above the surface rather than a world-Y. Pass null to revert to the legacy flat-world path (the default). Update the center each frame if the origin re-anchors. Takes effect on the next updateLight.

      Parameters

      • center: { x: number; y: number; z: number } | null

      Returns void

    • Enable / configure screen-space contact shadows for the sun. A short toward-sun ray-march in the lighting shader catches the fine contact occlusion the cascade maps are too coarse to resolve (an object meeting the floor, grass on terrain). Pass null (or steps: 0) to disable — the default, in which case the march is skipped and the look is unchanged. Takes effect on the next updateLight.

      Parameters

      Returns void

    • Set the directional light cookie (gobo) — a texture projected along the sun that patterns its direct light (window blinds, leaf shade, drifting clouds). Pass null (or { texture: null }) to disable (the default). The cookie's projection axes are derived from the sun direction each frame; scale is the world size of one tile and offset scrolls it. Takes effect on the next updateLight.

      Parameters

      Returns void

    • EVSM2 sampling params (only meaningful when this pass was built with the shadowFilter: 'vsm' variant). exponent must match what DirectionalVsmPass baked the moments at; bleed is the light-bleed reduction and minVariance the acne floor. Takes effect next frame.

      Parameters

      • exponent: number
      • bleed: number
      • minVariance: number

      Returns void

    • Virtualised-clipmap (shadowMode 2) pool atlas params for the page-table indirection: slots per atlas row + atlas dimensions in texels.

      Parameters

      • cols: number
      • width: number
      • height: number

      Returns void

    • Parameters

      • ctx: RenderContext
      • dir: { x: number; y: number; z: number }
      • color: { x: number; y: number; z: number }
      • intensity: number
      • cascades: CascadeData[]
      • shadowsEnabled: boolean = true
      • debugCascades: boolean = false
      • shadowSoftness: number = 0.02
      • iblIntensity: number = 1.0

        Ambient-IBL multiplier (1 = full). Fade below 1 to dim sky ambient, e.g. at night when the baked sky panorama is still lit.

      • disableHorizonFade: boolean = false

        Skip the world-Y horizon fade on both direct and IBL contributions. Set true for scenes where the sun direction isn't aligned with world +Y at "noon" (e.g. a player walking around a sphere whose sun is pinned to the local zenith) — otherwise the lighting falls off as L.y crosses zero, even though the sun is still "up" for the player.

      • disableAerial: boolean = false

        Skip the aerial-perspective (atmospheric Rayleigh/Mie) fog applied to geometry. Set true for scenes with no atmosphere (e.g. space): the fog extinguishes blue over distance and would warm-shift distant geometry (like a planet backdrop) to red/brown.

      • OptionalsunDirection: { x: number; y: number; z: number }

        Toward-sun unit vector for aerial perspective. Defaults to -dir, which is correct when the directional light IS the sun. Hosts that swap the key light to a moon at night should pass the real sun's toward direction here so the atmospheric scattering doesn't follow the moon.

      • debugMode: number = 0

        G-buffer channel visualization (0 = off / normal lighting). See the debugMode switch in deferred_lighting.wgsl for the channel mapping.

      • minRoughness: number = 0.045

        Perceptual-roughness floor (Filament MIN_PERCEPTUAL_ROUGHNESS, ~0.045) applied in the lighting pass to suppress specular aliasing on smooth surfaces. Clamped to ≥0.04 in-shader for numerical safety.

      • multiBounceAO: boolean = true

        Apply screen-space AO per-lobe — multi-bounce GTAO (Jimenez) on the diffuse indirect term + Lagarde specular occlusion on the specular term. false reverts to the legacy flat * ao on both (the A/B comparison the ssao_test sample exposes). Default true.

      • shadowMode: number = 0

        Directional shadow mode: 0 = cascade (select by view-space depth split), 1 = clipmap / virtual-shadow-map (select by which level's box contains the receiver). Must match the cascades produced by the shadow feature.

      Returns void

    • Insert the pass into graph for one frame. Implementations call graph.addPass(name, type, b => { ... }) exactly once and use the supplied PassBuilder to declare reads, writes, transient resources, and the execute callback.

      Parameters

      • graph: RenderGraph

        Graph being built this frame.

      • deps: DeferredLightingDeps

        Pass-specific dependency record (handles, scene data, etc.).

      Returns DeferredLightingOutputs

      Pass-specific output record (typically a set of handles downstream passes will consume).