BabylonJS/Babylon.js · error · Error
FrameGraphAnaglyphTask "${this.name}": sourceTexture and lef
Error message
FrameGraphAnaglyphTask "${this.name}": sourceTexture and leftTexture are required What it means
FrameGraphAnaglyphTask combines a source image with a left-eye image to produce an anaglyph (red/cyan) post-process, so both sourceTexture and leftTexture handles must be set. record() throws if either is undefined before creating the render pass.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/anaglyphTask.ts:32
public override readonly postProcess: ThinAnaglyphPostProcess;
/**
* Constructs a new anaglyph task.
* @param name The name of the task.
* @param frameGraph The frame graph this task is associated with.
* @param thinPostProcess The thin post process to use for the anaglyph effect. If not provided, a new one will be created.
*/
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinAnaglyphPostProcess) {
super(name, frameGraph, thinPostProcess || new ThinAnaglyphPostProcess(name, frameGraph.engine));
}
public override getClassName(): string {
return "FrameGraphAnaglyphTask";
}
public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {
if (this.sourceTexture === undefined || this.leftTexture === undefined) {
throw new Error(`FrameGraphAnaglyphTask "${this.name}": sourceTexture and leftTexture are required`);
}
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
context.bindTextureHandle(this._postProcessDrawWrapper.effect!, "leftSampler", this.leftTexture);
});
pass.addDependencies(this.leftTexture);
return pass;
}
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Assign task.sourceTexture to the right/source texture handle before record().
- Assign task.leftTexture to the left-eye render target output of a left-camera task.
- Ensure both upstream tasks producing these textures are recorded before the anaglyph task.
Example fix
// before anaglyphTask.sourceTexture = rightCamTask.output; // after anaglyphTask.sourceTexture = rightCamTask.output; anaglyphTask.leftTexture = leftCamTask.output;
Defensive patterns
Strategy: validation
Validate before calling
if (anaglyphTask.sourceTexture === undefined || anaglyphTask.leftTexture === undefined) {
throw new Error("AnaglyphTask requires sourceTexture and leftTexture");
} Type guard
function isAnaglyphReady(task: FrameGraphAnaglyphTask): boolean {
return task.sourceTexture !== undefined && task.leftTexture !== undefined;
} Try / catch
try {
anaglyphTask.record();
} catch (e) {
if (String(e).includes("sourceTexture and leftTexture are required")) {
console.error("Bind both eyes' render targets before recording the anaglyph task");
} else throw e;
} Prevention
- Wire right-camera output to sourceTexture and left-camera output to leftTexture together.
- Never reuse single-camera post-process wiring for stereo tasks.
- Validate all task inputs before calling frameGraph.build().
When it happens
Trigger: anaglyphTask.record() with task.sourceTexture === undefined or task.leftTexture === undefined.
Common situations: Setting only sourceTexture and assuming the left input is optional; forgetting to wire the left-eye render target from a preceding camera/renderer task; copying a non-stereo post-process setup pattern.
Related errors
- FrameGraphBloomMergeTask "${this.name}": sourceTexture and b
- FrameGraphBloomTask: sourceTexture is required
- FrameGraphCircleOfConfusionTask "${this.name}": sourceTextur
- 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/b5c0a5707787445c.
Report an issue: GitHub.