---
title: "GLTF"
language: "en"
type: "Format"
summary: "MIME type: model/gltf+binary, model/gltf+json"
canonical_url: "https://reference.wolfram.com/language/ref/format/GLTF.html"
source: "Wolfram Language Documentation"
---
[EXPERIMENTAL]

# GLTF (.gltf, .glb)

``Export`` supports the GLTF file format.

## Background & Context

* MIME type: model/gltf+binary, model/gltf+json
* Graphics Language Transmission Format.
* 3D graphics format.
* Commonly used to share 3D scenes and models.
* Developed in 2015 by the Kronos Group.
* ASCII or binary format.
* Provides schemas for standard encoding of 3D scenes and models.

## Export

``Export["file.gltf", expr]`` exports a 3D object to a binary GLTF file. The ``expr`` can be any 3D geometric region that is ``ConstantRegionQ`` or a ``Graphics3D`` object.

The export format can be specified with ``Export["file", expr, "GLTF"]``.

File formats and file extensions used by the GLTF specification include:

|        |                |
| ------ | -------------- |
| "GLTF" | ASCII encoded  |
| "GLB"  | binary encoded |

---

See the following reference pages for full general information:

|                 |                          |
| --------------- | ------------------------ |
| Export          | export to a file         |
| CloudExport     | export to a cloud object |
| ExportString    | export to a string       |
| ExportByteArray | export to a byte array   |

---

## Examples (10)

### Basic Examples (1)

Export a 3D model to an ASCII GLTF file:

```wl
In[1]:= Export["model.gltf", [image], "GLTF"]

Out[1]= "model.gltf"
```

Print the raw textual contents of the file:

```wl
In[2]:= FilePrint[%]

{
  "accessors": [
    {
      "bufferView": 0,
      "componentType": 5126,
      "count": 8,
      "max": [
        1.0,
        1.0,
        1.0
      ],
      "min": [
        0.0,
        0.0,
        0.0
      ],
      "type": "VEC3"
    },
    {
      "bufferView": 1,
      "componentType": 5123,
      "count": 36,
      "max": [
        7
      ],
      "min": [
        0
      ],
      "type": "SCALAR"
    }
  ],
  "asset": {
    "generator": "Created with the Wolfram Language : www.wolfram.com",
    "version": "2.0"
  },
  "bufferViews": [
    {
      "buffer": 0,
      "byteLength": 96,
      "target": 34962
    },
    {
      "buffer": 1,
      "byteLength": 72,
      "target": 34963
    }
  ],
  "buffers": [
    {
      "byteLength": 96,
      "uri": "data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAIA/AACAPwAAAAAAAIA/AACAPwAAgD8AAIA/AAAAAAAAgD8AAIA/"
    },
    {
      "byteLength": 72,
      "uri": "data:application/octet-stream;base64,AAAFAAQABQAGAAQABwACAAMAAgAAAAMAAAAHAAMAAAACAAEAAgAGAAEABgAFAAEABQAAAAEABgACAAcABwAAAAQABgAHAAQA"
    }
  ],
  "extensions": {
    "KHR_lights_punctual": {
      "lights": [
        {
          "color": [
            1.0,
            0.0,
            0.0
          ],
          "intensity": 1.0,
          "type": "directional"
        }
      ]
    }
  },
  "extensionsUsed": [
    "KHR_lights_punctual"
  ],
  "materials": [
    {
      "doubleSided": true,
      "pbrMetallicRoughness": {
        "baseColorFactor": [
          0.5,
          0.5,
          0.5,
          1.0
        ]
      }
    }
  ],
  "meshes": [
    {
      "primitives": [
        {
          "attributes": {
            "POSITION": 0
          },
          "indices": 1,
          "material": 0,
          "mode": 4
        }
      ]
    }
  ],
  "nodes": [
    {
      "extensions": {
        "KHR_lights_punctual": {
          "light": 0
        }
      },
      "mesh": 0
    }
  ],
  "scenes": [
    {
      "nodes": [
        0
      ]
    }
  ]
}
```

### Scope (6)

#### Basic Uses (2)

Export to a binary GLTF file:

```wl
In[1]:= Export["model.glb", [image], "GLTF"]

Out[1]= "model.glb"
```

---

ASCII GLTF file:

```wl
In[1]:= Export["model.gltf", [image], "GLTF"]

Out[1]= "model.gltf"
```

#### Graphics (2)

Export ``Graphics3D`` objects:

```wl
In[1]:= Export["model.gltf", [image], "GLTF"]

Out[1]= "model.gltf"
```

---

Graphics from a file:

```wl
In[1]:= g = Import["ExampleData/seashell.stl", "Graphics3D"]

Out[1]= [image]

In[2]:= Export["model.gltf", g, "GLTF"]

Out[2]= "model.gltf"
```

#### Regions (2)

Export special regions:

```wl
In[1]:= Export["model.gltf", Ball[], "GLTF"]

Out[1]= "model.gltf"
```

---

Formula regions:

```wl
In[1]:= mesh = ParametricRegion[{u, v, u^2 - v^2}, {{u, -1, 1}, {v, -1, 1}}];

In[2]:= Region[mesh]

Out[2]= [image]

In[3]:= Export["model.gltf", mesh, "GLTF"]

Out[3]= "model.gltf"
```

### Properties & Relations (3)

Export to a cloud object:

```wl
In[1]:= CloudExport[[image], "GLTF"]

Out[1]= CloudObject["https://www.wolframcloud.com/obj/a34b3c2b-1704-4469-a760-e2d99423757e"]
```

---

Export to a string:

```wl
In[1]:= ExportString[Graphics3D[Ball[]], "GLTF"];

In[2]:= StringTake[%, 400]

Out[2]=
"{
  \"accessors\": [
    {
      \"bufferView\": 0,
      \"componentType\": 5126,
      \"count\": 1082,
      \"max\": [
        0.9996827734745269,
        1.0,
        1.0
      ],
      \"min\": [
        -0.9996827734745269,
        -1.0,
        -1.0
      ],
      \"type\": \"VEC3\"
    },
    {
      \"bufferView\": 1,
      \"componentType\": 5123,
      \"count\": 6480,
      \"max\": [
        1081
      ],
 "
```

---

Export to a byte array:

```wl
In[1]:= ExportByteArray[Graphics3D[Ball[]], "GLTF"]

Out[1]= ByteArray[CompressedData["«26137»"]]
```

## See Also

* [`Export`](https://reference.wolfram.com/language/ref/Export.en.md)
* [`CloudExport`](https://reference.wolfram.com/language/ref/CloudExport.en.md)
* [`Graphics3D`](https://reference.wolfram.com/language/ref/Graphics3D.en.md)
* [`Region`](https://reference.wolfram.com/language/ref/Region.en.md)
* [`USD`](https://reference.wolfram.com/language/ref/format/USD.en.md)
* [`OBJ`](https://reference.wolfram.com/language/ref/format/OBJ.en.md)

## History

* [Introduced in 2023 (13.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn133.en.md)