Skip to main content

For a more graphical explanation of this, check out the glTF Overview CardglTF Overview Card - same image is found here.

For a more graphical explanation of this, check out the glTF Overview Card.

For a more graphical explanation of this, check out the glTF Overview Card - same image is found here.

Source Link
emackey
  • 369
  • 1
  • 9

The min and max values provide an outer bounding box for all POSITION data within a given accessor. Accessors typically contain multiple vertices, for example all of the vertices of a particular primitive, and then min: [x, y, z] and max: [x, y, z] will offer the bounding box for that primitive.

For your second question, let's look at the mesh structure from BoxTextured.gltf:

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

In the above example, mode: 4 is an enum, where 4 means TRIANGLES. The indices are stored in accessor 0, and the POSITION data is stored in accessor 2. So, accessor 2 will contain a list of vertex positions, but each vertex is allowed to be referenced by multiple triangles. The indices in accessor 0 declare the triangles by indexing into the list of vertices.

Here's a sample of the start of accessor 0 from this model:

0 
1 
2 

3 
2 
1 

4 
5 
6 

7 
6 
5 
...

And this is a sample of the contents from the start of accessor 2 in this model:

-0.50000    -0.50000     0.50000 
 0.50000    -0.50000     0.50000 
-0.50000     0.50000     0.50000 
 0.50000     0.50000     0.50000 
 0.50000     0.50000     0.50000 
 0.50000    -0.50000     0.50000 
 0.50000     0.50000    -0.50000 
 0.50000    -0.50000    -0.50000 
 ...

In this manner, the sample model builds a cube by winding triangles around vertices at the corners.

For a more graphical explanation of this, check out the glTF Overview Card.