BabylonJS/Babylon.js · error · Error

FrameGraphSSAO2RenderingPipelineTask "${this.name}": sourceT

Error message

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

What it means

The aggregate FrameGraphSSAO2RenderingPipelineTask.record() needs sourceTexture, depthTexture, normalTexture, and camera before it can configure its internal SSAO2 pipeline (render plus blur sub-tasks). Any of the four being undefined throws this error. The camera is required because SSAO sampling radii and projections derive from it.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.ts:160

        this._ssao = new FrameGraphSSAO2Task(`${name} SSAO2 main`, this._frameGraph, this.ssao._ssaoPostProcess);
        this._ssaoBlurX = new FrameGraphSSAO2BlurTask(`${name} SSAO2 Blur X`, this._frameGraph, true, this.ssao._ssaoBlurXPostProcess);
        this._ssaoBlurY = new FrameGraphSSAO2BlurTask(`${name} SSAO2 Blur Y`, this._frameGraph, false, this.ssao._ssaoBlurYPostProcess);
        this._ssaoCombine = new FrameGraphPostProcessTask(`${name} SSAO2 Combine`, this._frameGraph, this.ssao._ssaoCombinePostProcess);

        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
    }

    public override isReady() {
        return this.ssao.isReady();
    }

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

    public record(): void {
        if (this.sourceTexture === undefined || this.depthTexture === undefined || this.normalTexture === undefined || this.camera === undefined) {
            throw new Error(`FrameGraphSSAO2RenderingPipelineTask "${this.name}": sourceTexture, depthTexture, normalTexture and camera are required`);
        }

        const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);

        this._ssao.sourceTexture = this.sourceTexture;
        this._ssao.sourceSamplingMode = this.sourceSamplingMode;
        this._ssao.camera = this.camera;
        this._ssao.depthTexture = this.depthTexture;
        this._ssao.normalTexture = this.normalTexture;

        const textureSize = {
            width: Math.floor(sourceTextureDescription.size.width * this.ratioSSAO) || 1,
            height: Math.floor(sourceTextureDescription.size.height * this.ratioSSAO) || 1,
        };
        const textureCreationOptions: FrameGraphTextureCreationOptions = {
            size: textureSize,
            options: {
                createMipMaps: false,

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Set task.camera to the camera the SSAO pass should use.
  2. Set task.sourceTexture to the scene color texture handle.
  3. Set task.depthTexture and task.normalTexture to depth and normals handles from the prepass tasks.
  4. Verify all four properties are set before frameGraph.build() runs.

Example fix

// before
const ssao = new FrameGraphSSAO2RenderingPipelineTask(frameGraph, "ssao2");
ssao.sourceTexture = colorTask.outputTexture;
frameGraph.addTask(ssao);

// after
const ssao = new FrameGraphSSAO2RenderingPipelineTask(frameGraph, "ssao2");
ssao.sourceTexture = colorTask.outputTexture;
ssao.depthTexture = depthPrepassTask.outputTexture;
ssao.normalTexture = normalsPrepassTask.outputTexture;
ssao.camera = scene.activeCamera;
frameGraph.addTask(ssao);
Defensive patterns

Strategy: validation

Validate before calling

if (ssaoTask.sourceTexture === undefined || ssaoTask.depthTexture === undefined || ssaoTask.normalTexture === undefined || ssaoTask.camera === undefined) {
  throw new Error("SSAO2 pipeline task missing one of sourceTexture/depthTexture/normalTexture/camera before build");
}

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Adding FrameGraphSSAO2RenderingPipelineTask and calling record()/build without setting task.sourceTexture, task.depthTexture, task.normalTexture, or task.camera.

Common situations: Forgetting the normals or depth prepass when assembling SSAO2 in a frame graph; camera not assigned when rendering with multiple cameras; migrating from the legacy SSAO2RenderingPipeline where these were wired internally.

Related errors


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