BabylonJS/Babylon.js · error · Error
FrameGraphHighlightLayerTask "${this.name}": objectRendererT
Error message
FrameGraphHighlightLayerTask "${this.name}": objectRendererTask must have a depthTexture input What it means
FrameGraphHighlightLayerTask renders highlighted outlines using stencil; it requires the associated object renderer task to have a depthTexture input, and that depth texture must have a stencil aspect. record() throws if the objectRendererTask has no depthTexture.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/Layers/highlightLayerTask.ts:44
super(
name,
frameGraph,
scene,
new ThinHighlightLayer(name, scene, options, true),
1,
alphaBlendingMode === Constants.ALPHA_COMBINE ? FrameGraphBaseLayerBlurType.Glow : FrameGraphBaseLayerBlurType.Standard,
true,
true
);
}
public override getClassName(): string {
return "FrameGraphHighlightLayerTask";
}
public override record() {
if (!this.objectRendererTask.depthTexture) {
throw new Error(`FrameGraphHighlightLayerTask "${this.name}": objectRendererTask must have a depthTexture input`);
}
const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.objectRendererTask.depthTexture);
if (!depthTextureCreationOptions.options.formats || !HasStencilAspect(depthTextureCreationOptions.options.formats[0])) {
throw new Error(`FrameGraphHighlightLayerTask "${this.name}": objectRendererTask depthTexture must have a stencil aspect`);
}
super.record();
this.layer._mainObjectRendererRenderPassId = this.objectRendererTask.objectRenderer.renderPassId;
}
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Set objectRendererTask.depthTexture to a depth (D24S8/D32S8) texture before the highlight layer records
- Ensure the depth texture creation options include a stencil aspect (see the related stencil error thrown right after)
- Connect the object renderer block's depth output to the highlight layer block as required
Example fix
// before
const layerTask = new FrameGraphHighlightLayerTask("hl", context);
layerTask.objectRendererTask = objRendererTask; // depthTexture unset
// after
objRendererTask.depthTexture = depthTextureHandle; // D24S8
layerTask.objectRendererTask = objRendererTask; Defensive patterns
Strategy: validation
Validate before calling
if (!layerTask.objectRendererTask?.depthTexture) {
throw new Error('highlight layer objectRendererTask must have a depthTexture');
} Type guard
function hasDepthTexture(t) { return !!t.depthTexture; } Try / catch
try { layerTask.record(); } catch (e) { if (e.message.includes('must have a depthTexture input')) { console.error('Assign a depth texture (with stencil) to the object renderer'); } else { throw e; } } Prevention
- Always create object renderers for highlight layers with a depth texture
- Ensure the depth texture format includes stencil (D24S8/D32S8) for highlights
- Validate the renderer's depthTexture before building layer tasks
When it happens
Trigger: Building a frame graph where a highlight layer task references an objectRendererTask whose depthTexture input was never set.
Common situations: Using a plain object renderer without a depth texture attached; configuring the highlight layer before wiring the depth input; swapping in a renderer block that omits depth.
Related errors
- ${this.constructor.name} "${this.name}": targetTexture and o
- SSR post process "${this.name}": Automatic thickness computa
- FrameGraphHighlightLayerTask "${this.name}": objectRendererT
- FrameGraphSelectionOutlineLayerTask "${this.name}": depthTex
- FrameGraphCullObjectsTask ${this.name}: objectList and camer
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/15e8a2f649bb1e76.
Report an issue: GitHub.