BabylonJS/Babylon.js · error · Error
FrameGraphDepthOfFieldBlurTask "${this.name}": sourceTexture
Error message
FrameGraphDepthOfFieldBlurTask "${this.name}": sourceTexture and circleOfConfusionTexture are required What it means
FrameGraphDepthOfFieldBlurTask.record() validates its inputs before building the render pass. It throws when either sourceTexture (the scene color to blur) or circleOfConfusionTexture (the CoC mask driving the blur radius) is still undefined. Babylon.js frame-graph tasks defer all setup to record(), so missing texture handles are only detected at that point.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.ts:25
/**
* @internal
*/
export class FrameGraphDepthOfFieldBlurTask extends FrameGraphBlurTask {
public circleOfConfusionTexture: FrameGraphTextureHandle;
public circleOfConfusionSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinDepthOfFieldBlurPostProcess) {
super(name, frameGraph, thinPostProcess || new ThinDepthOfFieldBlurPostProcess(name, frameGraph.engine, new Vector2(1, 0), 10));
}
public override getClassName(): string {
return "FrameGraphDepthOfFieldBlurTask";
}
public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {
if (this.sourceTexture === undefined || this.circleOfConfusionTexture === undefined) {
throw new Error(`FrameGraphDepthOfFieldBlurTask "${this.name}": sourceTexture and circleOfConfusionTexture are required`);
}
const pass = super.record(
skipCreationOfDisabledPasses,
(context) => {
context.setTextureSamplingMode(this.circleOfConfusionTexture, this.circleOfConfusionSamplingMode);
},
(context) => {
context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "circleOfConfusionSampler", this.circleOfConfusionTexture);
}
);
pass.addDependencies(this.circleOfConfusionTexture);
return pass;
}
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Assign task.sourceTexture to a valid texture handle before building/rendering the frame graph.
- Assign task.circleOfConfusionTexture, typically the output of a FrameGraphCircleOfConfusionTask.
- Verify task ordering so upstream tasks (CoC generation) are added before the blur task.
- Log both properties right before frameGraph.build() to confirm they are defined.
Example fix
// before const blur = new FrameGraphDepthOfFieldBlurTask(frameGraph, "dofBlur"); frameGraph.addTask(blur); // after const blur = new FrameGraphDepthOfFieldBlurTask(frameGraph, "dofBlur"); blur.sourceTexture = sceneTask.outputTexture; blur.circleOfConfusionTexture = cocTask.outputTexture; frameGraph.addTask(blur);
Defensive patterns
Strategy: validation
Validate before calling
if (blurTask.sourceTexture === undefined || blurTask.circleOfConfusionTexture === undefined) {
throw new Error("DoF blur task missing sourceTexture/circleOfConfusionTexture before build");
} Type guard
function hasDoFBlurInputs(t: { sourceTexture?: unknown; circleOfConfusionTexture?: unknown }): boolean {
return t.sourceTexture !== undefined && t.circleOfConfusionTexture !== undefined;
} Try / catch
try {
frameGraph.build();
} catch (e) {
if (String(e?.message).includes("sourceTexture and circleOfConfusionTexture are required")) {
console.error("DoF blur task not wired:", e.message);
} else { throw e; }
} Prevention
- Write a small assert helper that validates all task inputs immediately after construction.
- Keep CoC/blur/merge tasks adjacent in code so missing wiring is visible in review.
- Never call build() in a partial-graph setup path without validating every added task.
When it happens
Trigger: Calling frameGraph.addTask(new FrameGraphDepthOfFieldBlurTask(...)) and then frameGraph.build()/render without assigning task.sourceTexture or task.circleOfConfusionTexture a valid texture handle (e.g. from textureManager.createTexture or another task's output).
Common situations: Forgetting to wire the DoF chain's blur task outputs; renaming task properties after a Babylon upgrade; building the graph before upstream tasks have produced their output handles; copy-pasting a DoF setup and dropping the CoC texture assignment.
Related errors
- FrameGraphBloomMergeTask "${this.name}": sourceTexture, circ
- FrameGraphDepthOfFieldTask: sourceTexture, depthTexture and
- FrameGraphMotionBlurTask "${this.name}": sourceTexture is re
- FrameGraphPostProcessTask "${this.name}": sourceTexture or t
- FrameGraphScreenSpaceCurvatureTask "${this.name}": sourceTex
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/28934431bd953c3b.
Report an issue: GitHub.