BabylonJS/Babylon.js · error · Error

FrameGraphSSAO2BlurTask "${this.name}": sourceTexture and de

Error message

FrameGraphSSAO2BlurTask "${this.name}": sourceTexture and depthTexture are required

What it means

FrameGraphSSAO2BlurTask.record() requires sourceTexture (the SSAO term to blur) and depthTexture (used for depth-aware blurring); either being undefined aborts recording. The depth texture is also switched to bilinear sampling mode as part of setup.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.ts:29

    public depthTexture: FrameGraphTextureHandle;

    constructor(
        name: string,
        frameGraph: FrameGraph,
        private _isHorizontal: boolean,
        thinPostProcess?: ThinSSAO2BlurPostProcess
    ) {
        super(name, frameGraph, thinPostProcess || new ThinSSAO2BlurPostProcess(name, frameGraph.engine, _isHorizontal));
    }

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

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

        const pass = super.record(
            skipCreationOfDisabledPasses,
            (context) => {
                context.setTextureSamplingMode(this.depthTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);
            },
            (context) => {
                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "depthSampler", this.depthTexture);
            }
        );

        this.postProcess.textureSize = this._isHorizontal ? this._outputWidth : this._outputHeight;

        return pass;
    }
}

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Assign task.sourceTexture to the SSAO2 render task's output texture.
  2. Assign task.depthTexture to the matching depth texture handle.
  3. Add the SSAO2 render task to the graph before the blur task.
  4. Confirm both assignments survive any dynamic reconfiguration of the graph.

Example fix

// before
const blur = new FrameGraphSSAO2BlurTask(frameGraph, "ssaoBlur");
frameGraph.addTask(blur);

// after
const blur = new FrameGraphSSAO2BlurTask(frameGraph, "ssaoBlur");
blur.sourceTexture = ssaoRenderTask.outputTexture;
blur.depthTexture = depthTask.outputTexture;
frameGraph.addTask(blur);
Defensive patterns

Strategy: validation

Validate before calling

if (blurTask.sourceTexture === undefined || blurTask.depthTexture === undefined) {
  throw new Error("SSAO2 blur task missing sourceTexture/depthTexture before build");
}

Type guard

function hasSSAO2BlurInputs(t: { sourceTexture?: unknown; depthTexture?: unknown }): boolean {
  return t.sourceTexture !== undefined && t.depthTexture !== undefined;
}

Try / catch

try {
  frameGraph.build();
} catch (e) {
  if (String(e?.message).includes("sourceTexture and depthTexture are required")) {
    console.error("SSAO2 blur task not wired:", e.message);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Adding an SSAO2 blur task between the SSAO render and combine tasks without assigning task.sourceTexture or task.depthTexture before build()/render.

Common situations: Manually assembling the SSAO2 pipeline (render -> blur -> combine) and skipping the blur task wiring; depth texture handle coming from a different camera/task than the SSAO output; graph refactors that renamed upstream tasks.

Related errors


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