BabylonJS/Babylon.js · error · Error

FrameGraphSSRTask "${this.name}": sourceTexture, normalTextu

Error message

FrameGraphSSRTask "${this.name}": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required

What it means

FrameGraphSSRTask.record() validates that sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are all assigned before recording the SSR post-process task. The task feeds these into its underlying post-process, and any undefined input means the pass cannot be built, so the library throws a descriptive error up front. This mirrors the same fail-fast contract as the other frame graph post-process tasks.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/ssrTask.ts:38

    public override readonly postProcess: ThinSSRPostProcess;

    constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinSSRPostProcess) {
        super(name, frameGraph, thinPostProcess || new ThinSSRPostProcess(name, frameGraph.scene));
    }

    public override getClassName(): string {
        return "FrameGraphSSRTask";
    }

    public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {
        if (
            this.sourceTexture === undefined ||
            this.normalTexture === undefined ||
            this.depthTexture === undefined ||
            this.reflectivityTexture === undefined ||
            this.camera === undefined
        ) {
            throw new Error(`FrameGraphSSRTask "${this.name}": sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera are required`);
        }

        const pass = super.record(
            skipCreationOfDisabledPasses,
            (context) => {
                this.postProcess.camera = this.camera;

                context.setTextureSamplingMode(this.normalTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
                context.setTextureSamplingMode(this.depthTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
                context.setTextureSamplingMode(this.reflectivityTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
                if (this.backDepthTexture) {
                    context.setTextureSamplingMode(this.backDepthTexture, Constants.TEXTURE_NEAREST_SAMPLINGMODE);
                }
            },
            (context) => {
                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "normalSampler", this.normalTexture);
                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "depthSampler", this.depthTexture);
                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "reflectivitySampler", this.reflectivityTexture);

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Assign all five inputs before build(): sourceTexture, normalTexture, depthTexture, reflectivityTexture and camera
  2. Ensure upstream texture-producing tasks are added to the frame graph before the SSR task and link their output texture handles
  3. Set task.camera to the active/render camera
  4. Add a pre-record assertion loop that checks each required property and logs which is missing

Example fix

// before
const ssrTask = new FrameGraphSSRTask("ssr", frameGraph, { thickness: 1 });
frameGraph.addTask(ssrTask);
frameGraph.build(); // throws: required inputs undefined

// after
ssrTask.sourceTexture = colorTask.outputTexture;
ssrTask.normalTexture = normalTask.outputTexture;
ssrTask.depthTexture = depthTask.outputTexture;
ssrTask.reflectivityTexture = reflectivityTask.outputTexture;
ssrTask.camera = frameGraph.scene.activeCamera;
frameGraph.build();
Defensive patterns

Strategy: validation

Validate before calling

const required = { sourceTexture: ssrTask.sourceTexture, normalTexture: ssrTask.normalTexture, depthTexture: ssrTask.depthTexture, reflectivityTexture: ssrTask.reflectivityTexture, camera: ssrTask.camera };
const missing = Object.entries(required).filter(([, v]) => v === undefined).map(([k]) => k);
if (missing.length) throw new Error(`SSR task missing inputs: ${missing.join(", ")}`);

Type guard

function hasSSRTaskInputs(t) { return t.sourceTexture !== undefined && t.normalTexture !== undefined && t.depthTexture !== undefined && t.reflectivityTexture !== undefined && t.camera !== undefined; }

Try / catch

try { frameGraph.build(); } catch (e) { if (String(e.message).includes("FrameGraphSSRTask")) { console.error("SSR task missing required inputs — check texture wiring and camera"); } else { throw e; } }

Prevention

When it happens

Trigger: Calling record() on a FrameGraphSSRTask (directly or via FrameGraph.build()) when any of the five required inputs — sourceTexture, normalTexture, depthTexture, reflectivityTexture, camera — is undefined because the caller never assigned them from upstream task outputs / the scene camera.

Common situations: Adding the SSR task to the graph before the tasks producing depth/normal/reflectivity textures exist; forgetting to bind the reflectivity texture; omitting camera assignment; migrating from SSRRenderingPipeline (which auto-wired scene textures) to the frame graph version which requires explicit wiring.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/e3b0bd2548562611. Report an issue: GitHub.