BabylonJS/Babylon.js · error · Error
FrameGraphCircleOfConfusionTask "${this.name}": sourceTextur
Error message
FrameGraphCircleOfConfusionTask "${this.name}": sourceTexture, depthTexture and camera are required What it means
FrameGraphCircleOfConfusionTask computes the circle-of-confusion for depth of field from a color source, scene depth, and camera parameters (aperture/focus). record() throws if any of sourceTexture, depthTexture, or camera is undefined.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.ts:44
public override readonly postProcess: ThinCircleOfConfusionPostProcess;
/**
* Constructs a new circle of confusion task.
* @param name The name of the task.
* @param frameGraph The frame graph this task belongs to.
* @param thinPostProcess The thin post process to use for the task. If not provided, a new one will be created.
*/
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinCircleOfConfusionPostProcess) {
super(name, frameGraph, thinPostProcess || new ThinCircleOfConfusionPostProcess(name, frameGraph.engine));
}
public override getClassName(): string {
return "FrameGraphCircleOfConfusionTask";
}
public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {
if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {
throw new Error(`FrameGraphCircleOfConfusionTask "${this.name}": sourceTexture, depthTexture and camera are required`);
}
const pass = super.record(
skipCreationOfDisabledPasses,
(context) => {
this.postProcess.camera = this.camera;
context.setTextureSamplingMode(this.depthTexture, this.depthSamplingMode);
},
(context) => {
context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "depthSampler", this.depthTexture);
}
);
pass.addDependencies(this.depthTexture);
return pass;
}
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Assign task.sourceTexture to the scene color output handle.
- Assign task.depthTexture to a depth texture with appropriate format output by a preceding task.
- Assign task.camera to the camera task output before record().
- Confirm task ordering so all three producer tasks are recorded first.
Example fix
// before
const cocTask = new FrameGraphCircleOfConfusionTask("coc", context);
cocTask.sourceTexture = sceneColorTask.output;
context.build();
// after
const cocTask = new FrameGraphCircleOfConfusionTask("coc", context);
cocTask.sourceTexture = sceneColorTask.output;
cocTask.depthTexture = depthTask.output;
cocTask.camera = cameraTask.output;
context.build(); Defensive patterns
Strategy: validation
Validate before calling
if (cocTask.sourceTexture === undefined || cocTask.depthTexture === undefined || cocTask.camera === undefined) {
throw new Error("CircleOfConfusionTask requires sourceTexture, depthTexture and camera");
} Type guard
function isCoCReady(task: FrameGraphCircleOfConfusionTask): boolean {
return task.sourceTexture !== undefined && task.depthTexture !== undefined && task.camera !== undefined;
} Try / catch
try {
cocTask.record();
} catch (e) {
if (String(e).includes("sourceTexture, depthTexture and camera are required")) {
console.error("Wire color, depth and camera outputs before recording the DoF chain");
} else throw e;
} Prevention
- Assign all three inputs (color, depth, camera) in one setup block for DoF tasks.
- Ensure the depth texture producer task is recorded before the CoC task.
- Use a shared depth-of-field pipeline helper so inputs cannot be partially wired.
When it happens
Trigger: circleOfConfusionTask.record() with task.sourceTexture === undefined, task.depthTexture === undefined, or task.camera === undefined.
Common situations: Wiring a DoF pipeline and omitting the depth input; forgetting to assign the camera handle used for focus distance; reusing setup code from a simpler post-process that only needs a source texture.
Related errors
- FrameGraphAnaglyphTask "${this.name}": sourceTexture and lef
- FrameGraphBloomMergeTask "${this.name}": sourceTexture and b
- FrameGraphBloomTask: sourceTexture is required
- FrameGraphSSAO2Task "${this.name}": sourceTexture, depthText
- FrameGraphSelectionOutlineLayerTask "${this.name}": depthTex
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/1a231dbfce2d6f90.
Report an issue: GitHub.