BabylonJS/Babylon.js · error · Error
FrameGraphMotionBlurTask "${this.name}": depthTexture is req
Error message
FrameGraphMotionBlurTask "${this.name}": depthTexture is required for screen-based motion blur What it means
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.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/motionBlurTask.ts:52
return "FrameGraphMotionBlurTask";
}
public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {
if (this.sourceTexture === undefined) {
throw new Error(`FrameGraphMotionBlurTask "${this.name}": sourceTexture is required`);
}
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
if (this.velocityTexture) {
context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "velocitySampler", this.velocityTexture);
} else if (this.postProcess.isObjectBased) {
throw new Error(`FrameGraphMotionBlurTask "${this.name}": velocityTexture is required for object-based motion blur`);
}
if (this.depthTexture) {
context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "depthSampler", this.depthTexture);
} else if (!this.postProcess.isObjectBased) {
throw new Error(`FrameGraphMotionBlurTask "${this.name}": depthTexture is required for screen-based motion blur`);
}
});
pass.addDependencies(this.velocityTexture);
pass.addDependencies(this.depthTexture);
this.postProcess.textureWidth = this._sourceWidth;
this.postProcess.textureHeight = this._sourceHeight;
return pass;
}
}
View on GitHub (pinned to 0592b347b8)
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.
Example fix
// before const mb = new FrameGraphMotionBlurTask(frameGraph, "motionBlur"); mb.postProcess.screenBased = true; mb.sourceTexture = colorTask.outputTexture; // no depth wired // after const mb = new FrameGraphMotionBlurTask(frameGraph, "motionBlur"); mb.postProcess.screenBased = true; mb.sourceTexture = colorTask.outputTexture; mb.depthTexture = depthPrepassTask.outputTexture;
Defensive patterns
Strategy: validation
Validate before calling
if (!mbTask.postProcess.isObjectBased && mbTask.depthTexture === undefined) {
throw new Error("Screen-based motion blur requires depthTexture before build");
} Type guard
function depthWiredForMode(t: { postProcess: { isObjectBased: boolean }; depthTexture?: unknown }): boolean {
return t.postProcess.isObjectBased || t.depthTexture !== undefined;
} Try / catch
try {
frameGraph.build();
} catch (e) {
if (String(e?.message).includes("depthTexture is required for screen-based motion blur")) {
console.error("Wire a depth texture or switch to object-based mode:", e.message);
} else { throw e; }
} Prevention
- 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.
When it happens
Trigger: Configuring the motion blur post-process for screen-based mode and building/rendering the graph without assigning task.depthTexture to a depth texture handle.
Common situations: 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.
Related errors
- FrameGraphMotionBlurTask "${this.name}": sourceTexture is re
- FrameGraphMotionBlurTask "${this.name}": velocityTexture is
- FrameGraphDepthOfFieldBlurTask "${this.name}": sourceTexture
- FrameGraphBloomMergeTask "${this.name}": sourceTexture, circ
- FrameGraphDepthOfFieldTask: sourceTexture, depthTexture and
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/e3000bf9fb687d71.
Report an issue: GitHub.