BabylonJS/Babylon.js · error · Error

FrameGraphBloomMergeTask "${this.name}": sourceTexture and b

Error message

FrameGraphBloomMergeTask "${this.name}": sourceTexture and blurTexture are required

What it means

FrameGraphBloomMergeTask merges the source image with a blurred bloom texture, requiring both sourceTexture and blurTexture inputs. record() throws when either handle is undefined.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/bloomMergeTask.ts:23

/**
 * @internal
 */
export class FrameGraphBloomMergeTask extends FrameGraphPostProcessTask {
    public blurTexture: FrameGraphTextureHandle;

    public override readonly postProcess: ThinBloomMergePostProcess;

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

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

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

        const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
            context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "bloomBlur", this.blurTexture);
        });

        pass.addDependencies(this.blurTexture);

        return pass;
    }
}

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Assign task.sourceTexture to the original scene/source texture handle.
  2. Assign task.blurTexture to the output of the bloom blur (upsampled) task.
  3. Verify the bloom blur task is recorded before the merge task in the graph.

Example fix

// before
bloomMergeTask.sourceTexture = sceneColorTask.output;
context.build();
// after
bloomMergeTask.sourceTexture = sceneColorTask.output;
bloomMergeTask.blurTexture = bloomUpsampleTask.output;
context.build();
Defensive patterns

Strategy: validation

Validate before calling

if (bloomMergeTask.sourceTexture === undefined || bloomMergeTask.blurTexture === undefined) {
  throw new Error("BloomMergeTask requires sourceTexture and blurTexture");
}

Type guard

function isBloomMergeReady(task: FrameGraphBloomMergeTask): boolean {
  return task.sourceTexture !== undefined && task.blurTexture !== undefined;
}

Try / catch

try {
  bloomMergeTask.record();
} catch (e) {
  if (String(e).includes("sourceTexture and blurTexture are required")) {
    console.error("Ensure the bloom blur task runs before the merge task and its output is bound");
  } else throw e;
}

Prevention

When it happens

Trigger: bloomMergeTask.record() with task.sourceTexture === undefined or task.blurTexture === undefined.

Common situations: Using the merge task standalone without the accompanying bloom (downsample/upsample) task that produces blurTexture; failing to link the blur task's output; reordering tasks so inputs are wired after record().

Related errors


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