<p>To take an example from the glTF spec you cited:</p>
<blockquote>
<p>The stride, in bytes, between vertex attributes. When this is not defined, data is tightly packed.</p>
</blockquote>
<p>The stride of an array is the number of bytes from the start of one element to the start of the next element. If that stride is the same as the byte size of an element, then the array is &quot;tightly packed&quot;. This means that there is no space between elements in the array; the byte after one element is the first byte of the next.</p>
<p>What this is saying is that, if you don't specify a stride, then the stride will be computed to be the size of the element type in question.</p>
<p>Interleaved vertex attributes are not &quot;tightly packed&quot; with respect to each other. If you have positions and normals interleaved, the position array is not tightly packed because the byte after one position is not the first byte of the next position.</p>
<p><em>However</em>, you could consider it to be &quot;tightly packed&quot; with respect to an aggregation of the vertex data as a whole. If the byte after one position/normal combination is the first byte of another position/normal combination, then this could be said to be a &quot;tightly packed&quot; array of position/normal aggregates.</p>

CC BY-SA 4.0
2022-05-31T05:01:35.217Z
Another example of non-tightly packed would be a bitmap that uses 32 bits for each pixel but doesn't have an alpha channel (or at least doesn't use it). The extra byte could easily be completely unused padding.
SoronelHaetir
CC BY-SA 4.0
2022-05-30T20:15:35.777Z
2022-05-30T20:15:35.777Z
Nicol Bolas
<p>I keep running into this phrase when reading specs and tutorials, but I have no idea what &quot;tightly packed&quot; is supposed to mean. Is it simply the opposite of an interleaved buffer? I.e. all the vertex data of a position attribute first, and then the normal attribute data sticked right after it? Or is it something else?</p>
<p>For instance, from <a href="https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html" rel="nofollow noreferrer">the glTF spec</a>:</p>
<blockquote>
<p>If the accessor is used for any other kind of data (vertex indices, animation keyframes, etc.), its data elements are tightly packed.</p>
</blockquote>

<vertex-buffer-object><buffers>
What does it mean for a buffer to be "tightly packed"?
Jespertheend
# What does it mean for a buffer to be "tightly packed"?

(Asked by: username_0 on 2022-05-30)

I keep running into this phrase when reading specs and tutorials, but I have no idea what "tightly packed" is supposed to mean. Is it simply the opposite of an interleaved buffer? I.e. all the vertex data of a position attribute first, and then the normal attribute data sticked right after it? Or is it something else?

For instance, from [the glTF spec](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html):

> If the accessor is used for any other kind of data (vertex indices, animation keyframes, etc.), its data elements are tightly packed.

**Tags:** vertex-buffer-object, buffers


---

## 1 answers

### Answer by username_1 on 2022-05-30. Score: 2 | Accepted answer

To take an example from the glTF spec you cited:

> The stride, in bytes, between vertex attributes. When this is not defined, data is tightly packed.

The stride of an array is the number of bytes from the start of one element to the start of the next element. If that stride is the same as the byte size of an element, then the array is "tightly packed". This means that there is no space between elements in the array; the byte after one element is the first byte of the next.

What this is saying is that, if you don't specify a stride, then the stride will be computed to be the size of the element type in question.

Interleaved vertex attributes are not "tightly packed" with respect to each other. If you have positions and normals interleaved, the position array is not tightly packed because the byte after one position is not the first byte of the next position.

*However*, you could consider it to be "tightly packed" with respect to an aggregation of the vertex data as a whole. If the byte after one position/normal combination is the first byte of another position/normal combination, then this could be said to be a "tightly packed" array of position/normal aggregates.

> **Comments:**
> **username_2**: Another example of non-tightly packed would be a bitmap that uses 32 bits for each pixel but doesn't have an alpha channel (or at least doesn't use it). The extra byte could easily be completely unused padding.  

---

