glTF rendering features
The glTF runtime in modules/…/index.ts turns a loaded .gltf or .glb asset into a luma.gl scene that can be rendered, animated, inspected, and extended. It keeps the authored scene structure while connecting geometry and materials to luma.gl rendering, shared animation, lighting, audio, billboards, metadata, and optional GPU physics. See Data and visualization assets for the wider asset model and Data interchange formats for the load and export boundary.
Runtime scene model
The runtime scene model preserves the relationships in a glTF asset and makes them usable by luma.gl. It separates source data from runtime nodes and resources so applications can select scenes, frame a view, update behavior, inspect metadata, and render without resolving source references on every frame.
Scene assembly
modules/…/create-scenegraph-from-gltf.ts creates one runtime bundle for a post-processed asset. The bundle exposes scene roots, materials, cameras, lights, animation clips, variants, skins, source-to-runtime node maps, camera-friendly bounds, extension support, metadata, and one destruction boundary. It can also expose a billboard controller and shared physical joint declarations for opt-in scene behavior.
The same scene model supports shared meshes, multiple scenes, visibility, source-authored GPU instancing, and optional lower-detail levels. An application can use one asset as a normal scene, as repeated geometry, or as the source for independently animated actors. Scene and model bounds provide a common basis for camera framing across individual scenes and the complete asset. Source XMP packets are mapped to shared scene metadata and attached to matching runtime scenes, nodes, meshes, materials, and their material instances.
References: modules/…/create-scenegraph-from-gltf.ts• L49-95 modules/…/create-scenegraph-from-gltf.ts• L98-179 modules/…/create-scenegraph-from-gltf.ts• L216-224 modules/…/parse-gltf-metadata.ts• L8-39 modules/…/gltf-instancing.ts• L20-32 modules/…/gltf-lod.ts• L18-28
Resolved asset boundary
The post-processed asset is the boundary between loaded glTF data and runtime scene creation. postProcessGLTF resolves links between scenes, nodes, meshes, materials, textures, images, skins, and cameras, and materializes accessor values while keeping caller-supplied buffers and images borrowed. It also applies safe defaults and prepares data that must work across luma.gl backends.
The source contract also admits draft glTF 2.1 file references, external asset references, and implicit shape definitions. These remain source-level inputs until a loader or adapter resolves them into a supported runtime feature. The resolved form supports sparse accessor values and preserves loader-supplied data such as compressed images, Gaussian primitive descriptors, and primitive-restart metadata. Gaussian primitives can remain available to a caller-managed splat renderer instead of becoming ordinary mesh models. WebGL-only line-loop and triangle-fan topology is converted to portable indexed topology before scene creation, while the source document remains unchanged.
References: modules/…/post-process-gltf.ts• L120-219 modules/…/post-process-gltf.ts• L427-476 modules/…/post-process-gltf.ts• L472-526 modules/…/post-process-gltf.ts• L612-657 modules/…/gltf-json-schema.ts• L380-405 modules/…/gltf-json-schema.ts• L614-764 modules/…/gltf-postprocessed-schema.ts• L84-145 modules/…/gltf-postprocessed-schema.ts• L747-790 modules/…/gltf-types.ts• L66-121
Rendering workflow
The rendering path moves from a resolved glTF asset to scene nodes and then to luma.gl models and materials. The same scene data can feed WebGL or WebGPU, with portable topology, sampler rules, and feature-specific shader inputs applied at the boundary.
This diagram shows how asset data becomes a rendered image and where optional runtime features join the normal path.
flowchart LR
A[glTF or GLB asset] --> B[Resolved glTF scene]
B --> C[Scene roots and model nodes]
C --> D[PBR materials and textures]
C --> E[Animation and feature controllers]
D --> F[luma.gl render pass]
E --> F
F --> G[WebGL or WebGPU image]
The loader and post-process stage resolves accessors, images, references, and portable primitive topology. The engine then maps those values to luma.gl geometry, materials, shader inputs, and models. Material state is split between a shared luma.gl Material and per-model scene inputs, so environment and feature data can follow the model that renders the primitive. Optional published body transforms provide a WebGPU-only path from GPU physics state to a model draw without making the render model own the physics world. Gaussian primitives can be excluded from this mesh path when another renderer owns their draw.
References: modules/…/post-process-gltf.ts• L120-218 modules/…/post-process-gltf.ts• L611-657 modules/…/parse-gltf.ts• L96-124 modules/…/parse-gltf.ts• L401-467 modules/…/create-gltf-model.ts• L546-571 modules/…/create-gltf-model.ts• L769-848
Animation and deformation
The animation system applies authored time-varying data to the retained scene instead of rebuilding the asset. It uses the shared luma.gl animation model for clip timing and connects supported glTF targets to nodes, materials, cameras, lights, and other runtime properties.
Animation targets
Standard channels update node translation, rotation, scale, and morph weights. Supported KHR_animation_pointer channels extend the same flow to material factors, texture transforms, camera projections, punctual-light values, node visibility, node selectability, node hoverability, and host-supplied physics properties.
Applications normally advance the returned animator once per frame. It accepts elapsed time or mixer-style playback control, and clip selection can replace or crossfade active playback. Runtime cameras and light definitions are copied before animation so playback does not change the authored document. Boolean node and physics targets use step interpolation. Unsupported pointers are skipped with a warning instead of becoming runtime targets.
References: modules/…/animations.ts• L7-35 modules/…/animations.ts• L37-157 modules/…/gltf-animator.ts• L52-79 modules/…/gltf-animator.ts• L118-183 modules/…/parse-gltf-animations.ts• L36-149 modules/…/parse-gltf-animations.ts• L241-305
Skinning morphing and crowds
Skinned characters use the authored joint hierarchy and inverse bind data with the shared luma.gl skin path. Morph targets change position, normal, and tangent data through node-local weights, so the geometry identity stays stable while the visible shape changes.
The animated crowd path parses one asset and shares immutable geometry, materials, pipelines, and instanced draw models across actors. Each actor keeps its own placement and playback state. Optional GPU animation bakes clip poses once and samples them during vertex processing; optional level-of-detail selection changes actor detail from screen coverage and can apply a shared vertex budget.
References: modules/…/gltf-skin.ts• L24-27 modules/…/gltf-skin.ts• L75-95 modules/…/gltf-animated-crowd.ts• L164-209 modules/…/gltf-animated-crowd.ts• L387-403 modules/…/gltf-animated-crowd.ts• L674-697 modules/…/gltf-gpu-animation.ts• L7-15 modules/…/create-gltf-model.ts• L661-805
Extension capabilities
glTF extensions add authored data or behavior to the base scene model. The runtime reports each extension by capability level so an application can distinguish a feature that renders in the normal path from data that is decoded but needs an opt-in controller or host-owned behavior.
Capability checks
The extension report includes extensions used by the document, required extensions, extensions removed during loading, standard status, device-dependent support, and the runtime support level.
| Level | Meaning | Typical result |
|---|---|---|
built-in | The normal scene or shader path handles the feature. | Compression, PBR extensions, punctual lights, and GPU instancing. |
parsed-and-wired | Source data is connected to an engine controller. | Material variants, node visibility, animation pointers, and audio emitters. |
loader-only | The loader preserves or decodes data, but rendering is opt-in or partial. | Lightmaps, billboards, area lights, and audio environments. |
none | No complete built-in runtime behavior exists. | Unknown or unsupported required features. |
Strict loading rejects a document when a required extension has no complete runtime path. This check runs before scene creation allocates models, textures, or buffers. It prevents successful JSON parsing from being mistaken for full rendering support. Physics extensions remain outside ordinary scene loading because the separate physics adapter must validate the pinned draft profile before creating a world. Device support can also lower BasisU support when the target device cannot use a decoded texture format.
References: modules/…/gltf-extension-support.ts• L8-36 modules/…/gltf-extension-support.ts• L54-101 modules/…/gltf-extension-support.ts• L321-443 modules/…/gltf-extension-support.ts• L395-417 modules/…/create-scenegraph-from-gltf.ts• L98-124
Scene behavior extensions
Several extensions change how an existing scene behaves without changing its basic geometry:
| Feature | Scene behavior |
|---|---|
| Material variants | Switches authored material choices while preserving primitive identity. |
| GPU instancing | Draws repeated transforms for one source primitive and keeps authored attributes available. |
| Node visibility | Hides a node subtree and its attached punctual lights. |
| Animation pointers | Connects supported asset paths to runtime node, material, camera, light, and host property changes. |
| Node LOD | Selects authored or generated lower-detail node levels for animated crowds. |
| Physics scene binding | Maps validated body, collider, trigger, and query identities to scene nodes. |
KHR_interactivity is not executed by ordinary glTF scene creation. Applications can still use the animation property adapter for supported host properties, but that path does not provide general interactivity graph execution. Node selectability and hoverability are also not wired into scene picking or pointer dispatch by the extension runtime; animation channels can represent those node properties when the host provides the matching behavior.
References: modules/…/gltf-extension-support.ts• L140-153 modules/…/gltf-material-variants.ts• L15-41 modules/…/gltf-instancing.ts• L20-82 modules/…/gltf-lod.ts• L41-95 modules/…/scene-bindings.ts• L12-45 modules/…/parse-gltf-physics-pointer.ts• L5-31 modules/…/parse-gltf-animations.ts• L247-305
Metadata
KHR_xmp_json_ld connects source packet references to shared scene metadata. The runtime validates each packet reference and exposes metadata for the asset, scenes, nodes, meshes, materials, images, and animations; scene creation then attaches relevant packets to runtime scene objects.
The metadata path preserves descriptive asset information without changing geometry or shader behavior. Archived KHR_xmp payloads remain in the loaded glTF, but they are not interpreted as runtime metadata unless packet references use the supported JSON-LD extension.
References: modules/…/parse-gltf-metadata.ts• L8-39 modules/…/create-scenegraph-from-gltf.ts• L104-105 modules/…/create-scenegraph-from-gltf.ts• L146-175 modules/…/gltf-extension-support.ts• L293-301
Lighting and materials
glTF materials use the shared luma.gl PBR path. The material boundary preserves authored texture roles, UV sets, sampler behavior, alpha mode, and supported physical extensions, then supplies them as common shader inputs rather than as a separate glTF-only renderer.
PBR lighting
The standard path supports metallic-roughness materials, unlit materials, emissive strength, specular and IOR controls, transmission and volume, clearcoat, sheen, iridescence, anisotropy, dispersion, diffuse transmission, and selected draft material features. The pinned scatter profile adds a constrained thin-wall and volume scattering path within the shared material workflow.
PBR parsing returns shader defines, resource bindings, uniform values, pipeline parameters, and generated texture ownership as one material description. Scene creation uses the resource bindings and material-owned uniforms for the luma.gl Material, while scene-level environment values and other module inputs remain available to each model. Punctual lights become luma.gl light descriptions. Their type, color, intensity, range, position, direction, and spot cones follow the source node hierarchy and can refresh after animation or visibility changes. Image-based lighting supplies diffuse irradiance, specular mip levels, and a BRDF lookup texture through an application-provided image loader. Standalone glTF transmission uses an alpha and attenuation approximation; captured scene-color refraction belongs to a separate physical scene workflow.
References: modules/…/parse-pbr-material.ts• L239-372 modules/…/parse-pbr-material.ts• L627-750 modules/…/pbr-material.ts• L23-37 modules/…/create-gltf-model.ts• L546-571 modules/…/create-gltf-model.ts• L823-848 modules/…/parse-gltf-lights.ts• L15-45 modules/…/parse-gltf-lights.ts• L59-122 modules/…/gltf-materials-scatter.ts• L5-54 modules/…/pbr-environment.ts• L13-36 modules/…/pbr-environment.ts• L35-87
Area lights and lightmaps
Area lights and lightmaps extend direct and baked illumination through opt-in paths. They are useful when an asset needs more than punctual lights but does not need a full global illumination system.
| Feature | Rendering role | Main boundary |
|---|---|---|
EXT_lights_area | Supplies rectangle and disk lights to the shared lighting API. | Up to four active lights with direct-light integration; no shadows or indirect bounce. |
KHR_lightmap | Multiplies linear RGB irradiance into the diffuse material response. | Supports UV0/UV1, node overrides, and instance atlas data; it does not add specular illumination. |
Area-light transforms follow the animated scene. Lightmap bindings resolve per primitive, and instanced atlas data composes the instance transform with the authored lightmap transform. The portable atlas path favors correct UV composition over the fewest draw calls.
References: modules/…/gltf-area-lights.ts• L14-54 modules/…/gltf-lightmap.ts• L15-24 modules/…/gltf-lightmap.ts• L61-135 modules/…/parse-gltf.ts• L174-218 modules/…/parse-gltf.ts• L401-467 modules/…/parse-pbr-material.ts• L639-656
Audio
Audio is an optional parallel output for a glTF scene. It uses the browser Web Audio API and the scene's animated world transforms while WebGL or WebGPU renders the visual scene.
Spatial audio
The glTF audio adapter maps global and positional emitters to engine audio inputs. Positional emitters follow their node transforms and can use distance attenuation and directional cones. Audio data can be embedded in the asset or loaded from an external URI.
The application owns the audio context and controls its activation. A normal frame updates scene animation first, then supplies the current listener pose to the audio controller. This keeps sound positions aligned with animated nodes without placing audio inside the GPU render pass.
References: modules/…/gltf-audio.ts• L65-80 modules/…/gltf-audio.ts• L83-125 modules/…/gltf-audio.ts• L127-144
Audio environments
Audio environment data adds listener selection, zones, direct and reverb sends, air-absorption settings, and authored or generated reverb responses. The audio graph path can connect processing and scheduled-source behavior to selected emitters.
Only graphs that reach an emitter in the selected scene need to become active audio resources. Invalid graph endpoints and cycles are rejected before the audio graph is built. Draft features outside the supported profile remain outside the advertised runtime behavior.
References: modules/…/gltf-audio.ts• L29-63 modules/…/gltf-audio.ts• L90-111 modules/…/gltf-audio.ts• L113-140
Billboards
Billboards provide camera-facing presentation for signs, sprites, and labels. The opt-in billboard path derives draw entries from the current camera while leaving authored and animated scene transforms unchanged.
The supported profile faces a node toward the camera on all axes, keeps local scale, can scale with view distance, and can mark a branch as an overlay. Overlay entries are returned after ordinary geometry in back-to-front order. The application must render each returned entry with its complete model matrix and depth policy. The parser accepts the lowercase y rotation-axis spelling only when legacy compatibility is enabled; it otherwise requires the full three-axis form. Constrained-axis draft semantics are not treated as full support.
Billboard definitions are validated before ordinary scene resources are created. This makes invalid billboard profiles fail at scene setup instead of producing a partly built render scene.
References: modules/…/gltf-billboard.ts• L14-53 modules/…/create-scenegraph-from-gltf.ts• L104-145 modules/…/index.ts• L113-117
Physics
The optional glTF physics path turns a pinned subset of draft rigid-body and implicit-shape data into a validated description for luma.gl GPU physics. It is separate from normal scene rendering: parsing does not create GPU resources or start simulation, and the application decides how simulation state reaches the rendered scene.
Physics import and simulation
The adapter reads raw glTF JSON before normal post-processing changes node references. It resolves a selected scene into bodies, colliders, triggers, joints, filters, materials, query selections, mass properties, and provenance. It can use primitive shapes or explicit initial mesh snapshots for supported collision geometry.
World creation requires a description with no issues. The adapter supports a bounded draft profile with static, dynamic, and kinematic bodies, GPU collision and integration, collision filters, triggers, and selected joints. It rejects unsupported or ambiguous data instead of creating a partial simulation. Render instancing does not imply independent physics bodies, and animated collision geometry needs an explicit rebuild or runtime ownership path.
This diagram shows the boundary between source data, validation, simulation, and rendering.
flowchart LR
A[Raw glTF physics data] --> B[Validated physics description]
B -->|supported with no issues| C[Physics scene binding]
C --> D[GPU rigid-body world]
D --> E[Simulation state]
E --> F[Application-owned render pose]
B -->|issues| G[Reject before simulation]
References: modules/…/README.md• L1-23 modules/…/README.md• L25-43 modules/…/parse-gltf-physics.ts• L195-217 modules/…/parse-gltf-physics.ts• L900-917 modules/…/index.ts• L22-37
Physics scene binding and state exchange
makeGLTFPhysicsScene and related bindings resolve source node identities once and expose body, collider, trigger, joint, query, and property behavior to the host. Simulation ownership stays with the physics world, while rendered nodes remain part of the normal scene graph.
There are two distinct state exchange directions. A scene snapshot copies current local authoring transforms and morph weights for an explicit import or cooking revision. A physics-state export reads settled GPU state and writes a new native glTF document. The snapshot does not capture simulated poses, and ordinary physics import does not update render transforms automatically.
For WebGPU rendering, a glTF model can consume borrowed published body matrices at draw time. This gives GPU simulation a direct render path while keeping world lifetime, validation, and render resource ownership separate.
References: modules/…/scene-bindings.ts• L12-45 modules/…/index.ts• L39-65 modules/…/snapshot-scene.ts• L7-31 modules/…/export-state.ts• L12-24 modules/…/create-gltf-model.ts• L486-490 modules/…/create-gltf-model.ts• L831-837
Related workflows
The glTF runtime is one scene-asset path within luma.gl. Use the neighboring knowledge pages to place it beside other asset and scene systems:
- Data and visualization assets explains the parent asset model.
- Data interchange formats explains the glTF load and export boundary.
- Engine render loop explains when animation, audio, and scene updates join rendering.
- Rendering lighting explains the shared lighting model used by glTF materials and lights.
- GPU physics explains the simulation system that can publish transforms to glTF rendering.
- Scene graph explains the retained node model shared by loaded scenes.
- Text rendering explains a separate path for labels and text.
- Gaussian splats explains a point-based scene asset path.
- Three integration explains interoperability with Three.js scenes.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the engine glTF exports, source schema, post-processed asset shape, and scenegraph bundle contracts aligned.
- Keep borrowed resource rules aligned: post-processing may read caller-supplied buffers and images, while scene creation owns generated GPU resources.
- Keep draft file, external-asset, and implicit-shape source data aligned with the loaders and adapters that claim to resolve it.
- Keep strict extension checks and pre-allocation validation aligned with the opt-in controllers for billboards and other extensions.
- Keep animation pointer targets aligned with runtime copies of materials, texture transforms, cameras, lights, visibility, selectability, hoverability, skins, morph weights, and physics properties.
- Keep metadata packet validation and runtime attachment aligned with source object categories and material instances.
- Keep portable topology normalization aligned with geometry creation on both WebGL and WebGPU.
- Keep Gaussian primitive descriptors and the opt-out mesh path aligned with any caller-managed splat renderer.
- Keep PBR environment face order, asynchronous image loading, and specular mip counts aligned with the shader environment inputs.
- Keep material parser output aligned with
ParsedPBRMaterialand with the split between material-owned bindings and scene shader inputs. - Keep area-light limits, lightmap UV selection, atlas transform order, and primitive attribute validation aligned.
- Keep punctual-light hierarchy, visibility filtering, and animation refresh aligned.
- Keep audio listener and emitter updates after scene animation so world transforms remain synchronized.
- Keep crowd capacity, actor slots, baked frame limits, LOD selection, and shared instance buffers aligned.
- Keep physics draft validation, scene-node binding, world creation, render pose publication, authoring snapshots, and physics-state export as separate boundaries.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A required extension has only loader data or no runtime path | The asset may render without required authored behavior | Use strict extension checks before scene creation |
| A required BasisU texture has no supported device format | Strict loading rejects the asset even though the extension is normally built in | Check the extension report for device support before rendering |
A required billboard profile uses an invalid axis form or legacy y without opt-in | Scene creation fails before the normal render scene is built | Validate billboard options and use the supported axis form |
| Animation advances without the skin update path | A character's joint state and visible mesh pose diverge | Advance the animator or update skins after manual joint changes |
A boolean animation pointer uses non-STEP interpolation | The channel is rejected or cannot represent discrete state safely | Use STEP for boolean node and physics targets |
| A lightmap uses an unsupported UV set or missing primitive attribute | Baked illumination cannot map to the primitive | Restrict bindings to UV0/UV1 and validate the effective primitive binding |
| A billboard overlay uses ordinary scene traversal only | Camera-facing or overlay depth behavior is missing | Render controller entries with their returned matrices and depth policy |
| Audio uses a closed or inactive borrowed context | Sources do not play or update | Resume the application-owned context from a user action |
| Physics parsing reports any issue | World creation is rejected rather than partially simulated | Inspect description.issues and require supported |
| Published transforms are requested on a non-WebGPU device | Model creation fails before rendering | Use WebGPU or omit published body matrices |
| A physics snapshot is used to capture simulated poses | The saved document contains authoring state instead of GPU state | Use physics-state export for settled simulation poses |
| A crowd exceeds fixed capacity or GPU frame limits | Actors are rejected or the crowd falls back to CPU animation | Set capacity explicitly and check crowd animation stats |
Key files
| File | Why to read it |
|---|---|
| modules/…/index.ts | Defines the public engine glTF surface and exports the runtime scene and asset contracts. |
| modules/…/create-scenegraph-from-gltf.ts | Defines the scene bundle, metadata attachment, validation order, bounds, and main asset-to-scene workflow. |
| modules/…/post-process-gltf.ts | Defines the resolved asset boundary, accessor materialization, sparse data, and portable topology. |
| modules/…/gltf-json-schema.ts | Defines the source glTF contract, including extension declarations and draft asset references. |
| modules/…/gltf-postprocessed-schema.ts | Defines the resolved scene, resource, animation, and loader-derived asset shape. |
| modules/…/gltf-types.ts | Defines borrowed image data, resolved typed arrays, compressed images, Gaussian descriptors, and primitive-restart metadata. |
| modules/…/parse-gltf.ts | Shows how primitives, materials, instancing, morph targets, lightmaps, and optional splat exclusion enter rendering. |
| modules/…/create-gltf-model.ts | Shows the shared PBR, skin, morph, crowd, and published-transform rendering boundary. |
| modules/…/gltf-animator.ts | Defines clip playback and runtime animation target behavior. |
| modules/…/parse-gltf-animations.ts | Defines how standard channels and typed animation pointers enter the runtime model. |
| modules/…/gltf-animated-crowd.ts | Defines shared-model crowd animation, GPU sampling, and actor LOD. |
| modules/…/gltf-extension-support.ts | Defines extension capability levels, device checks, and strict loading behavior. |
| modules/…/parse-gltf-metadata.ts | Defines XMP packet validation and shared scene metadata extraction. |
| modules/…/parse-pbr-material.ts | Defines the mapping from glTF material features to shared PBR inputs and texture resources. |
| modules/…/pbr-material.ts | Defines the material-state contract consumed by the shared PBR shader module. |
| modules/…/pbr-environment.ts | Defines image-based lighting environment loading. |
| modules/…/parse-gltf-lights.ts | Defines punctual-light hierarchy, visibility filtering, and world-space light resolution. |
| modules/…/gltf-area-lights.ts | Shows how area-light definitions attach to animated scene nodes. |
| modules/…/gltf-audio.ts | Defines the visual-scene to Web Audio relationship. |
| modules/…/gltf-billboard.ts | Defines billboard controller inputs, validation, and authored transform handling. |
| modules/…/gltf-lightmap.ts | Defines baked irradiance bindings and instance atlas composition. |
| modules/…/parse-gltf-physics.ts | Defines validation from the pinned draft physics data to a simulation description. |
| modules/…/scene-bindings.ts | Connects validated physics identities to scene nodes and host behavior. |
| modules/…/snapshot-scene.ts | Defines the authoring-state snapshot boundary. |
| modules/…/export-state.ts | Defines the explicit GPU-state-to-glTF export boundary. |
| modules/…/index.ts | Defines physics validation, world creation, and scene integration entry points. |