{"record":{"id":"f1adb415d64266cd","repo":"BabylonJS/Babylon.js","slug":"framegraphmotionblurtask-this-name-sourcetex","errorCode":null,"errorMessage":"FrameGraphMotionBlurTask \"${this.name}\": sourceTexture is required","messagePattern":"FrameGraphMotionBlurTask \"(.+?)\": sourceTexture is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/PostProcesses/motionBlurTask.ts","lineNumber":39,"sourceCode":"    public override readonly postProcess: ThinMotionBlurPostProcess;\r\n\r\n    /**\r\n     * Constructs a new motion blur 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?: ThinMotionBlurPostProcess) {\r\n        super(name, frameGraph, thinPostProcess || new ThinMotionBlurPostProcess(name, frameGraph.scene));\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphMotionBlurTask\";\r\n    }\r\n\r\n    public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n        if (this.sourceTexture === undefined) {\r\n            throw new Error(`FrameGraphMotionBlurTask \"${this.name}\": sourceTexture is required`);\r\n        }\r\n\r\n        const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n            if (this.velocityTexture) {\r\n                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"velocitySampler\", this.velocityTexture);\r\n            } else if (this.postProcess.isObjectBased) {\r\n                throw new Error(`FrameGraphMotionBlurTask \"${this.name}\": velocityTexture is required for object-based motion blur`);\r\n            }\r\n\r\n            if (this.depthTexture) {\r\n                context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"depthSampler\", this.depthTexture);\r\n            } else if (!this.postProcess.isObjectBased) {\r\n                throw new Error(`FrameGraphMotionBlurTask \"${this.name}\": depthTexture is required for screen-based motion blur`);\r\n            }\r\n        });\r\n\r\n        pass.addDependencies(this.velocityTexture);\r\n        pass.addDependencies(this.depthTexture);\r","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/PostProcesses/motionBlurTask.ts#L21-L57","documentation":"FrameGraphMotionBlurTask.record() aborts immediately if sourceTexture is undefined, since no motion blur pass can run without an input color texture. This is the first of three guards in the task's record() method; the other two (velocity/depth) fire later inside the pass bindings.","triggerScenarios":"Calling frameGraph.addTask(motionBlurTask) and building/rendering the graph without ever assigning motionBlurTask.sourceTexture.","commonSituations":"Adding the motion blur task before the source render task in the graph; forgetting the assignment when copying a sample; conditional setups where the source task is skipped but the blur task is not.","solutions":["Assign task.sourceTexture a valid texture handle before build().","Add the source-producing task to the graph before the motion blur task.","Check that you are not accidentally clearing/reassigning sourceTexture after initial setup."],"exampleFix":"// before\nconst mb = new FrameGraphMotionBlurTask(frameGraph, \"motionBlur\");\nframeGraph.addTask(mb);\n\n// after\nconst mb = new FrameGraphMotionBlurTask(frameGraph, \"motionBlur\");\nmb.sourceTexture = objectRendererTask.outputTexture;\nframeGraph.addTask(mb);","handlingStrategy":"validation","validationCode":"if (mbTask.sourceTexture === undefined) {\n  throw new Error(\"Motion blur task missing sourceTexture before build\");\n}","typeGuard":"function hasMotionBlurSource(t: { sourceTexture?: unknown }): boolean {\n  return t.sourceTexture !== undefined;\n}","tryCatchPattern":"try {\n  frameGraph.build();\n} catch (e) {\n  if (String(e?.message).includes(\"sourceTexture is required\")) {\n    console.error(\"Motion blur source not wired:\", e.message);\n  } else { throw e; }\n}","preventionTips":["Assign sourceTexture immediately after constructing the task.","Add the source-producing task to the graph before the blur task.","Include task-input checks in unit tests that build the frame graph."],"tags":["babylonjs","frame-graph","motion-blur","missing-texture","configuration"],"backgroundTag":"framegraph-task-missing-texture","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}