Skip to main content

@luma.gl/engine/scenegraph

A scenegraph arranges objects in a hierarchy. A group applies its transform to its descendants. A model node places an Engine model in that hierarchy. Traverse the group to visit its leaves with their accumulated world transforms.

import {GroupNode, ModelNode} from '@luma.gl/engine/scenegraph';

const root = new GroupNode({children: [new ModelNode({model})]});

The subpath also provides node controllers for skins, material variants, billboards, lights, and audio. A scene can be built directly or populated by a loader. See the scenegraph guide for traversal and the glTF reference for loading scenes.

Experimental instanced rendering​

new Scenegraph() creates a runtime scene. graph.instantiate(asset) returns a movable GroupNode. graph.draw(pass, view) renders visible placements and returns the number of primitive draws. The view supplies a view-projection matrix and world-space camera position. graph.destroy() releases the graph's batches.

Prepare a single-scene glTF with createScenegraphAssetFromGLTF(device, gltf, {capacity}) from @luma.gl/engine/gltf. See placing copies of an asset for a complete example and the ownership rules.