GLTF importer errors on load

Hey!

So I have this GLTF exporter issue now, where the asset doesn’t get loaded correctly, for example:
Go to Babylon.js Playground or download https://corcosoft.com/example-assets/Counter_Wrapper.glb and throw it into https://sandbox.babylonjs.com
I have tried the same asset in https://gltf-viewer.donmccurdy.com and with Windows 3D viewer and seems to work fine there.

Hi @bobalazek

I tried the playground with Chrome and got errors. I tried with Edge and it worked fine.
That’s beyond my knowledge. Asking (again) @Evgeni_Popov for help here :slight_smile:

1 Like

Strange enough, I can reproduce the same issue in Edge.
One additional thing is, that it seems to break since 5.0.0-alpha.18. In 5.0.0-alpha.17 everything still works fine.

Digging into those error messages yesterday, I had found that there are many moving parts on the bee, and each part in each of the 3 animations has a duplicate animation frame on the end. Specifically, the last and second-to-last keyframes appear at the exact same time, which is illegal in glTF. Three and Babylon don’t choke on it, but Cesium and Unity do, and as you can see the glTF Validator also fails the file.

It looks like this file was exported by an older Microsoft glTF writer, and I vaguely remember there may have been a bug fixed some time ago related to duplicated keyframes at the ends of animations. Where did you get this file? Can you export a new copy with a newer version of the exporter?

I just validated the asset with https://github.khronos.org/glTF-Validator and it says that the asset is valid, so I don’t know what you mean.

EDIT: It also doesn’t have any animations.

I downloaded your gltf file and import into blender, I exported GLTF again using blender without modifying anything, here is what I noticed, in gltf-validator for your file it was showing "totalVertexCount": 26820, and after I exported from blender it was showing "totalVertexCount": 30759, , here is a PG with your working file
https://playground.babylonjs.com/#9GFSPZ#1
not sure why it works like this, but you can download the file and compare differences or some other guru if have any clue

Here are results for comparison
FROM YOUR FILE:

{
    "uri": "Counter_Wrapper.glb",
    "mimeType": "model/gltf-binary",
    "validatorVersion": "2.0.0-dev.3.3",
    "validatedAt": "2021-04-24T15:23:45.938Z",
    "issues": {
        "numErrors": 0,
        "numWarnings": 0,
        "numInfos": 5,
        "numHints": 0,
        "messages": [
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/2/primitives/1/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/3/primitives/0/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/5/primitives/1/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/6/primitives/0/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/7/primitives/0/attributes/TEXCOORD_0"
            }
        ],
        "truncated": false
    },
    "info": {
        "version": "2.0",
        "generator": "Khronos glTF Blender I/O v1.5.17",
        "extensionsUsed": [
            "KHR_materials_transmission"
        ],
        "resources": [
            {
                "pointer": "/buffers/0",
                "mimeType": "application/gltf-buffer",
                "storage": "glb",
                "byteLength": 1306612
            },
            {
                "pointer": "/images/0",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/1",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/2",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 512,
                    "height": 512,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/3",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 128,
                    "height": 128,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/4",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/5",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/6",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 256,
                    "height": 256,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/7",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/8",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            }
        ],
        "animationCount": 0,
        "materialCount": 10,
        "hasMorphTargets": false,
        "hasSkins": false,
        "hasTextures": true,
        "hasDefaultScene": true,
        "drawCallCount": 10,
        "totalVertexCount": 26820,
        "totalTriangleCount": 38296,
        "maxUVs": 1,
        "maxInfluences": 0,
        "maxAttributes": 4
    }
}

FROM MY BELNDER EXPORT:

{
    "uri": "Counter_Wrapper.glb",
    "mimeType": "model/gltf-binary",
    "validatorVersion": "2.0.0-dev.3.3",
    "validatedAt": "2021-04-24T15:26:25.493Z",
    "issues": {
        "numErrors": 0,
        "numWarnings": 0,
        "numInfos": 5,
        "numHints": 0,
        "messages": [
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/3/primitives/1/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/5/primitives/1/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/6/primitives/0/attributes/TEXCOORD_0"
            },
            {
                "code": "UNUSED_OBJECT",
                "message": "This object may be unused.",
                "severity": 2,
                "pointer": "/meshes/7/primitives/0/attributes/TEXCOORD_0"
            }
        ],
        "truncated": false
    },
    "info": {
        "version": "2.0",
        "generator": "Khronos glTF Blender I/O v1.5.17",
        "resources": [
            {
                "pointer": "/buffers/0",
                "mimeType": "application/gltf-buffer",
                "storage": "glb",
                "byteLength": 1453452
            },
            {
                "pointer": "/images/0",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/1",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/2",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 512,
                    "height": 512,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/3",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 128,
                    "height": 128,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/4",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/5",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/6",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 256,
                    "height": 256,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/7",
                "mimeType": "image/jpeg",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "bits": 8
                }
            },
            {
                "pointer": "/images/8",
                "mimeType": "image/png",
                "storage": "buffer-view",
                "image": {
                    "width": 64,
                    "height": 64,
                    "format": "rgb",
                    "primaries": "srgb",
                    "transfer": "srgb",
                    "bits": 8
                }
            }
        ],
        "animationCount": 0,
        "materialCount": 10,
        "hasMorphTargets": false,
        "hasSkins": false,
        "hasTextures": true,
        "hasDefaultScene": true,
        "drawCallCount": 10,
        "totalVertexCount": 30759,
        "totalTriangleCount": 38296,
        "maxUVs": 1,
        "maxInfluences": 0,
        "maxAttributes": 4
    }
}

Seems that your version doesn’t have refraction? Because I actually have 2 assets that don’t work and both of those objects have refraction, so it must have something to do with that.

There are some problems with the KHR_materials_transmission extension and instanced meshes.
Here’s the PR:

2 Likes