glTF Accessor Stride: Read the Right Bytes in a Drone Model Review
Trace buffer-view and accessor offsets, honor byteStride, and test a bounded VEC3 FLOAT reader before interpreting a drone model coordinate table.

Identify the accessor before comparing coordinate tables
A drone review model can render correctly in one application while a custom coordinate export contains implausible values. Before changing the geometry or blaming the source reconstruction, check which bytes the custom reader selected. This tutorial examines a dense glTF VEC3 FLOAT vertex attribute with an explicit byte stride. It uses a constructed buffer and selected metadata fragments, not a complete customer model. It does not establish that a particular NiVO system exports glTF, and it does not assess reconstruction quality. Preserve the accepted asset revision and the reader output before testing an alternative interpretation.
Start by tracing the selected primitive attribute to its accessor, buffer view and underlying buffer. Record those identities with the source revision. The coordinate table should identify whether it contains local attribute values or values transformed for a scene instance. A binary layout check addresses the former reading step; it cannot resolve every later transformation or reference-system question. Keep that scope explicit when comparing two tools. A table of readable floating-point numbers is not sufficient evidence that the intended attribute was extracted from the intended locations in the file.
Separate buffer offset, accessor offset and element stride
The Khronos tutorial explains a buffer view as a range of a buffer, with an accessor describing the typed elements inside it. The accessor offset is relative to that view. For interleaved vertex attributes, the view stride gives the spacing between successive element starts. A three-component floating-point element occupies twelve bytes, but the next element can begin farther away. The glTF specification also defines alignment and containment requirements. Read those metadata relationships together instead of treating every collection of floats as tightly packed from the start of the whole buffer.
This distinction is particularly useful when neighboring bytes contain another attribute or padding. A custom reader that advances by the element size can consume those bytes as though they were part of the next coordinate. The resulting values may remain finite and superficially plausible. Confirm the source descriptors rather than choosing a stride that makes the output look familiar. Where the attribute uses sparse storage, compression or another supported representation, use an appropriate implementation. A stop by the narrow recipe below indicates its supported profile, not that every other representation is an invalid glTF asset.

Product context only; this photograph does not depict the constructed examples in this article.
Read a constructed dense VEC3 FLOAT attribute
The teaching buffer is fifty-six bytes long. Its selected view begins at byte eight and spans forty-eight bytes. The accessor begins four bytes into that view, has three elements and uses a sixteen-byte stride. Its element starts are therefore absolute bytes twelve, twenty-eight and forty-four. The final twelve-byte element ends exactly at the view boundary. The four-byte spaces between element starts and their next data blocks are not additional coordinate components. These values are invented solely to make the layout visible, and the descriptor fragments are not presented as a complete conformant model.
The Python function reads an already resolved buffer and the selected descriptors. It checks integer ranges, the supported type, four-byte alignment, stride, view bounds and accessor containment, then decodes explicit little-endian floats. It rejects nonfinite decoded components. The demonstration fills three known vectors into a private in-memory byte array and reads them back. It does not load a GLB, resolve resources or validate the object graph, required metadata, extensions, accessor bounds declarations or the complete asset. The caller must establish the matching descriptor relationships and a suitable uncompressed core vertex attribute before using this approach.
import math, struct
def read_vec3_float(data, view, accessor):
if not isinstance(data, (bytes, bytearray)):
raise ValueError("expected resolved bytes")
if accessor.get("type") != "VEC3" or accessor.get("componentType") != 5126:
raise ValueError("this profile reads VEC3 FLOAT only")
if "sparse" in accessor or accessor.get("normalized", False) is not False:
raise ValueError("outside this dense unnormalized profile")
if view.get("extensions") or accessor.get("extensions"):
raise ValueError("resolve extension semantics separately")
offset = view.get("byteOffset", 0)
length = view["byteLength"]
local = accessor.get("byteOffset", 0)
count = accessor["count"]
stride = view.get("byteStride", 12)
if any(type(v) is not int for v in (offset, length, local, count, stride)):
raise ValueError("integer layout metadata required")
if min(offset, local) < 0 or length <= 0 or count <= 0:
raise ValueError("invalid range in this profile")
if local % 4 or (offset + local) % 4 or stride % 4:
raise ValueError("four-byte alignment required")
if not 12 <= stride <= 252:
raise ValueError("unsupported vertex stride")
if offset + length > len(data):
raise ValueError("view exceeds supplied buffer")
if local + stride * (count - 1) + 12 > length:
raise ValueError("accessor exceeds selected view")
rows = [struct.unpack_from("<3f", data, offset + local + i * stride)
for i in range(count)]
if not all(math.isfinite(v) for row in rows for v in row):
raise ValueError("nonfinite decoded component")
return rows
# Constructed fragments and bytes, not a complete glTF asset.
data = bytearray(56)
for i, point in enumerate([(1, 2, 3), (4, 5, 6), (7, 8, 9)]):
struct.pack_into("<3f", data, 12 + 16 * i, *point)
view = {"buffer": 0, "byteOffset": 8, "byteLength": 48, "byteStride": 16}
accessor = {"bufferView": 0, "byteOffset": 4, "type": "VEC3",
"componentType": 5126, "count": 3}
print(read_vec3_float(data, view, accessor))Check the final element rather than multiplying a record count
For a strided accessor, containment depends on the start of the last element plus that element size. Requiring a complete extra stride after the final vector can reject a valid selected range. Conversely, checking only the total buffer length can allow the reader to cross its selected view into unrelated bytes. Keep both boundaries visible. The recipe checks the view against the supplied buffer and the accessor against the view. Its demonstration ends exactly at the latter boundary, providing a useful case for checking whether a custom implementation has applied the offsets at the correct level.
Do not use a successful bounds check as proof of correct contents. If the descriptor itself is wrong, another layout can still remain within the available bytes. Compare extracted values with the identified source and a trusted implementation on a separately controlled copy. Retain any decoder warnings or unsupported representation findings. Avoid replacing unreadable values with zeros or silently truncating the requested count to fit the file. Such repairs can hide the original discrepancy and create a table that looks complete while losing the relationship needed for an investigation.
Keep local layout findings separate from model measurements
A correctly decoded local vector still needs the intended model context before it supports a measurement. Establish the node instance, transforms and any project reference information through the actual receiving workflow. A layout tutorial does not demonstrate that the model is georeferenced, that its units match a survey deliverable or that its reconstructed surface meets acceptance requirements. The product photograph is context only and does not show the constructed buffer or an actual exported model. Preserve those limits when presenting a coordinate-table comparison in a NiVO technical discussion.
If a custom export differs from a viewer, retain the selected attribute, model revision, reader settings and exact output for both. First compare like-for-like local values, then investigate any deliberate transformations as a separate step. A difference that appears after scene processing should not be repaired by changing byte stride until the raw attribute values agree. Likewise, a raw-byte discrepancy should not be hidden by a later transform. Keeping the stages identifiable gives the producer a specific, reproducible issue to investigate rather than a general complaint that the model coordinates are wrong.
Hand over the layout evidence and supported profile
Include the buffer identity, view range, accessor range, component type, element count, effective stride and byte-order choice with the extracted rows. State whether the data was dense, uncompressed and already resolved before the recipe ran. Preserve exceptions and the original metadata alongside any candidate correction. A recipient should be able to reproduce the first and last element positions without guessing which offsets were added. Full asset validation and a test in the intended receiving application remain separate requirements for accepting a real model delivery.
For NiVO model reviews, this creates a practical bridge between a binary file and a readable coordinate table. The tutorial shows how an explicit stride can differ from element size while retaining a simple, testable example. It complements topology-count and node-transform reviews without repeating their conclusions. Use the layout result to identify which bytes were interpreted, then support any geometric or analytical claim with the appropriate additional evidence. A precise explanation of the reader path is more useful than silently altering the asset until a custom table happens to resemble a familiar scene.



