---
title: "SpatialGltfModel"
description: "This composable renders a glTF or .glb model that is loaded asynchronously from the provided source."
type: "composable"
lastmod: "2026-05-08T01:17:01.375386Z"
---
## API Reference

### SpatialGltfModel

> Source set: Android

```kotlin
@Composable
@SubspaceComposable
public fun SpatialGltfModel(
    state: SpatialGltfModelState,
    modifier: SubspaceModifier = SubspaceModifier,
    content: @Composable @SubspaceComposable () -> Unit = {},
)
```

This composable renders a glTF or .glb model that is loaded asynchronously from the provided
source.

### Layout and Sizing

The SpatialGltfModel's layout size is determined by the bounding box size of the glTFmodel that
is being displayed coerced into the constraints of the layout.
- By default, the layout size will match the bounding box of the loaded 3D asset once it is loaded bounded by the current constraints.
- To force the SpatialGltfModel to a specific size, use a size modifier like SubspaceModifier.size().
- The rendered model will be scaled uniformly to fit within the constraints imposed by the layout and modifiers.
- The `content` will be positioned at the center of the SpatialGltfModel by default. The developer may use GltfModelNode pose and size information to offset content relative to a desired position. **Note:** Because the model is loaded asynchronously, its intrinsic size will be zero during initial composition. The layout will be remeasured with the correct size once the model has finished loading. You can use the [state](/jetpack-compose/androidx.compose.runtime/runtime/interfaces/State) parameter to observe the loading status via [SpatialGltfModelState.status](/jetpack-compose/androidx.xr.compose/compose/classes/SpatialGltfModelState).

#### Parameters

| | |
| --- | --- |
| state | A [SpatialGltfModelState](/jetpack-compose/androidx.xr.compose/compose/classes/SpatialGltfModelState) object to observe and control the SpatialGltfModel. This can be created using [rememberSpatialGltfModelState](/jetpack-compose/androidx.xr.compose/compose/composable-functions/rememberSpatialGltfModelState). The state should be created with a [SpatialGltfModelSource](/jetpack-compose/androidx.xr.compose/compose/interfaces/SpatialGltfModelSource) that defines where to load the 3D model from. Use the helper functions `fromPath`, `fromUri`, or `fromData` to create a [SpatialGltfModelSource](/jetpack-compose/androidx.xr.compose/compose/interfaces/SpatialGltfModelSource). |
| modifier | The [SubspaceModifier](/jetpack-compose/androidx.xr.compose/compose/interfaces/SubspaceModifier) to be applied to this SpatialGltfModel. |
| content | The content within the space of the [SpatialGltfModel](/jetpack-compose/androidx.xr.compose/compose/composable-functions/SpatialGltfModel) |

## Code Examples
### SpatialGltfModelSample
```kotlin
@Composable
@SubspaceComposable
public fun SpatialGltfModelSample(modifier: SubspaceModifier) {
    val duckModelUri =
        "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/Duck/glTF-Binary/Duck.glb"
    val state =
        rememberSpatialGltfModelState(SpatialGltfModelSource.fromUri(Uri.parse(duckModelUri)))
    SpatialGltfModel(state = state, modifier = modifier)
}
```
