KhronosGroup/glTF-Validator

Vertex attribute with UNSIGNED_INT (5125) componentType is not caught by the validator

lilleyse opened this issue · 3 comments

We received a model that has a vertex attribute with the UNSIGNED_INT (5125) componentType which isn't isn't valid according to the glTF spec but passes the validator. The model does not have any extensions.

"gltf_detailedDescription": "The datatype of components in the attribute. All valid values correspond to WebGL enums. The corresponding typed arrays are Int8Array, Uint8Array, Int16Array, Uint16Array, Uint32Array, and Float32Array, respectively. 5125 (UNSIGNED_INT) is only allowed when the accessor contains indices, i.e., the accessor is only referenced by primitive.indices.",

I'm still waiting to see if we can share the model but in the meantime here are some snippets from the glTF.

{
  "bufferView":7,
  "componentType":5125,
  "count":2145,
  "type":"SCALAR",
  "min":[4],
  "max":[4]
}
"primitives": [
  {
    "attributes": {
      "_MaxHandle": 7,
      "NORMAL": 6,
      "_fbx_rotation": 4,
      "TEXCOORD_0": 5,
      "_fbx_scale": 3,
      "_fbx_translation": 2,
      "POSITION": 1
    },
    "indices": 0,
    "mode": 4,
    "material": 0
  }
]

_MaxHandle points to the accessor above.

CC CesiumGS/cesium#9270

We received permission to share the model: TownHall.glb.zip

Hey, quick question on this and apologies if it's a duplicate:

Does this mean all custom integer vertex properties have to use a 16 bit signed int? How does this validator know that the arbitrary vertex property isn't referencing indices? The error message is Mesh attributes cannot use UNSIGNED_INT component type, which is a bit of a different statement than my interpretation of that spec paragraph: Mesh attributes using UNSIGNED_INT must reference indices.

The spec says "unsigned int" in OpenGL-speak, i.e., meaning uint32. All other integer types (signed and unsigned, 8- and 16-bit, including normalized variants) are fine for custom attributes.