BabylonJS/Babylon.js · error · Error
FrameGraphVolumetricLightingTask "${this.name}": targetTextu
Error message
FrameGraphVolumetricLightingTask "${this.name}": targetTexture, depthTexture, camera, lightingVolumeMesh and light are required What it means
The record() method of FrameGraphVolumetricLightingTask throws when any of the required task inputs — targetTexture, depthTexture, camera, lightingVolumeMesh, or light — is still undefined. Frame graph tasks must have all their dependencies bound before the frame graph builds/records the render passes; this fail-fast check prevents recording a pass with missing resources.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.ts:237
return Promise.all([import("../../../Shaders/volumetricLightingRenderVolume.vertex"), import("../../../Shaders/volumetricLightingRenderVolume.fragment")]);
}
public override isReady() {
return (
this._renderLightingVolumeMaterial.isReady() &&
this._clearLightingVolumeTextureTask.isReady() &&
this._renderLightingVolumeMaterial.isReady() &&
this._blendLightingVolumeTask.isReady()
);
}
public override getClassName(): string {
return "FrameGraphVolumetricLightingTask";
}
public record(skipCreationOfDisabledPasses = false) {
if (this.targetTexture === undefined || this.depthTexture === undefined || this.camera === undefined || this.lightingVolumeMesh === undefined || this.light === undefined) {
throw new Error(`FrameGraphVolumetricLightingTask "${this.name}": targetTexture, depthTexture, camera, lightingVolumeMesh and light are required`);
}
if (!this.lightingVolumeMesh.meshes || this.lightingVolumeMesh.meshes.length === 0) {
throw new Error(`FrameGraphVolumetricLightingTask "${this.name}": lightingVolumeMesh is empty`);
}
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);
const textureManager = this._frameGraph.textureManager;
let lightingVolumeTexture = this.lightingVolumeTexture;
if (!lightingVolumeTexture) {
const targetTextureCreationOptions = textureManager.getTextureCreationOptions(this.targetTexture);
targetTextureCreationOptions.options.labels = ["InScattering"];
targetTextureCreationOptions.options.samples = 1;
lightingVolumeTexture = textureManager.createRenderTargetTexture(`${this.name} - lighting volume texture`, targetTextureCreationOptions);
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Assign all five required properties before record(): targetTexture, depthTexture, camera, lightingVolumeMesh, and light.
- Verify the mesh input actually has value: lightingVolumeMesh must come from frameGraph.createMeshInputValue / task.source and not be undefined.
- Ensure the light exists in the scene and is passed as a frame-graph light handle before building.
- Order your setup code so all resources (textures, camera, mesh, light) are created before frameGraph.build()/task.record().
- Log each property before recording to identify which one is undefined.
Example fix
// before task.targetTexture = frameGraph.createTexture(...); task.depthTexture = depthTexture; task.camera = camera; task.record(); // throws: light and lightingVolumeMesh missing // after task.targetTexture = frameGraph.createTexture(...); task.depthTexture = depthTexture; task.camera = camera; task.lightingVolumeMesh = frameGraph.createMeshInputValue(volumeMesh); task.light = frameGraph.createLightInputValue(sceneLight); task.record();
Defensive patterns
Strategy: validation
Validate before calling
function volumetricInputsReady(t: FrameGraphVolumetricLightingTask): boolean {
return t.targetTexture !== undefined && t.depthTexture !== undefined && t.camera !== undefined && t.lightingVolumeMesh !== undefined && t.light !== undefined;
}
if (!volumetricInputsReady(task)) throw new Error("volumetric task inputs incomplete");
task.record(); Type guard
function isBound<T>(v: T | undefined): v is T {
return v !== undefined;
} Try / catch
try {
task.record();
} catch (e) {
if ((e as Error).message.includes("are required")) {
console.error("Missing volumetric task inputs:", {
targetTexture: task.targetTexture,
depthTexture: task.depthTexture,
camera: task.camera,
lightingVolumeMesh: task.lightingVolumeMesh,
light: task.light,
});
} else throw e;
} Prevention
- Assign every required input immediately after constructing the task, before build().
- Wrap task setup in a helper function so no input can be skipped.
- Never call frameGraph.build() before all task inputs are assigned.
- Keep a checklist: targetTexture, depthTexture, camera, lightingVolumeMesh, light.
When it happens
Trigger: Calling frameGraphTask.record() (or building the frame graph) before assigning one or more of: task.targetTexture, task.depthTexture, task.camera, task.lightingVolumeMesh, task.light — e.g. forgetting to set task.lightingVolumeMesh = frameGraph.createMeshInputValue(...) or task.light = a FrameGraphLight input.
Common situations: Copy-pasting a task setup and forgetting one input; conditional code paths that skip assigning camera or light; renaming/refactoring where an assignment was dropped; building the frame graph before the scene light or mesh is created.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- FrameGraphVolumetricLightingTask "${this.name}": lightingVol
- FrameGraphCascadedShadowGeneratorTask ${this.name}: light, o
- FrameGraphObjectRendererTask ${this.name}: targetTexture, ob
- 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/ac9d25c1e8d5b9ab.
Report an issue: GitHub.