BabylonJS/Babylon.js · error · Error

FrameGraphPostProcessTask "${this.name}": sourceTexture and

Error message

FrameGraphPostProcessTask "${this.name}": sourceTexture and objectRendererTask are required

What it means

FrameGraphTAATask.record() requires sourceTexture and objectRendererTask to be set before recording; note the message is emitted with the base class name "FrameGraphPostProcessTask" but is thrown by the TAA (temporal anti-aliasing) task. TAA reprojects the previous frame's history using the object renderer's motion/jitter data, so without the source texture handle and the reference to the object renderer task the pass cannot be constructed. The library throws this precondition error at record time.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/taaTask.ts:51

    protected _initRenderingObserver: Observer<ObjectRenderer>;

    /**
     * Constructs a new Temporal Anti-Aliasing task.
     * @param name The name of the task.
     * @param frameGraph The frame graph this task is associated with.
     * @param thinPostProcess The thin post process to use for the Temporal Anti-Aliasing effect. If not provided, a new one will be created.
     */
    constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinTAAPostProcess) {
        super(name, frameGraph, thinPostProcess || new ThinTAAPostProcess(name, frameGraph.scene));
    }

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

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

        this._frameGraph.scene.onBeforeRenderObservable.remove(this._onBeforeRenderSceneObserver);
        this._onBeforeRenderSceneObserver = this._frameGraph.scene.onBeforeRenderObservable.add(() => {
            if (this.postProcess.reprojectHistory && !this.disabled) {
                this.postProcess._updateJitter();
            }
        });

        const objectRenderer = this.objectRendererTask.objectRenderer;

        objectRenderer.onInitRenderingObservable.remove(this._initRenderingObserver);
        this._initRenderingObserver = objectRenderer.onInitRenderingObservable.add(() => {
            if (!this.postProcess.reprojectHistory && !this.disabled) {
                this.postProcess._updateJitter();

                // We pass false to this.camera.getProjectionMatrix() when TAA is enabled to avoid overwriting the projection matrix calculated by the call to this.postProcess.updateJitter()
                const camera = objectRenderer.activeCamera!;

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Set taaTask.objectRendererTask to the FrameGraphObjectRendererTask instance before building
  2. Set taaTask.sourceTexture to the object renderer task's output texture handle
  3. Make sure the object renderer task is added to the frame graph before the TAA task
  4. Inspect both properties before build() to confirm neither is undefined

Example fix

// before
const taaTask = new FrameGraphTAATask("taa", frameGraph);
frameGraph.addTask(taaTask);
frameGraph.build(); // throws: sourceTexture and objectRendererTask required

// after
const objectRendererTask = new FrameGraphObjectRendererTask("renderer", frameGraph, { mesh: mesh, camera: camera });
const taaTask = new FrameGraphTAATask("taa", frameGraph);
taaTask.objectRendererTask = objectRendererTask;
taaTask.sourceTexture = objectRendererTask.outputTexture;
frameGraph.addTask(objectRendererTask);
frameGraph.addTask(taaTask);
frameGraph.build();
Defensive patterns

Strategy: validation

Validate before calling

if (taaTask.sourceTexture === undefined) throw new Error("TAA task: sourceTexture not set");
if (taaTask.objectRendererTask === undefined) throw new Error("TAA task: objectRendererTask not set");

Type guard

function hasTAAInputs(t) { return t.sourceTexture !== undefined && t.objectRendererTask !== undefined; }

Try / catch

try { frameGraph.build(); } catch (e) { if (String(e.message).includes("sourceTexture and objectRendererTask are required")) { console.error("TAA task missing sourceTexture or objectRendererTask"); } else { throw e; } }

Prevention

When it happens

Trigger: Calling record() (directly or via FrameGraph.build()) on a FrameGraphTAATask when sourceTexture is undefined or objectRendererTask (the FrameGraphObjectRendererTask instance) was never assigned.

Common situations: Creating a TAA task but forgetting to link it to the object renderer task whose frames it anti-aliases; forgetting to assign the source texture from the object renderer's output; renaming/refactoring that dropped one of the two assignments; TAA used without any object renderer in the graph at all.

Related errors


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