mrdoob/three.js · error · Error
THREE.ReflectorNode: Depth node can only be requested when t
Error message
THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. What it means
Thrown by ReflectorNode.getDepthNode() when depth is requested but the underlying reflector base was not created with `{ depth: true }`. The reflector only allocates a depth render target when depth is enabled at construction; without it there is no depth texture to expose.
Source
Thrown at src/nodes/utils/ReflectorNode.js:132
get target() {
return this._reflectorBaseNode.target;
}
/**
* Returns a node representing the mirror's depth. That can be used
* to implement more advanced reflection effects like distance attenuation.
*
* @return {Node} The depth node.
*/
getDepthNode() {
if ( this._depthNode === null ) {
if ( this._reflectorBaseNode.depth !== true ) {
throw new Error( 'THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ' );
}
this._depthNode = new ReflectorNode( {
defaultTexture: _defaultRT.depthTexture,
reflector: this._reflectorBaseNode
} );
}
return this._depthNode;
}
setup( builder ) {
// ignore if used in post-processing
if ( ! builder.object.isQuadMesh ) this._reflectorBaseNode.build( builder );View on GitHub (pinned to da05705fa3)
Solutions
- Create the reflector with depth enabled: pass `{ depth: true }` to the reflector base/options at construction.
- Recreate the reflector with the depth option if you need depth later (it cannot be toggled post-hoc).
Example fix
// before
const reflector = reflectorNode( { } );
const depth = reflector.getDepthNode();
// after
const reflector = reflectorNode( { depth: true } );
const depth = reflector.getDepthNode(); Defensive patterns
Strategy: validation
Validate before calling
function assertReflectorDepth( reflector ) {
if ( reflector._reflectorBaseNode.depth !== true ) {
throw new Error( 'Reflector must be created with { depth: true } to use getDepthNode().' );
}
} Type guard
const reflectorHasDepth = ( reflector ) => reflector._reflectorBaseNode.depth === true;
Prevention
- Pass { depth: true } when constructing the reflector if depth effects are planned.
- Depth cannot be enabled after construction — recreate the reflector if needed.
- Gate getDepthNode() behind a depth-enabled check.
When it happens
Trigger: Calling `reflectorNode.getDepthNode()` on a reflector created via `new ReflectorNode(...)` or the reflector base without the `depth: true` option.
Common situations: Adding a depth-based reflection effect (distance attenuation, soft reflections) to an existing reflector that was created for color-only reflection; forgetting the depth option at setup time.
Related errors
- THREE.PassNode: Depth texture is not available for this pass
- THREE.WebGPURenderer: Shadow map type not supported yet.
- THREE.BatchedMesh: Maximum item count reached.
- THREE.WebGLRenderer: Attached DepthTexture is initialized to
- THREE.WebGLTextures: renderTarget.depthTexture must be an in
AI-assisted analysis of mrdoob/three.js@da05705fa3 (2026-08-12).
Data as JSON: /api/errors/dd11bdbea184e14c.
Report an issue: GitHub.