NiVO / BY TECHNOGISGermany · Indonesia
Mesh topology interpretation

glTF Triangle Indices: Separate Vertex Counts from Faces in a Drone Mesh

Review indexed TRIANGLES primitives with a constructed six-index example and a bounded Python check before interpreting a drone model summary.

glTF Triangle Indices: Separate Vertex Counts from Faces in a Drone Mesh

Ask which count the model summary describes

A drone-model handoff can include a vertex total, an index count and a face count that are all different without being contradictory. Before treating the difference as lost geometry, identify the object and representation each number describes. This tutorial focuses on one indexed glTF 2.0 primitive using TRIANGLES mode. It demonstrates a constructed index sequence and a small check over already decoded integers. It does not read a project model, certify a reconstructed surface or establish that a particular NiVO processing system exports glTF. Preserve the accepted model revision and the original report before comparing a new viewer summary.

Ask whether the report concerns one primitive, an entire mesh, a selected node instance or an application-specific conversion. A viewer may summarize a different scope from the exporter, especially when several materials or instances are involved. Keep those scopes visible rather than choosing whichever total seems more detailed. A high count does not establish a better reconstructed surface, and a lower display count is not sufficient evidence that observations were removed. Identify the actual producing application and receiving tool, retain their reports, and agree on the geometry question that the count comparison is intended to answer.

Follow the primitive references to their accessors

The glTF specification defines a primitive attributes dictionary and an optional indices property. These values refer to accessors: the indices property itself is not a vertex number or a face count. POSITION identifies the position accessor for that primitive, while an indexed primitive obtains its vertex references from the separate index accessor. For the reviewed core structure, that accessor uses scalar unsigned integer components. Establish those relationships in an actual model before interpreting a count. A JSON number naming an accessor should never be mistaken for the number of geometric elements contained in the referenced binary data.

The primitive mode is equally important. Khronos defines mode four as TRIANGLES and makes it the default when the property is omitted. Its official mesh tutorial explains consecutive groups of three indices for that mode. Other modes describe different topology, so this grouping must not be applied to every primitive indiscriminately. Record the declared mode or the applicable default with the count finding. The narrow recipe deliberately stops outside mode four rather than inventing a conversion rule for strips, fans, lines or points. Such a stop marks the recipe boundary; it does not make another supported glTF mode invalid.

NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors
NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Trace six references to four constructed positions

Consider an invented position collection with four entries, numbered zero through three. Let the decoded index sequence be zero, one, two, two, one, three. In TRIANGLES mode the first group references positions zero, one and two; the second references positions two, one and three. The sequence has six entries and two triangle groups while reusing four available positions. No additional positions are created merely because a reference appears more than once. The illustration is conceptual topology, not a reconstructed NiVO mesh, a field measurement or evidence about the geometric accuracy of a real model.

This example also explains why dividing a position count by three is not the correct indexed-triangle calculation. The grouping concerns index entries, and references may reuse positions across several triangles. Conversely, counting every index entry as a unique vertex would overstate the distinct referenced positions in this constructed case. Keep the terms position entries, index entries and triangle groups separate in a report. A full model can involve additional attributes and duplication for reasons outside this small example. Do not infer original survey observations, unique physical surface locations or reconstruction quality from one of these storage counts alone.

Check the already decoded triangle groups in Python

The following function accepts an integer position count, a list of already decoded index integers and the reviewed primitive mode. It checks the list length and reference range before grouping the entries. It preserves repeated-index groups and reports their locations rather than deleting or repairing them. This is an educational consistency check, not a binary accessor decoder or a complete glTF validator. It does not inspect component storage limits, primitive-restart restrictions, sparse accessors, compression, attribute alignment or extension behavior. Obtain decoded values through an appropriate reader when applying this reasoning to an actual asset and retain that reader context.

Run the function in memory to inspect the constructed sequence. The expected result contains two triangle tuples, six index entries and four position entries. An out-of-range reference or an incomplete group causes the narrow check to stop. Those cases demonstrate explicit bounds in the teaching procedure, not a diagnosis of a supplied project. A successful result does not prove the triangles have nonzero area, consistent orientation or a suitable spatial reference. The function deliberately lacks coordinate data, so it cannot assess those geometric properties. Keep its output tied to the limited question it actually checks.

def triangle_groups(indices, position_count, mode=4):
    if mode != 4:
        raise ValueError("this recipe handles TRIANGLES mode only")
    if type(position_count) is not int or position_count < 1:
        raise ValueError("expected a positive position count")
    if not indices or len(indices) % 3:
        raise ValueError("expected complete groups of three")
    if any(type(i) is not int or not 0 <= i < position_count for i in indices):
        raise ValueError("index outside the declared positions")
    groups = [tuple(indices[i:i+3]) for i in range(0, len(indices), 3)]
    return {
        "triangles": groups,
        "indexEntries": len(indices),
        "positionEntries": position_count,
        "repeatedIndexTriangles": [i for i, group in enumerate(groups) if len(set(group)) < 3],
    }

# Constructed decoded values, not data read from a model.
print(triangle_groups([0, 1, 2, 2, 1, 3], 4))

Preserve degenerate groups and the original scope

If a triangle group repeats an index, the recipe flags that fact while leaving the sequence unchanged. Do not silently remove the group and then compare the reduced count with an untouched source summary. A triangle can also have zero area when its distinct positions are collinear, which this index-only check cannot detect. Geometry review therefore requires the actual position values and an appropriate method. Keep any candidate repair separate from the received asset and explain why it was proposed. A count that becomes more convenient after deletion is not evidence that the resulting surface better represents the accepted project.

For a model containing several primitives, repeat the interpretation within each appropriate scope before aggregating anything. Preserve mode differences and explain how the report treats scene instances. The same stored mesh may be used through different nodes, so a storage summary and a rendered-scene summary can answer different questions. An analytical review should also retain the model transforms, reference evidence and intended measurement requirements. The triangle grouping alone cannot establish area, volume, terrain completeness or positional accuracy. If those are the actual project questions, request the relevant geometry and acceptance evidence instead of using a face total as a substitute.

Use full validation and receiving tests for acceptance

Khronos provides a glTF Validator that reports specification issues and asset statistics, including checks beyond this teaching function. For an actual handoff, use a suitable supported build and retain the real report, resource-validation settings, diagnostics and input identity. No validator execution on a project model is claimed here. A format report and a receiving-viewer test serve different purposes, and neither alone establishes that the reconstructed surface meets a survey or engineering requirement. Preserve warnings and unsupported extension limits so another reviewer can distinguish a completed structural check from unresolved interpretation or analytical questions.

A useful NiVO model handoff names the accepted asset, primitive scope, mode, accessor relationships, observed counts and the software used to obtain them. Explain whether the stated total concerns stored positions, index entries, triangle groups or displayed instances. Keep the original delivery and any derived candidate separately identified. This makes the comparison reproducible without inventing geometry loss from ordinary index reuse. It also complements transform and texture-dependency reviews while addressing a distinct topology question. The recipient receives a clear account of what the count means, what was actually checked and which additional evidence is required before relying on the model analytically.

Technical references

  1. Khronos glTF2.0: mesh primitive indices and mode ↗
  2. Khronos official tutorial: mesh primitives and triangle grouping ↗
  3. Khronos glTF Validator: supported validation and reporting ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team