<p>There isn't a bounding box for the whole glTF file, but individual primitives have <code>POSITION</code> accessors that indicate <code>min</code> and <code>max</code> values.  This is specified in the <a href="https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes" rel="nofollow noreferrer">Meshes section</a>, with the following text:</p>
<blockquote>
<p><code>POSITION</code> accessor must have <code>min</code> and <code>max</code> properties defined.</p>
</blockquote>
<p>For a concrete example of this, take a look at the Box sample model, which assigns <a href="https://github.com/KhronosGroup/glTF-Sample-Models/blob/18912e96c60245f71a3775d365c990009307a11a/2.0/Box/glTF/Box.gltf#L48" rel="nofollow noreferrer">accessor 2 as <code>POSITION</code></a></p>
<pre><code>&quot;meshes&quot;: [
    {
        &quot;primitives&quot;: [
            {
                &quot;attributes&quot;: {
                    &quot;NORMAL&quot;: 1,
                    &quot;POSITION&quot;: 2
                },
                &quot;indices&quot;: 0,
                &quot;mode&quot;: 4,
                &quot;material&quot;: 0
            }
        ],
        &quot;name&quot;: &quot;Mesh&quot;
    }
],
</code></pre>
<p>The accessor at index <code>2</code> (the third one in the list) looks <a href="https://github.com/KhronosGroup/glTF-Sample-Models/blob/18912e96c60245f71a3775d365c990009307a11a/2.0/Box/glTF/Box.gltf#L89-L105" rel="nofollow noreferrer">like this</a>:</p>
<pre><code>&quot;accessors&quot;: [
    { ... },
    { ... },
    {
        &quot;bufferView&quot;: 1,
        &quot;byteOffset&quot;: 288,
        &quot;componentType&quot;: 5126,
        &quot;count&quot;: 24,
        &quot;max&quot;: [
            0.5,
            0.5,
            0.5
        ],
        &quot;min&quot;: [
            -0.5,
            -0.5,
            -0.5
        ],
        &quot;type&quot;: &quot;VEC3&quot;
    }
</code></pre>
<p>In this accessor, <code>min</code> and <code>max</code> are arrays of <code>x, y, z</code> raw position data of the primitive.  This particular sample model is a unit cube, with values ranging from <code>-0.5</code> to <code>0.5</code> along each axis.</p>
<p>To understand how this affects the whole model though, one must walk the tree of scene nodes, and look at how these mesh primitives are being transformed by the nodes.  Also, if there are any animations or morph targets taking effect, they can influence the final positions of these meshes as well.</p>

CC BY-SA 4.0
2019-10-07T14:38:37.060Z
2022-12-15T19:37:32.697Z
2022-12-15T19:37:32.697Z
emackey
<p>Is there a way when looking at the source of a glTF file that you can determine what the boundingBox values of the object are?</p>

<gltf>
Determining the Bounding Box values of a glTF file
Jamie Bresner
# Determining the Bounding Box values of a glTF file

(Asked by: username_0 on 2019-10-05)

Is there a way when looking at the source of a glTF file that you can determine what the boundingBox values of the object are?

**Tags:** gltf


---

## 1 answers

### Answer by username_1 on 2019-10-07. Score: 2

There isn't a bounding box for the whole glTF file, but individual primitives have `POSITION` accessors that indicate `min` and `max` values. This is specified in the [Meshes section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes), with the following text:

> `POSITION` accessor must have `min` and `max` properties defined.

For a concrete example of this, take a look at the Box sample model, which assigns [accessor 2 as `POSITION`](https://github.com/KhronosGroup/glTF-Sample-Models/blob/18912e96c60245f71a3775d365c990009307a11a/2.0/Box/glTF/Box.gltf#L48)

```
"meshes": [
    {
        "primitives": [
            {
                "attributes": {
                    "NORMAL": 1,
                    "POSITION": 2
                },
                "indices": 0,
                "mode": 4,
                "material": 0
            }
        ],
        "name": "Mesh"
    }
],

```

The accessor at index `2` (the third one in the list) looks [like this](https://github.com/KhronosGroup/glTF-Sample-Models/blob/18912e96c60245f71a3775d365c990009307a11a/2.0/Box/glTF/Box.gltf#L89-L105):

```
"accessors": [
    { ... },
    { ... },
    {
        "bufferView": 1,
        "byteOffset": 288,
        "componentType": 5126,
        "count": 24,
        "max": [
            0.5,
            0.5,
            0.5
        ],
        "min": [
            -0.5,
            -0.5,
            -0.5
        ],
        "type": "VEC3"
    }

```

In this accessor, `min` and `max` are arrays of `x, y, z` raw position data of the primitive. This particular sample model is a unit cube, with values ranging from `-0.5` to `0.5` along each axis.

To understand how this affects the whole model though, one must walk the tree of scene nodes, and look at how these mesh primitives are being transformed by the nodes. Also, if there are any animations or morph targets taking effect, they can influence the final positions of these meshes as well.


---

