{"record":{"id":"ab03c0dfd35aba17","repo":"BabylonJS/Babylon.js","slug":"framegraphssao2task-this-name-sourcetexture","errorCode":null,"errorMessage":"FrameGraphSSAO2Task \"${this.name}\": sourceTexture, depthTexture, normalTexture and camera are required","messagePattern":"FrameGraphSSAO2Task \"(.+?)\": sourceTexture, depthTexture, normalTexture and camera are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/PostProcesses/ssao2Task.ts","lineNumber":30,"sourceCode":"    public normalTexture: FrameGraphTextureHandle;\r\n\r\n    public camera: Camera;\r\n\r\n    public override readonly postProcess: ThinSSAO2PostProcess;\r\n\r\n    private _currentCameraMode = -1;\r\n\r\n    constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinSSAO2PostProcess) {\r\n        super(name, frameGraph, thinPostProcess || new ThinSSAO2PostProcess(name, frameGraph.scene));\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphSSAO2Task\";\r\n    }\r\n\r\n    public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n        if (this.sourceTexture === undefined || this.depthTexture === undefined || this.normalTexture === undefined || this.camera === undefined) {\r\n            throw new Error(`FrameGraphSSAO2Task \"${this.name}\": sourceTexture, depthTexture, normalTexture and camera are required`);\r\n        }\r\n\r\n        this._currentCameraMode = this.camera.mode;\r\n        this.postProcess.updateEffect();\r\n\r\n        const pass = super.record(\r\n            skipCreationOfDisabledPasses,\r\n            (context) => {\r\n                this.postProcess.camera = this.camera;\r\n\r\n                if (this._currentCameraMode !== this.camera.mode) {\r\n                    this._currentCameraMode = this.camera.mode;\r\n                    this.postProcess.updateEffect();\r\n                }\r\n\r\n                context.setTextureSamplingMode(this.depthTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n                context.setTextureSamplingMode(this.normalTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n            },\r","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/PostProcesses/ssao2Task.ts#L12-L48","documentation":"FrameGraphSSAO2Task.record() validates that all required inputs were assigned before the frame graph is built. The SSAO2 post-process needs the source (color) texture, depth texture, normal texture and a camera to configure its rendering passes; if any is undefined the task cannot be recorded, so the library throws immediately instead of failing later with a confusing GPU/effect error. This is a fail-fast precondition check inside Babylon.js' frame graph system.","triggerScenarios":"Calling FrameGraphSSAO2Task.record() (directly or via FrameGraph.build()) when sourceTexture, depthTexture, normalTexture or camera was never set on the task instance, e.g. the task was added to the graph but its input properties were never assigned from texture manager handles or a camera.","commonSituations":"Building a frame graph where the SSAO2 task was wired before the source pipeline task produced its texture handles; forgetting to pass the camera when constructing the task; refactoring away from the legacy SSAO2RenderingPipeline where the pipeline grabbed scene textures automatically — frame graph tasks require explicit texture bindings; conditional code paths that skip texture assignment.","solutions":["Assign sourceTexture, depthTexture and normalTexture from the frame graph texture manager / producing task outputs before building: task.sourceTexture = ...; task.depthTexture = ...; task.normalTexture = ...;","Set task.camera to a valid Camera (e.g. frameGraph.scene.activeCamera) before record()/build()","Ensure the tasks producing the depth/normal textures are added to the graph BEFORE the SSAO2 task and their outputs linked to these inputs","Wrap the build call in try/catch and log which of the four inputs is undefined to pinpoint the missing one"],"exampleFix":"// before\nconst ssao2Task = new FrameGraphSSAO2Task(\"ssao2\", frameGraph, { samples: 16 });\nframeGraph.addTask(ssao2Task);\nframeGraph.build(); // throws: inputs undefined\n\n// after\nconst ssao2Task = new FrameGraphSSAO2Task(\"ssao2\", frameGraph, { samples: 16 });\nssao2Task.sourceTexture = mainTextureTask.outputTexture;\nssao2Task.depthTexture = depthTextureTask.outputTexture;\nssao2Task.normalTexture = normalTextureTask.outputTexture;\nssao2Task.camera = frameGraph.scene.activeCamera;\nframeGraph.addTask(ssao2Task);\nframeGraph.build();","handlingStrategy":"validation","validationCode":"// before frameGraph.build()\nconst required = { sourceTexture: ssao2Task.sourceTexture, depthTexture: ssao2Task.depthTexture, normalTexture: ssao2Task.normalTexture, camera: ssao2Task.camera };\nconst missing = Object.entries(required).filter(([, v]) => v === undefined).map(([k]) => k);\nif (missing.length) throw new Error(`SSAO2 task missing inputs: ${missing.join(\", \")}`);","typeGuard":"function hasSSAO2Inputs(t) { return t.sourceTexture !== undefined && t.depthTexture !== undefined && t.normalTexture !== undefined && t.camera !== undefined; }","tryCatchPattern":"try { frameGraph.build(); } catch (e) { if (String(e.message).includes(\"sourceTexture, depthTexture, normalTexture and camera are required\")) { console.error(\"SSAO2 task inputs not wired:\", { source: ssao2Task.sourceTexture, depth: ssao2Task.depthTexture, normal: ssao2Task.normalTexture, camera: ssao2Task.camera }); } else { throw e; } }","preventionTips":["Assign all task input properties immediately after constructing the task, before adding it to the graph","Add tasks to the graph in dependency order (producers before consumers)","Keep a small setup helper that wires every post-process task's inputs in one place","Assert required inputs before calling frameGraph.build() in debug builds"],"tags":["babylonjs","frame-graph","post-process","missing-input"],"backgroundTag":"missing-required-task-input","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}