CesiumGS / gltf-pipeline

Content pipeline tools for optimizing glTF assets. :globe_with_meridians:
Apache License 2.0
1.87k stars 241 forks source link

'Error: Failed adding attribute _FEATURE_ID_0' #647

Closed sui0312feng closed 8 months ago

sui0312feng commented 8 months ago

With dacro (-d) compression, why is 1.glb reporting "'Error: Failed adding attribute _FEATURE_ID_0'" , but 7.glb is correct? What's the difference between 1.glb and 7.glb?

[Uploading t13.zip…]()

sui0312feng commented 8 months ago

t13.zip

lilleyse commented 8 months ago

@sui0312feng what version of gltf-pipeline are you using and what command are you running?

I don't see any errors on main when running:

node bin/gltf-pipeline.js -i ~/Downloads/t13/7.glb -o ~/Desktop/7.glb -d

sui0312feng commented 8 months ago

1.glb has problems

sui0312feng commented 8 months ago

@sui0312feng what version of gltf-pipeline are you using and what command are you running?

I don't see any errors on main when running:

node bin/gltf-pipeline.js -i ~/Downloads/t13/7.glb -o ~/Desktop/7.glb -d

1.glb has problems

lilleyse commented 8 months ago

Ah sorry, I mixed them up. I see the same error for 1.glb.

The model has a lot of validation errors reported by glTF Validator. You may need to fix those issues first. You can ignore the unsupported extension warnings.

sui0312feng commented 8 months ago

Ah sorry, I mixed them up. I see the same error for 1.glb.

The model has a lot of validation errors reported by glTF Validator. You may need to fix those issues first. You can ignore the unsupported extension warnings.

Take a look at this new file, it still reports an error No_0.zip

sui0312feng commented 8 months ago

1699409205909

lilleyse commented 8 months ago

That model also has validation errors (ignore the first two errors)

{
    "uri": "No_0.glb",
    "mimeType": "model/gltf-binary",
    "validatorVersion": "2.0.0-dev.3.8",
    "validatedAt": "2023-11-08T14:32:24.503Z",
    "issues": {
        "numErrors": 23,
        "numWarnings": 0,
        "numInfos": 3,
        "numHints": 0,
        "messages": [
            {
                "code": "UNSUPPORTED_EXTENSION",
                "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_mesh_features'.",
                "severity": 2,
                "pointer": "/extensionsUsed/0"
            },
            {
                "code": "UNSUPPORTED_EXTENSION",
                "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_structural_metadata'.",
                "severity": 2,
                "pointer": "/extensionsUsed/1"
            },
            {
                "code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_UNSIGNED_INT",
                "message": "Mesh attributes cannot use UNSIGNED_INT component type.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_UNEQUAL_ACCESSOR_COUNT",
                "message": "All accessors of the same primitive must have the same count.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_UNSIGNED_INT",
                "message": "Mesh attributes cannot use UNSIGNED_INT component type.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/1/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_UNEQUAL_ACCESSOR_COUNT",
                "message": "All accessors of the same primitive must have the same count.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/1/attributes/_FEATURE_ID_0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (230.96832275390625) does not match actual minimum (230.96800231933594).",
                "severity": 0,
                "pointer": "/accessors/0/min/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 7 element(s) less than declared minimum value 230.96832275390625.",
                "severity": 0,
                "pointer": "/accessors/0/min/0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (92.51856231689453) does not match actual minimum (92.51899719238281).",
                "severity": 0,
                "pointer": "/accessors/0/min/1"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (2.477004051208496) does not match actual minimum (2.4769999980926514).",
                "severity": 0,
                "pointer": "/accessors/0/min/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 3 element(s) less than declared minimum value 2.477004051208496.",
                "severity": 0,
                "pointer": "/accessors/0/min/2"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (233.59295654296875) does not match actual maximum (233.59300231933594).",
                "severity": 0,
                "pointer": "/accessors/0/max/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 7 element(s) greater than declared maximum value 233.59295654296875.",
                "severity": 0,
                "pointer": "/accessors/0/max/0"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (101.70480346679688) does not match actual maximum (101.70500183105469).",
                "severity": 0,
                "pointer": "/accessors/0/max/1"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 1 element(s) greater than declared maximum value 101.70480346679688.",
                "severity": 0,
                "pointer": "/accessors/0/max/1"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (7.69347620010376) does not match actual maximum (7.692999839782715).",
                "severity": 0,
                "pointer": "/accessors/0/max/2"
            },
            {
                "code": "ACCESSOR_INDEX_TRIANGLE_DEGENERATE",
                "message": "Indices accessor contains 120 degenerate triangles (out of 4080).",
                "severity": 2,
                "pointer": "/meshes/0/primitives/0/indices"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (243.03794860839844) does not match actual minimum (243.03799438476562).",
                "severity": 0,
                "pointer": "/accessors/3/min/0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (25.072669982910156) does not match actual minimum (25.072999954223633).",
                "severity": 0,
                "pointer": "/accessors/3/min/1"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (34.28436279296875) does not match actual minimum (34.284000396728516).",
                "severity": 0,
                "pointer": "/accessors/3/min/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 102 element(s) less than declared minimum value 34.28436279296875.",
                "severity": 0,
                "pointer": "/accessors/3/min/2"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (320.7638244628906) does not match actual maximum (320.7640075683594).",
                "severity": 0,
                "pointer": "/accessors/3/max/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 2 element(s) greater than declared maximum value 320.7638244628906.",
                "severity": 0,
                "pointer": "/accessors/3/max/0"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (43.82413101196289) does not match actual maximum (43.82400131225586).",
                "severity": 0,
                "pointer": "/accessors/3/max/1"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (44.782920837402344) does not match actual maximum (44.78300094604492).",
                "severity": 0,
                "pointer": "/accessors/3/max/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 102 element(s) greater than declared maximum value 44.782920837402344.",
                "severity": 0,
                "pointer": "/accessors/3/max/2"
            }
        ],
        "truncated": false
    },
    "info": {
        "version": "2.0",
        "minVersion": "2.0",
        "generator": "zsq",
        "extensionsUsed": [
            "EXT_mesh_features",
            "EXT_structural_metadata"
        ],
        "extensionsRequired": [
            "EXT_mesh_features",
            "EXT_structural_metadata"
        ],
        "resources": [
            {
                "pointer": "/buffers/0",
                "mimeType": "application/gltf-buffer",
                "storage": "glb",
                "byteLength": 182824
            }
        ],
        "animationCount": 0,
        "materialCount": 2,
        "hasMorphTargets": false,
        "hasSkins": false,
        "hasTextures": false,
        "hasDefaultScene": true,
        "drawCallCount": 2,
        "totalVertexCount": 1699,
        "totalTriangleCount": 6768,
        "maxUVs": 0,
        "maxInfluences": 0,
        "maxAttributes": 2
    }
}
javagl commented 8 months ago

A bit more specifically: The given glTF defines the POSITIONS and _FEATURE_ID_0 for the first mesh primitive as

    {
      "bufferView": 0,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 1027,
      "type": "VEC3",
      "max": [
        233.59295654296875,
        101.70480346679688,
        7.69347620010376
      ],
      "min": [
        230.96832275390625,
        92.51856231689453,
        2.477004051208496
      ]
    },
    {
      "bufferView": 1,
      "byteOffset": 0,
      "componentType": 5125,
      "count": 12240,
      "type": "SCALAR",
      "max": [
        4
      ],
      "min": [
        0
      ]
    },

The count for the positions is 1027 (so there basically are 1027 vertices). The count for the feature ID is 12240, but this should also be 1027 then: Each vertex should receive one feature ID.

sui0312feng commented 8 months ago

A bit more specifically: The given glTF defines the POSITIONS and _FEATURE_ID_0 for the first mesh primitive as

    {
      "bufferView": 0,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 1027,
      "type": "VEC3",
      "max": [
        233.59295654296875,
        101.70480346679688,
        7.69347620010376
      ],
      "min": [
        230.96832275390625,
        92.51856231689453,
        2.477004051208496
      ]
    },
    {
      "bufferView": 1,
      "byteOffset": 0,
      "componentType": 5125,
      "count": 12240,
      "type": "SCALAR",
      "max": [
        4
      ],
      "min": [
        0
      ]
    },

The count for the positions is 1027 (so there basically are 1027 vertices). The count for the feature ID is 12240, but this should also be 1027 then: Each vertex should receive one feature ID.

you are right .thanks!

sui0312feng commented 8 months ago

That model also has validation errors (ignore the first two errors)

{
    "uri": "No_0.glb",
    "mimeType": "model/gltf-binary",
    "validatorVersion": "2.0.0-dev.3.8",
    "validatedAt": "2023-11-08T14:32:24.503Z",
    "issues": {
        "numErrors": 23,
        "numWarnings": 0,
        "numInfos": 3,
        "numHints": 0,
        "messages": [
            {
                "code": "UNSUPPORTED_EXTENSION",
                "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_mesh_features'.",
                "severity": 2,
                "pointer": "/extensionsUsed/0"
            },
            {
                "code": "UNSUPPORTED_EXTENSION",
                "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_structural_metadata'.",
                "severity": 2,
                "pointer": "/extensionsUsed/1"
            },
            {
                "code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_UNSIGNED_INT",
                "message": "Mesh attributes cannot use UNSIGNED_INT component type.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_UNEQUAL_ACCESSOR_COUNT",
                "message": "All accessors of the same primitive must have the same count.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_UNSIGNED_INT",
                "message": "Mesh attributes cannot use UNSIGNED_INT component type.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/1/attributes/_FEATURE_ID_0"
            },
            {
                "code": "MESH_PRIMITIVE_UNEQUAL_ACCESSOR_COUNT",
                "message": "All accessors of the same primitive must have the same count.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/1/attributes/_FEATURE_ID_0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (230.96832275390625) does not match actual minimum (230.96800231933594).",
                "severity": 0,
                "pointer": "/accessors/0/min/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 7 element(s) less than declared minimum value 230.96832275390625.",
                "severity": 0,
                "pointer": "/accessors/0/min/0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (92.51856231689453) does not match actual minimum (92.51899719238281).",
                "severity": 0,
                "pointer": "/accessors/0/min/1"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (2.477004051208496) does not match actual minimum (2.4769999980926514).",
                "severity": 0,
                "pointer": "/accessors/0/min/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 3 element(s) less than declared minimum value 2.477004051208496.",
                "severity": 0,
                "pointer": "/accessors/0/min/2"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (233.59295654296875) does not match actual maximum (233.59300231933594).",
                "severity": 0,
                "pointer": "/accessors/0/max/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 7 element(s) greater than declared maximum value 233.59295654296875.",
                "severity": 0,
                "pointer": "/accessors/0/max/0"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (101.70480346679688) does not match actual maximum (101.70500183105469).",
                "severity": 0,
                "pointer": "/accessors/0/max/1"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 1 element(s) greater than declared maximum value 101.70480346679688.",
                "severity": 0,
                "pointer": "/accessors/0/max/1"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (7.69347620010376) does not match actual maximum (7.692999839782715).",
                "severity": 0,
                "pointer": "/accessors/0/max/2"
            },
            {
                "code": "ACCESSOR_INDEX_TRIANGLE_DEGENERATE",
                "message": "Indices accessor contains 120 degenerate triangles (out of 4080).",
                "severity": 2,
                "pointer": "/meshes/0/primitives/0/indices"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (243.03794860839844) does not match actual minimum (243.03799438476562).",
                "severity": 0,
                "pointer": "/accessors/3/min/0"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (25.072669982910156) does not match actual minimum (25.072999954223633).",
                "severity": 0,
                "pointer": "/accessors/3/min/1"
            },
            {
                "code": "ACCESSOR_MIN_MISMATCH",
                "message": "Declared minimum value for this component (34.28436279296875) does not match actual minimum (34.284000396728516).",
                "severity": 0,
                "pointer": "/accessors/3/min/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MIN_BOUND",
                "message": "Accessor contains 102 element(s) less than declared minimum value 34.28436279296875.",
                "severity": 0,
                "pointer": "/accessors/3/min/2"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (320.7638244628906) does not match actual maximum (320.7640075683594).",
                "severity": 0,
                "pointer": "/accessors/3/max/0"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 2 element(s) greater than declared maximum value 320.7638244628906.",
                "severity": 0,
                "pointer": "/accessors/3/max/0"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (43.82413101196289) does not match actual maximum (43.82400131225586).",
                "severity": 0,
                "pointer": "/accessors/3/max/1"
            },
            {
                "code": "ACCESSOR_MAX_MISMATCH",
                "message": "Declared maximum value for this component (44.782920837402344) does not match actual maximum (44.78300094604492).",
                "severity": 0,
                "pointer": "/accessors/3/max/2"
            },
            {
                "code": "ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND",
                "message": "Accessor contains 102 element(s) greater than declared maximum value 44.782920837402344.",
                "severity": 0,
                "pointer": "/accessors/3/max/2"
            }
        ],
        "truncated": false
    },
    "info": {
        "version": "2.0",
        "minVersion": "2.0",
        "generator": "zsq",
        "extensionsUsed": [
            "EXT_mesh_features",
            "EXT_structural_metadata"
        ],
        "extensionsRequired": [
            "EXT_mesh_features",
            "EXT_structural_metadata"
        ],
        "resources": [
            {
                "pointer": "/buffers/0",
                "mimeType": "application/gltf-buffer",
                "storage": "glb",
                "byteLength": 182824
            }
        ],
        "animationCount": 0,
        "materialCount": 2,
        "hasMorphTargets": false,
        "hasSkins": false,
        "hasTextures": false,
        "hasDefaultScene": true,
        "drawCallCount": 2,
        "totalVertexCount": 1699,
        "totalTriangleCount": 6768,
        "maxUVs": 0,
        "maxInfluences": 0,
        "maxAttributes": 2
    }
}

OK