Skip to main content

@luma.gl/anari ๐Ÿงช

ANARIglTFOpenUSD

ExperimentalFrom v10

@luma.gl/anari provides an experimental retained-mode rendering API inspired by the ANARI object model and built on luma.gl.

In retained mode, an application creates a scene from objects such as geometry, materials, lights, and cameras. The library retains those objects between frames; the application updates and commits their parameters when the scene changes.

To render, the application combines a world, camera, and renderer in a frame and requests an image. The renderer interprets the scene using its rendering approach and supported WebGPU or WebGL 2 backend. Renderer capabilities and backend support vary.

This declarative model lets applications describe what to render while the renderer handles how to render it. Compared with lower-level luma.gl APIs, it offers less direct control over GPU execution in exchange for a simpler scene API and the ability to experiment with different advanced rendering techniques.

ANARI-inspired API

This experimental API is inspired by the Khronos ANARI standard specification. It is not an official or conformant ANARI implementation or C binding, and is not affiliated with or endorsed by The Khronos Group. ANARI and its logo are trademarks of The Khronos Group.

Interactive sceneโ€‹

Explore the ANARI-inspired scene playground to build and render a scene.

Loading interactive exampleโ€ฆ

Object models and renderersโ€‹

The reference pages describe a renderer-independent object model. Applications create and connect cameras, geometry, materials, lights, surfaces, instances, and worlds to describe what they want to render. A frame combines a world and camera with a selected renderer, which interprets the committed objects using its own rendering techniques. Applications can also register custom renderers.

RendererWebGPUWebGL2Rendering approach and capabilities
Forwardโœ…โœ…Forward rasterization on WebGPU and WebGL 2. Supports physically based materials, lighting, transparency, bloom, and fog.
Deferredโœ…โŒSeparates lighting from geometry rendering, providing a foundation for effects and scenes with many lights that can be expensive with forward rendering. The current WebGPU implementation supports opaque PBR lighting.
Ray tracingโœ…โŒRenders supported geometry with ray-traced hard shadows and physically based lighting. Optional secondary bounces add diffuse color bleeding and emissive illumination, with opaque reflections in PBR transport mode. Requires WebGPU.
Ray marchingโœ…โŒRenders scalar and vector volumes with transfer functions, compositing, and optional vector glyphs. Requires WebGPU and is not yet integrated with the ANARI object model.
Debug normalsโœ…โœ…Visualizes world-space surface normals as colors.
Debug depthโœ…โœ…Visualizes scene depth for inspecting geometry and camera setup.

Renderer capabilities differ; consult the renderer feature comparison and volume ray-marching reference for details.

The scene playground can convert supported glTF and OpenUSD files into renderable ANARI object models. Its scene import adapters are part of the example; the optional @luma.gl/anari/gltf entry point additionally supports glTF animation integration. OpenUSD import is experimental and does not cover all USD formats or composition features.

Explore capabilitiesโ€‹

If you want toโ€ฆStart here
Create objects, register renderers, and manage their lifecycleDevice and object lifecycle
Build meshes, analytic primitives, and geometry dataArrays and geometry
Configure PBR materials, textures, and lightsMaterials and lighting
Arrange surfaces, groups, instances, and worldsScene hierarchy
Animate retained objects or integrate glTF animationAnimation and glTF integration
Select a camera and renderer, render frames, and inspect statisticsCameras, renderers, and frames
Render structured volumes with transfer functions or vector glyphsStructured volume ray marching
Validate and edit JSON scene descriptionsScene schemas and JSON validation ยท JSON scene playground
Compare the API with ANARI 1.1 or Three.jsANARI C API and Three.js mapping
Build a complete scene and explore the architectureANARI developer guide

Package availabilityโ€‹

@luma.gl/anari is published separately from the core engine. It owns forward, deferred, ray-tracing, and raymarching implementations, along with shadow, transparency, and scene composition helpers.

npm install @luma.gl/anari @luma.gl/core @luma.gl/engine @luma.gl/shaders

Object modelโ€‹

ObjectRole and relationships
ANARIDeviceCreates and manages scene objects.
ANARIArraySupplies data to scene objects.
ANARISampler and ANARIMaterialDescribe sampled data and surface appearance.
ANARIGeometry and ANARISurfaceA surface combines geometry with a material.
ANARILight and ANARIGroupA group collects surfaces and lights.
ANARIInstancePlaces a group with a transform; instances can reuse the same group.
ANARIWorldCollects surfaces, instances, and lights into a scene.
ANARICameraDefines the view of the scene.
ANARIRendererSelects a rendering implementation and its settings.
ANARIFrameCombines a world, camera, and renderer to produce an image.

The relationships can also be viewed as a hierarchy:

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, hexPrism, torus, ring
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โ€‹

For support by renderer subtype, including deferred forward fallback and ray-tracing limitations, see the renderer feature comparison.

CapabilityWebGPUWebGL 2
Retained scene objects and instanced surfacesSupportedSupported
Matte and physically based materialsSupportedSupported
All 21 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 package includes a JSON scene playground at examples/anari/scenes/playground.html. Start it with yarn workspace luma.gl-examples-showcase-scene 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.