NiVO / BY TECHNOGISGermany · Indonesia
Model value tutorial

glTF Normalized Bytes: Read Integer Components Before Comparing a Drone Model

Trace unsigned and signed byte normalization, handle the negative endpoint correctly, and separate numeric interpretation from model scale or vector length.

glTF Normalized Bytes: Read Integer Components Before Comparing a Drone Model

Establish which representation the receiving table displays

A drone-derived model may contain compact integer attributes while a receiving application displays fractional values. Comparing those numbers without reading the accessor interpretation can make a correct representation look inconsistent. Before describing the difference as a changed model, identify whether the table shows stored components or values after the glTF normalized rule has been applied. Keep the asset identity, accessor index, component type, and reader context together. Those details establish the comparison boundary more reliably than copying a number from a preview window without its interpretation.

This tutorial works with already decoded scalar integers in memory. It does not open a model, locate a buffer, or show an actual NiVO attribute. The examples demonstrate unsigned and signed eight-bit conversions only. They are useful during a desk review when an analyst needs to explain why a stored endpoint and an accessed endpoint differ numerically. Attribute meaning, legal use for a particular semantic, resource availability, model coordinates, and project acceptance remain separate questions. The accompanying aircraft photograph provides catalogue context and does not depict a model used in the calculation.

Read component type and normalized as separate declarations

Khronos defines componentType 5120 as signed BYTE and 5121 as UNSIGNED_BYTE. The accessor normalized property controls whether integer values are mapped to the unsigned interval from zero to one or the signed interval from minus one to one when accessed. Its default is false. It must not be true for FLOAT or UNSIGNED_INT accessors. A reader must therefore inspect the declarations together. Knowing that a component occupies one byte is insufficient to decide whether a displayed 1 represents an integer one or a normalized maximum.

The signed endpoint deserves particular attention. The conversion uses division by 127 followed by a lower clamp at minus one for signed bytes. Thus both minus 128 and minus 127 map to minus one, while 127 maps to one. Unsigned bytes use division by 255, so 128 becomes approximately 0.501961. These are defined interpretation rules, not fitted calibration coefficients. Do not replace the denominators with 128 or 256 merely because those values are familiar powers of two; doing so would answer a different numerical question.

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.

Run a strict eight-bit scalar interpretation example

The function below accepts a decoded integer, one of the two supported component types, and an explicit Boolean normalized flag. It rejects Boolean values masquerading as integers, unsupported types, and values outside the selected byte range. When the flag is false, it returns the stored integer unchanged. When true, it applies the corresponding rule. This intentionally narrow profile makes unsupported input visible instead of extending the formula to types that have different ranges or to values that have not actually been decoded from the stated representation.

The demonstration prints four constructed endpoint cases and one unnormalized value. The unsigned maximum becomes 1.0; signed minus 128 and minus 127 both become -1.0; signed 127 becomes 1.0; and the false-flag case remains integer 255. To compare an intermediate value, calculate the unrounded fraction and choose display precision separately. Rounding the example for a report must not silently become an additional transform in the data path. No original bytes are changed and no model output is generated by running this exercise.

def byte_component(value, component_type, normalized):
    if type(component_type) is not int or component_type not in (5120, 5121):
        raise ValueError("This example supports BYTE and UNSIGNED_BYTE only")
    if type(value) is not int or type(normalized) is not bool:
        raise ValueError("Expected an integer and an explicit Boolean flag")
    low, high = (-128, 127) if component_type == 5120 else (0, 255)
    if not low <= value <= high:
        raise ValueError("Value is outside the declared byte range")
    if not normalized:
        return value
    return max(value / 127.0, -1.0) if component_type == 5120 else value / 255.0

# Constructed scalar values, not a complete accessor or actual model.
for value, kind in [(255, 5121), (-128, 5120), (-127, 5120), (127, 5120)]:
    print(value, kind, byte_component(value, kind, True))
print("stored", byte_component(255, 5121, False))

Avoid confusing numeric normalization with other operations

The accessor flag does not mean that a three-component vector is divided by its geometric length. It also does not specify a world-coordinate scale, a unit conversion, or a coordinate reference system. Those operations can produce fractional values too, but they require their own declarations and interpretation. Keep the terminology explicit in a review: this check concerns the numeric mapping of integer components when accessed. If the attribute is a vector, its intended meaning and any requirements on its components must be assessed under the relevant attribute definition rather than inferred from this scalar demonstration.

Likewise, do not apply the mapping twice because two tools display different representations. If a reader has already returned normalized values, dividing them again will change the interpretation. Preserve both the raw decoded integer and the accessed value in a diagnostic table when possible, with clear column labels. Compare like with like before looking for an exporter defect. When the receiving tool does not state which representation it exposes, investigate its documentation or run an appropriate controlled test in that tool. The Python arithmetic alone does not establish another application’s API behavior.

Keep accessor bounds and byte layout in their own checks

The specification states that accessor min and max describe stored component values; the normalized flag does not change those JSON arrays. A reviewer who compares a fractional accessed endpoint with an integer max entry must account for that distinction. Preserve the actual metadata instead of rewriting it to match a display column. If checking bounds, resolve the actual accessor data and the relevant storage rules using a suitable reader. This tutorial does not calculate bounds for a real buffer or validate sparse substitutions, interleaving, or component alignment.

Before applying the scalar function to a real diagnostic, confirm that the integer was decoded from the intended component using the correct byte range and signedness. A stride or offset error can yield an in-range integer that still belongs to the wrong attribute. Perform the layout check separately, then the numeric interpretation check, and finally the comparison relevant to the task. This ordering makes a useful investigation trail: it identifies whether a disagreement arose from reading the wrong bytes, interpreting the right bytes differently, or comparing values with different intended meanings.

Write a model-review conclusion that identifies its scope

A clear finding names the asset revision, accessor, declared component type, normalized flag, stored sample, and calculated accessed value. State the calculation and display precision without describing the result as a measurement of the physical scene. Include the receiving reader version and any independently performed checks needed to connect the diagnostic to that reader. If unsupported component types appear, stop this eight-bit profile and use the applicable rule rather than forcing them through the closest available branch. A visible rejection is more informative than a plausible but unjustified fraction.

For a drone-model handoff, this explanation can resolve an apparent numerical disagreement without altering the accepted source. Retain the original and any diagnostic extracts, then continue the project’s separate checks for attribute meaning, geometry, resources, reference system, and intended analysis. Successful endpoint arithmetic cannot establish survey accuracy or validate the complete model. It establishes a specific interpretation rule that another reviewer can reproduce, helping the team compare the same representation and ask the producer a precise question when a real discrepancy remains.

Technical references

  1. Khronos glTF: accessor normalized, component types and stored bounds ↗
  2. Khronos glTF: normalized integer conversion equations ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team