@pmndrs/reflections
    Preparing search index...

    Class ScreenSpaceReflectionsPass

    Screen-space reflections on any three scene. Each render() renders the G-buffer, traces on the renderer's device (plus rays for the misses with trace), and copies the results into radiance, hitDistance and confidence.

    Index
    confidence: StorageTexture

    r32float: hit confidence in [0, 1]; 0 for misses, rough pixels and the background; 1 where a traced ray hit.

    gbuffer: FrameGBuffer
    historySource: Texture<unknown, TextureEventMap> | null = null

    With settings.hitColor = 'history': the texture holding last frame's image (rgba16float, render size), e.g. a render target the app draws the composite's final into after each frame, so a mirror seen in a mirror shows its own reflection (one bounce deeper per frame). Null (default): the G-buffer's lit target of the previous frame (three's lighting with its specular IBL, without our SSR). The first 'history' frame, the frame after resetHistory() and the frame after a change of hitColor or of this texture use this frame's scene colour instead.

    hitDistance: StorageTexture

    r32float: world hit distance, 0 where nothing was hit (the denoiser seam's convention).

    W77: the settings the app passed at construction (without the preset): applyReflectionsPreset returns every key a preset names to these, then to the package defaults, before applying one.

    radiance: StorageTexture

    rgba16float. rgb: confidence x hit radiance (the tracer's fallback is black, so a miss is 0 and the composite adds its own probe / environment term for 1 - confidence); w: world ray length. Rough pixels (above the threshold) and the background are 0. Traced hits: the shaded hit.

    rayTracing: boolean

    Trace rays for the misses (only does something with options.trace).

    renderer: WebGPURenderer

    Tracer settings, read every frame.

    source: StorageTexture

    r32float: what the ray-traced pass did per pixel (core RT_SOURCE): 0 untouched, 1 traced hit, 2 traced miss, 3 capped (kept the screen-space result), 4 traced hit shaded from the on-screen colour. All 0 without trace or with rayTracing off.

    Ray-traced pass settings, read every frame.

    uniforms: {
        cameraPosition: UniformNode<"vec3", Vector3>;
        cameraWorld: UniformNode<"mat4", Matrix4>;
        projectionInverse: UniformNode<"mat4", Matrix4>;
        viewProjection: UniformNode<"mat4", Matrix4>;
    } = ...

    Camera of the last render(), for composites that rebuild world positions from depth.

    Type Declaration

    • cameraPosition: UniformNode<"vec3", Vector3>
    • cameraWorld: UniformNode<"mat4", Matrix4>
    • projectionInverse: UniformNode<"mat4", Matrix4>
    • viewProjection: UniformNode<"mat4", Matrix4>

      projection x view of the traced frame (the composite projects hits for the screen-edge fade, W22).

    variance: GPUTexture | null = null

    W85 (T36): last frame's reflection variance (r32float, the denoiser's variance), for variance-guided tracing (settings.temporalVarianceGuidedTracing / varianceThreshold). HybridReflections.denoiserVariance sets it after each denoise; an app with its own denoiser can set it directly. Null: no variance, no extra rays.

    • get hitShadingSource(): "environment" | "probes" | null

      What traced hits are lit with this frame: the probes at the hit (D901) or the environment mean; null before the first traced frame.

      Returns "environment" | "probes" | null

    • get traceError(): string | null

      W89 (D5451): why the ray-traced pass is not running although a provider is attached (e.g. the device allows fewer storage buffers per shader stage than the provider + hit shading need), or null. Screen space + probes go on without it; one console warning says so. Cleared by setTraceProvider / setRaytracerHitShading.

      Returns string | null

    • get traceMode(): "full" | "half"

      W75: the mode the last trace ran in, latched once per trace(): 'full' or 'half'. HybridReflections.update() follows it, so a setting changed between render() and update() takes effect on the next frame.

      Returns "full" | "half"

    • Render the G-buffer and trace. Returns the frame's contract inputs. With a jittered camera (TAA), pass the jitter and the unjittered projection (FrameGBuffer.render, D405).

      Parameters

      • scene: Scene
      • camera: Camera
      • opts: { jitter?: readonly [number, number]; projection?: ArrayLike<number> } = {}

      Returns FrameInputs

    • W82 (T70): turn trace.raytracerHitShading on / off (or change its sample count) after attaching a provider; recompiles the traced pass on the next frame. No-op without a provider.

      Parameters

      • on: boolean | { samples?: number }

      Returns void