{"record":{"id":"3e0f28339c2733a4","repo":"BabylonJS/Babylon.js","slug":"framegraphshadowgeneratortask-this-name-light","errorCode":null,"errorMessage":"FrameGraphShadowGeneratorTask ${this.name}: light, objectList and camera are required","messagePattern":"FrameGraphShadowGeneratorTask (.+?): light, objectList and camera are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Rendering/shadowGeneratorTask.ts","lineNumber":340,"sourceCode":"\r\n    /**\r\n     * Creates a new shadow generator task.\r\n     * @param name The name of the task.\r\n     * @param frameGraph The frame graph the task belongs to.\r\n     */\r\n    constructor(name: string, frameGraph: FrameGraph) {\r\n        super(name, frameGraph);\r\n\r\n        this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphShadowGeneratorTask\";\r\n    }\r\n\r\n    public record() {\r\n        if (this.light === undefined || this.objectList === undefined || this.camera === undefined) {\r\n            throw new Error(`FrameGraphShadowGeneratorTask ${this.name}: light, objectList and camera are required`);\r\n        }\r\n\r\n        // Make sure the renderList / particleSystemList are set when FrameGraphShadowGeneratorTask.isReady() is called!\r\n        const shadowMap = this._shadowGenerator!.getShadowMap()!;\r\n\r\n        shadowMap.renderList = this.objectList.meshes;\r\n        shadowMap.particleSystemList = this.objectList.particleSystems;\r\n\r\n        const shadowTextureHandle = this._frameGraph.textureManager.importTexture(`${this.name} shadowmap`, this._shadowGenerator!.getShadowMap()!.getInternalTexture()!);\r\n\r\n        this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, shadowTextureHandle);\r\n\r\n        const pass = this._frameGraph.addPass(this.name);\r\n\r\n        pass.setExecuteFunc((context) => {\r\n            if (!this.light.isEnabled() || !this.light.shadowEnabled) {\r\n                return;\r\n            }\r","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Rendering/shadowGeneratorTask.ts#L322-L358","documentation":"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.","triggerScenarios":"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.","commonSituations":"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().","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."],"exampleFix":"// before\nconst shadowTask = new FrameGraphShadowGeneratorTask('shadows', frameGraph, shadowGenerator);\nframeGraph.addTask(shadowTask);\nframeGraph.build();\n\n// after\nshadowTask.light = directionalLight;\nshadowTask.camera = scene.activeCamera;\nshadowTask.objectList = frameGraph.createObjectList(shadowCasters);\nframeGraph.addTask(shadowTask);\nframeGraph.build();","handlingStrategy":"validation","validationCode":"if (task.light === undefined || task.objectList === undefined || task.camera === undefined) {\n    throw new Error('ShadowGeneratorTask requires light, objectList and camera');\n}","typeGuard":"function isShadowTaskConfigured(t: FrameGraphShadowGeneratorTask): boolean {\n    return t.light !== undefined && t.objectList !== undefined && t.camera !== undefined;\n}","tryCatchPattern":"try {\n    frameGraph.build();\n} catch (e) {\n    if (String(e).includes('light, objectList and camera are required')) {\n        console.error('Configure shadow task light/objectList/camera before build');\n    } else throw e;\n}","preventionTips":["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."],"tags":["babylonjs","frame-graph","shadows","missing-input"],"backgroundTag":"missing-required-input","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}