{"record":{"id":"1a231dbfce2d6f90","repo":"BabylonJS/Babylon.js","slug":"framegraphcircleofconfusiontask-this-name-so","errorCode":null,"errorMessage":"FrameGraphCircleOfConfusionTask \"${this.name}\": sourceTexture, depthTexture and camera are required","messagePattern":"FrameGraphCircleOfConfusionTask \"(.+?)\": sourceTexture, depthTexture and camera are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.ts","lineNumber":44,"sourceCode":"    public override readonly postProcess: ThinCircleOfConfusionPostProcess;\r\n\r\n    /**\r\n     * Constructs a new circle of confusion task.\r\n     * @param name The name of the task.\r\n     * @param frameGraph The frame graph this task belongs to.\r\n     * @param thinPostProcess The thin post process to use for the task. If not provided, a new one will be created.\r\n     */\r\n    constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinCircleOfConfusionPostProcess) {\r\n        super(name, frameGraph, thinPostProcess || new ThinCircleOfConfusionPostProcess(name, frameGraph.engine));\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphCircleOfConfusionTask\";\r\n    }\r\n\r\n    public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n        if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {\r\n            throw new Error(`FrameGraphCircleOfConfusionTask \"${this.name}\": sourceTexture, depthTexture and camera are required`);\r\n        }\r\n\r\n        const pass = super.record(\r\n            skipCreationOfDisabledPasses,\r\n            (context) => {\r\n                this.postProcess.camera = this.camera;\r\n                context.setTextureSamplingMode(this.depthTexture, this.depthSamplingMode);\r\n            },\r\n            (context) => {\r\n                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"depthSampler\", this.depthTexture);\r\n            }\r\n        );\r\n\r\n        pass.addDependencies(this.depthTexture);\r\n\r\n        return pass;\r\n    }\r\n}\r","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.ts#L26-L62","documentation":"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.","triggerScenarios":"circleOfConfusionTask.record() with task.sourceTexture === undefined, task.depthTexture === undefined, or task.camera === undefined.","commonSituations":"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.","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."],"exampleFix":"// before\nconst cocTask = new FrameGraphCircleOfConfusionTask(\"coc\", context);\ncocTask.sourceTexture = sceneColorTask.output;\ncontext.build();\n// after\nconst cocTask = new FrameGraphCircleOfConfusionTask(\"coc\", context);\ncocTask.sourceTexture = sceneColorTask.output;\ncocTask.depthTexture = depthTask.output;\ncocTask.camera = cameraTask.output;\ncontext.build();","handlingStrategy":"validation","validationCode":"if (cocTask.sourceTexture === undefined || cocTask.depthTexture === undefined || cocTask.camera === undefined) {\n  throw new Error(\"CircleOfConfusionTask requires sourceTexture, depthTexture and camera\");\n}","typeGuard":"function isCoCReady(task: FrameGraphCircleOfConfusionTask): boolean {\n  return task.sourceTexture !== undefined && task.depthTexture !== undefined && task.camera !== undefined;\n}","tryCatchPattern":"try {\n  cocTask.record();\n} catch (e) {\n  if (String(e).includes(\"sourceTexture, depthTexture and camera are required\")) {\n    console.error(\"Wire color, depth and camera outputs before recording the DoF chain\");\n  } else throw e;\n}","preventionTips":["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."],"tags":["frame-graph","post-process","depth-of-field","missing-input"],"backgroundTag":"required-input-missing","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}