Skip to main content

@luma.gl/anari

ANARI

Experimental asset import

ExperimentalPrivate workspaceFrom-v10

@luma.gl/anari provides a private, experimental, independently developed retained rendering API built in the spirit of ANARI on top of luma.gl. Applications describe what to render as cameras, worlds, surfaces, materials, lights, and frames. The implementation decides how to compile that description into portable WebGPU or WebGL rendering.

Independent, non-conformant proof of concept

This package is inspired by the ANARI object model, but it is not an official ANARI implementation, is not an ANARI C binding, does not implement the full ANARI specification, and is not certified or conformant. It is not affiliated with or endorsed by The Khronos Group. ANARI and its logo are trademarks of The Khronos Group and identify the standard that inspires this project. The TypeScript API and supported feature set can change.

Reference pages

  • Device and object lifecycle: ANARIDevice, object creation, renderer registration, discovery, staged parameters, commits, and destruction.
  • Arrays and geometry: triangle meshes, RGB/RGBA colors, secondary UVs, joint palettes, morph targets, and analytic primitives.
  • Materials and lighting: all 17 canonical PBR maps, alpha masking/blending, UV samplers, punctual lights, and existing image-based lighting.
  • Animation and glTF integration: retained node hierarchies, optional glTF adaptation, automatic skeletal and morph playback, mixer controls, and batched object commits.
  • Scene hierarchy: surfaces, groups, transform instances, worlds, and instancing behavior.
  • Cameras, renderers, and frames: camera projections, forward/deferred/ray-tracing renderer controls, bloom, fog, frame rendering, and statistics.
  • Scene schemas and JSON validation: optional Zod object schemas, retained-reference validation, generated JSON Schema, and editor integration.
  • ANARI C API and THREE.js mapping: official ANARI 1.1 functions, implementation coverage, behavioral differences, and THREE.js equivalents.
  • ANARI developer guide: complete setup, scene construction, animation, HDR presentation, debugging, architecture, and limitations.
  • JSON scene playground: live deck.gl-style JSON scene editing, reusable object references, animated presets, and retained-scene statistics.

Private workspace availability

@luma.gl/anari is a private, unpublished luma.gl workspace. Install dependencies from a luma.gl checkout:

yarn install

Another workspace inside the same checkout can depend on it through "@luma.gl/anari": "workspace:*". It cannot currently be installed from npm. Add @luma.gl/webgl to the consuming workspace if a WebGL 2 fallback is required.

Object model

ANARIDevice
├── ANARIArray
├── ANARISampler → ANARIMaterial
├── ANARIGeometry + ANARIMaterial → ANARISurface
├── ANARISurface + ANARILight → ANARIGroup
├── ANARIGroup + transform → ANARIInstance
├── ANARISurface / ANARIInstance / ANARILight → ANARIWorld
├── ANARICamera
├── ANARIRenderer
└── ANARIWorld + ANARICamera + ANARIRenderer → ANARIFrame

Every scene object stores committed parameters. Reusing the same ANARISurface through multiple ANARIInstance objects lets the runtime compile one luma.gl model and issue one instanced draw for that surface.

Exported classes

import {
ANARIDevice,
ANARIObject,
ANARIArray,
ANARIGeometry,
ANARISampler,
ANARIMaterial,
ANARISurface,
ANARIGroup,
ANARIInstance,
ANARIWorld,
ANARILight,
ANARICamera,
ANARIRenderer,
ANARIFrame
} from '@luma.gl/anari';

The package also exports parameter interfaces, subtype unions, object metadata, frame statistics, and shared vector/matrix aliases. Each reference page documents its related exported types.

Optional functionality is isolated in separate entry points:

import {ANARIDevice} from '@luma.gl/anari';
import {makeANARIAnimationScene} from '@luma.gl/anari/gltf';
import {ANARISceneSchema} from '@luma.gl/anari/schemas';

The core entry point contains neither a glTF file loader nor Zod. The optional /gltf adapter consumes glTF-owned decoded data and reuses the existing engine animation mixer; /schemas separately loads the retained JSON validation helpers.

Supported object subtypes

Object typeSupported subtypes
Arrayarray1D
Geometrytriangle, sphere, cylinder, cone, quad
Materialmatte, physicallyBased
Samplerimage2D
Surfacedefault
Groupdefault
Instancetransform
Worlddefault
Lightambient, directional, point, spot
Cameraperspective, orthographic
Rendererdefault, deferred, debugNormals, debugDepth, raytrace, and registered custom subtypes
Framedefault

Query the actual subtype list with anariDevice.getObjectSubtypes(type) instead of assuming future implementations expose the same set.

Compatibility

CapabilityWebGPUWebGL 2
Retained scene objects and instanced surfacesSupportedSupported
Matte and physically based materialsSupportedSupported
All 17 canonical PBR image maps and slot-specific UV transformsSupportedSupported
Secondary UVs and RGB/RGBA vertex colorsSupportedSupported
Alpha masking, blending, and double-sided materialsSupportedSupported
Retained node/material/UV animation and morph targetsSupportedSupported
Automatic imported glTF skeletal animationSupportedSupported
Explicit surface joint palettesSupportedSupported
Existing caller-owned image-based lighting texturesSupportedSupported
Captured opaque-scene transmission and refractionSupportedSupported
Ambient, directional, point, and spot lightingSupportedSupported
Deferred rendererWebGPU-only G-buffer and direct deferred lightingNot supported
Software ray-tracing rendererShared RayTracingSceneRenderer and WebGPU command graphNot supported
Ray-traced skeletal/morph deformation or advanced PBRNot supported; use forward/deferred renderingNot supported
Debug normals and depth renderersSupportedSupported
BloomSupportedSupported
Deferred fogSupportedNot supported
Extended-range, Display P3 presentationSupported on compatible displays and browsersNot supported; SDR fallback

See HDR and backend selection for capability detection and canvas setup.

Experimental JSON playground

The private package includes a JSON scene playground at examples/showcase/anari/playground.html. Start it with yarn workspace luma.gl-examples-showcase-anari start, then open /playground.html on the reported development-server URL. The playground translates deck.gl-inspired @@type declarations, named ANARI object references, shared retained surfaces, generated torus/crystal/prism meshes, starfield distributions, composable transform animations, lights following named instances, cameras, and optional renderer presets into the API documented on these pages. The active renderer subtype is selected as frame state outside the renderer-independent scene. The complete Chromatic Atlas, Crystal Cathedral, and Celestial Engine showcase scenes are available as editable JSON presets.

The optional @luma.gl/anari/gltf entry point binds source node hierarchies, material and texture tracks, animated morph targets, and imported glTF skeletons to existing retained objects. The showcase preserves joint attributes, authored joint nodes, and inverse bind matrices; it creates reusable mesh-local palettes automatically and commits each animated retained surface at most once per frame. Applications can also provide explicit skin: {jointMatrices} surface descriptors. The separate @luma.gl/anari/schemas entry point exports experimental Zod schemas and generated JSON Schema for editor integration. The scene format is not an official ANARI serialization format. See the schema API reference and the JSON scene playground developer guide for the full schema, animation vocabulary, and editing controls.