{"record":{"id":"392cd5e42b8e0948","repo":"BabylonJS/Babylon.js","slug":"framegraphselectionoutlinelayertask-this-name","errorCode":null,"errorMessage":"FrameGraphSelectionOutlineLayerTask \"${this.name}\": depthTexture is required","messagePattern":"FrameGraphSelectionOutlineLayerTask \"(.+?)\": depthTexture is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Layers/selectionOutlineTask.ts","lineNumber":46,"sourceCode":"     */\r\n    constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinSelectionOutlineLayerOptions) {\r\n        super(name, frameGraph, scene, new ThinSelectionOutlineLayer(name, scene, options, true), 0, FrameGraphBaseLayerBlurType.None, false, false, false);\r\n\r\n        this._objectRendererForLayerTask.objectList = {\r\n            meshes: this.layer._selection || [],\r\n            particleSystems: [],\r\n        };\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphSelectionOutlineLayerTask\";\r\n    }\r\n\r\n    public override record() {\r\n        const useDepthOcclusion = this.layer.useDepthOcclusion && this.layer.occlusionStrength > 0;\r\n\r\n        if (useDepthOcclusion && this.depthTexture === undefined) {\r\n            throw new Error(`FrameGraphSelectionOutlineLayerTask \"${this.name}\": depthTexture is required`);\r\n        }\r\n\r\n        super.record(false, (context: FrameGraphRenderContext, effect: Effect) => {\r\n            context.bindTextureHandle(effect, \"maskSampler\", this._objectRendererForLayerTask.outputTexture);\r\n            if (useDepthOcclusion) {\r\n                context.bindTextureHandle(effect, \"depthSampler\", this.depthTexture!);\r\n            }\r\n        });\r\n\r\n        this.layer.textureWidth = this._layerTextureDimensions.width;\r\n        this.layer.textureHeight = this._layerTextureDimensions.height;\r\n    }\r\n}\r\n","sourceCodeStart":28,"sourceCodeEnd":60,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Layers/selectionOutlineTask.ts#L28-L60","documentation":"FrameGraphSelectionOutlineLayerTask throws this when depth occlusion is enabled (layer.useDepthOcclusion && layer.occlusionStrength > 0) but no depthTexture handle was assigned to the task. Depth occlusion needs the scene depth to hide outlines behind occluders, so the texture is mandatory in that configuration.","triggerScenarios":"selectionOutlineTask.record() with layer.useDepthOcclusion = true (or occlusionStrength > 0) while task.depthTexture is undefined.","commonSituations":"Enabling useDepthOcclusion on the layer after building the task without wiring a depth input; forgetting the depthTexture assignment when converting from the legacy SelectionOutlineLayer; copying setup code that disabled occlusion.","solutions":["Assign a valid depth texture handle to selectionOutlineTask.depthTexture before calling record().","If occlusion is not needed, set layer.useDepthOcclusion = false (and/or occlusionStrength = 0) so the depth input becomes optional.","Ensure the depth texture comes from a preceding task output (e.g. an object renderer or main depth task) rather than being left undefined."],"exampleFix":"// before\nconst task = new FrameGraphSelectionOutlineLayerTask(\"outline\", context, layer);\nlayer.useDepthOcclusion = true;\n// after\nconst task = new FrameGraphSelectionOutlineLayerTask(\"outline\", context, layer);\ntask.depthTexture = mainObjectRendererTask.depthTexture;\nlayer.useDepthOcclusion = true;","handlingStrategy":"validation","validationCode":"if (selectionOutlineTask.layer.useDepthOcclusion && selectionOutlineTask.layer.occlusionStrength > 0 && selectionOutlineTask.depthTexture === undefined) {\n  throw new Error(\"SelectionOutline needs depthTexture when useDepthOcclusion is on\");\n}","typeGuard":"function isDepthOcclusionReady(task: FrameGraphSelectionOutlineLayerTask): boolean {\n  return !task.layer.useDepthOcclusion || task.layer.occlusionStrength <= 0 || task.depthTexture !== undefined;\n}","tryCatchPattern":"try {\n  selectionOutlineTask.record();\n} catch (e) {\n  if (String(e).includes(\"depthTexture is required\")) {\n    selectionOutlineTask.layer.useDepthOcclusion = false;\n    selectionOutlineTask.record();\n  } else throw e;\n}","preventionTips":["Wire the depth texture immediately after constructing the selection outline task.","Only enable useDepthOcclusion when a depth source is available in the graph.","Add a pre-build validation pass over all layer tasks."],"tags":["frame-graph","depth-texture","missing-input","validation"],"backgroundTag":"required-input-missing","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}