{"record":{"id":"e3000bf9fb687d71","repo":"BabylonJS/Babylon.js","slug":"framegraphmotionblurtask-this-name-depthtext","errorCode":null,"errorMessage":"FrameGraphMotionBlurTask \"${this.name}\": depthTexture is required for screen-based motion blur","messagePattern":"FrameGraphMotionBlurTask \"(.+?)\": depthTexture is required for screen-based motion blur","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/PostProcesses/motionBlurTask.ts","lineNumber":52,"sourceCode":"        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\n\r\n        this.postProcess.textureWidth = this._sourceWidth;\r\n        this.postProcess.textureHeight = this._sourceHeight;\r\n\r\n        return pass;\r\n    }\r\n}\r\n","sourceCodeStart":34,"sourceCodeEnd":65,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/PostProcesses/motionBlurTask.ts#L34-L65","documentation":"Thrown from the bindings callback of FrameGraphMotionBlurTask.record() when the post-process is in screen-based mode (isObjectBased === false) but depthTexture is undefined. Screen-based motion blur reconstructs motion from the depth buffer, so a depth texture must be bound.","triggerScenarios":"Configuring the motion blur post-process for screen-based mode and building/rendering the graph without assigning task.depthTexture to a depth texture handle.","commonSituations":"Switching from object-based to screen-based mode and leaving the velocity texture wired instead of the depth texture; forgetting to add a depth-producing task (prepass/depth renderer) to the graph; samples copied across Babylon versions where defaults changed.","solutions":["Assign task.depthTexture to a depth texture handle (e.g. from a depth prepass task).","Alternatively switch the post-process to object-based mode if you meant to use velocity textures.","Ensure the depth-producing task is added to the frame graph before the motion blur task.","Confirm isObjectBased matches which texture (velocity vs depth) you actually wired."],"exampleFix":"// before\nconst mb = new FrameGraphMotionBlurTask(frameGraph, \"motionBlur\");\nmb.postProcess.screenBased = true;\nmb.sourceTexture = colorTask.outputTexture;\n// no depth wired\n\n// after\nconst mb = new FrameGraphMotionBlurTask(frameGraph, \"motionBlur\");\nmb.postProcess.screenBased = true;\nmb.sourceTexture = colorTask.outputTexture;\nmb.depthTexture = depthPrepassTask.outputTexture;","handlingStrategy":"validation","validationCode":"if (!mbTask.postProcess.isObjectBased && mbTask.depthTexture === undefined) {\n  throw new Error(\"Screen-based motion blur requires depthTexture before build\");\n}","typeGuard":"function depthWiredForMode(t: { postProcess: { isObjectBased: boolean }; depthTexture?: unknown }): boolean {\n  return t.postProcess.isObjectBased || t.depthTexture !== undefined;\n}","tryCatchPattern":"try {\n  frameGraph.build();\n} catch (e) {\n  if (String(e?.message).includes(\"depthTexture is required for screen-based motion blur\")) {\n    console.error(\"Wire a depth texture or switch to object-based mode:\", e.message);\n  } else { throw e; }\n}","preventionTips":["When switching to screen-based mode, re-check which textures are wired.","Ensure a depth prepass task exists in the graph for screen-based blur.","Pair every mode flag change with the corresponding texture assignment in the same commit."],"tags":["babylonjs","frame-graph","motion-blur","depth-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"}