BabylonJS/Babylon.js · error
FrameGraphShadowGeneratorTask ${this.name}: light, objectLis
Error message
FrameGraphShadowGeneratorTask ${this.name}: light, objectList and camera are required What it means
FrameGraphShadowGeneratorTask.record() requires light, objectList and camera to be configured before the underlying (legacy) ShadowGenerator's shadow map can be wired up (render list, camera binding, etc.). Any undefined among the three causes this throw.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/Rendering/shadowGeneratorTask.ts:340
/**
* Creates a new shadow generator task.
* @param name The name of the task.
* @param frameGraph The frame graph the task belongs to.
*/
constructor(name: string, frameGraph: FrameGraph) {
super(name, frameGraph);
this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
}
public override getClassName(): string {
return "FrameGraphShadowGeneratorTask";
}
public record() {
if (this.light === undefined || this.objectList === undefined || this.camera === undefined) {
throw new Error(`FrameGraphShadowGeneratorTask ${this.name}: light, objectList and camera are required`);
}
// Make sure the renderList / particleSystemList are set when FrameGraphShadowGeneratorTask.isReady() is called!
const shadowMap = this._shadowGenerator!.getShadowMap()!;
shadowMap.renderList = this.objectList.meshes;
shadowMap.particleSystemList = this.objectList.particleSystems;
const shadowTextureHandle = this._frameGraph.textureManager.importTexture(`${this.name} shadowmap`, this._shadowGenerator!.getShadowMap()!.getInternalTexture()!);
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, shadowTextureHandle);
const pass = this._frameGraph.addPass(this.name);
pass.setExecuteFunc((context) => {
if (!this.light.isEnabled() || !this.light.shadowEnabled) {
return;
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Assign task.light, task.objectList and task.camera before building the frame graph.
- Create the object list with frameGraph.createObjectList(shadowCasters) and pass it to the task.
- Ensure the light exists in the scene before constructing/recording the task.
- Guard build() until scene resources (light/camera) are ready.
Example fix
// before
const shadowTask = new FrameGraphShadowGeneratorTask('shadows', frameGraph, shadowGenerator);
frameGraph.addTask(shadowTask);
frameGraph.build();
// after
shadowTask.light = directionalLight;
shadowTask.camera = scene.activeCamera;
shadowTask.objectList = frameGraph.createObjectList(shadowCasters);
frameGraph.addTask(shadowTask);
frameGraph.build(); Defensive patterns
Strategy: validation
Validate before calling
if (task.light === undefined || task.objectList === undefined || task.camera === undefined) {
throw new Error('ShadowGeneratorTask requires light, objectList and camera');
} Type guard
function isShadowTaskConfigured(t: FrameGraphShadowGeneratorTask): boolean {
return t.light !== undefined && t.objectList !== undefined && t.camera !== undefined;
} Try / catch
try {
frameGraph.build();
} catch (e) {
if (String(e).includes('light, objectList and camera are required')) {
console.error('Configure shadow task light/objectList/camera before build');
} else throw e;
} Prevention
- Create the light before constructing the shadow generator task.
- Always create the object list of shadow casters explicitly.
- Defer frameGraph.build() until lights and cameras exist.
When it happens
Trigger: frameGraph.build()/record() runs on a shadow generator task where light, objectList or camera was never assigned; or objectList was created but never set on the task.
Common situations: Adding the shadow task before creating the light/camera; forgetting frameGraph.createObjectList for shadow casters; conditional scene setup where the light is created asynchronously after build().
Related errors
- FrameGraphLightingVolumeTask ${this.name}: shadowGenerator i
- FrameGraphSSAO2Task "${this.name}": sourceTexture, depthText
- FrameGraphSSRRenderingPipelineTask "${this.name}": sourceTex
- FrameGraphSSRTask "${this.name}": sourceTexture, normalTextu
- FrameGraphPostProcessTask "${this.name}": sourceTexture and
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/3e0f28339c2733a4.
Report an issue: GitHub.