{"record":{"id":"40baa9a6279637cb","repo":"mrdoob/three.js","slug":"three-passnode-depth-texture-is-not-available-for","errorCode":null,"errorMessage":"THREE.PassNode: Depth texture is not available for this pass.","messagePattern":"THREE\\.PassNode: Depth texture is not available for this pass\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/nodes/display/PassNode.js","lineNumber":610,"sourceCode":"\t\treturn this._mrt;\n\n\t}\n\n\t/**\n\t * Returns the texture for the given output name.\n\t *\n\t * @param {string} name - The output name to get the texture for.\n\t * @return {Texture} The texture.\n\t */\n\tgetTexture( name ) {\n\n\t\tlet texture = this._textures[ name ];\n\n\t\tif ( texture === undefined ) {\n\n\t\t\tif ( name === 'depth' ) {\n\n\t\t\t\tthrow new Error( 'THREE.PassNode: Depth texture is not available for this pass.' );\n\n\t\t\t}\n\n\t\t\tconst refTexture = this.renderTarget.texture;\n\n\t\t\ttexture = refTexture.clone();\n\t\t\ttexture.name = name;\n\n\t\t\tthis._textures[ name ] = texture;\n\n\t\t\tthis.renderTarget.textures.push( texture );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/nodes/display/PassNode.js#L592-L628","documentation":"Thrown by PassNode.getTexture('depth') when no depth texture was registered for the pass. PassNode only creates a depth texture when its scope is DEPTH or `options.depthBuffer !== false`; otherwise `_textures['depth']` is never populated. Requesting the depth output then fails.","triggerScenarios":"Creating a PassNode/post-processing pass with `depthBuffer: false` (or omitting it in a context where it defaults off) and later calling `pass.getTexture('depth')`, or using a depth-output node against a pass that was not given a depthTexture.","commonSituations":"Post-processing graphs that read depth (e.g. depth-of-field, fog, screen-space effects) wired to a pass created without depth; reusing a pass instance after toggling its depth buffer off for performance; passing a custom depthTexture that is null.","solutions":["Construct the PassNode with depth enabled: do not set `depthBuffer: false`, or pass an explicit `depthTexture` in options.","Ensure the pass scope is DEPTH if the pass exists solely to capture depth.","Before calling getTexture('depth'), check `pass.renderTarget.depthTexture !== null`."],"exampleFix":"// before\nconst pass = passNode( renderer, PassNode.COLOR, { depthBuffer: false } );\nconst depth = pass.getTexture( 'depth' );\n\n// after\nconst pass = passNode( renderer, PassNode.COLOR );\nconst depth = pass.getTexture( 'depth' );","handlingStrategy":"validation","validationCode":"function assertDepthAvailable( pass ) {\n  if ( pass.renderTarget.depthTexture === null ) {\n    throw new Error( 'PassNode has no depth texture; create it with depth enabled.' );\n  }\n}\n\n// before:\nassertDepthAvailable( pass );\nconst depth = pass.getTexture( 'depth' );","typeGuard":"const passHasDepth = ( pass ) => pass.renderTarget.depthTexture !== null;","tryCatchPattern":null,"preventionTips":["Create passes that read depth with depth enabled (no depthBuffer:false) or an explicit depthTexture.","Check renderTarget.depthTexture before calling getTexture('depth').","Keep depth requirements documented per pass in your post-processing graph."],"tags":["pass-node","post-processing","depth-texture","configuration"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}