BabylonJS/Babylon.js · error · Error

FrameGraphCullObjectsTask ${this.name}: objectList and camer

Error message

FrameGraphCullObjectsTask ${this.name}: objectList and camera are required

What it means

FrameGraphCullObjectsTask performs frustum culling of an object list relative to a camera, so both inputs are mandatory. record() throws when either task.objectList or task.camera is undefined before producing the culled outputObjectList.

Source

Thrown at packages/dev/core/src/FrameGraph/Tasks/Misc/cullObjectsTask.ts:46

     * @param frameGraph The frame graph the task belongs to.
     * @param scene The scene to cull objects from.
     */
    constructor(name: string, frameGraph: FrameGraph, scene: Scene) {
        super(name, frameGraph);
        this._scene = scene;
        this.outputObjectList = {
            meshes: null,
            particleSystems: null,
        };
    }

    public override getClassName(): string {
        return "FrameGraphCullObjectsTask";
    }

    public record() {
        if (this.objectList === undefined || this.camera === undefined) {
            throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);
        }

        // Initial output values
        this.outputObjectList.meshes = this.objectList.meshes;
        this.outputObjectList.particleSystems = this.objectList.particleSystems;

        const pass = this._frameGraph.addObjectListPass(this.name);

        pass.setObjectList(this.outputObjectList);
        pass.setExecuteFunc((_context) => {
            // No culling on particle systems
            this.outputObjectList.particleSystems = this.objectList.particleSystems;

            if (this._scene._activeMeshesFrozen) {
                // If active meshes are frozen, we don't need culling: we keep the last list created before freezing
                return;
            }

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Set task.objectList to the output of a preceding FrameGraphObjectListTask (or a valid object list handle) before record().
  2. Set task.camera to a camera task's output handle.
  3. Check task execution order: the tasks producing objectList and camera must be recorded/built before the cull task.

Example fix

// before
const cullTask = new FrameGraphCullObjectsTask("cull", context);
context.build();
// after
const cullTask = new FrameGraphCullObjectsTask("cull", context);
cullTask.objectList = objectListTask.output;
cullTask.camera = cameraTask.output;
context.build();
Defensive patterns

Strategy: validation

Validate before calling

if (cullTask.objectList === undefined || cullTask.camera === undefined) {
  throw new Error("CullObjectsTask requires objectList and camera before build");
}

Type guard

function isCullTaskReady(task: FrameGraphCullObjectsTask): boolean {
  return task.objectList !== undefined && task.camera !== undefined;
}

Try / catch

try {
  cullTask.record();
} catch (e) {
  if (String(e).includes("objectList and camera are required")) {
    console.error("Wire cullTask.objectList and cullTask.camera before building the graph");
  } else throw e;
}

Prevention

When it happens

Trigger: Calling cullObjectsTask.record() (directly or via frame graph build) without having set task.objectList or task.camera.

Common situations: Constructing the task and forgetting to wire the camera handle from a camera task output; passing an object list that was never produced by a preceding task; partially migrated legacy scene-culling code.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/ceb484b4d6aeb47f. Report an issue: GitHub.