Skip to content

Draco Compression Issue with EXT_instance_features and EXT_mesh_gpu_instancing Extensions #661

@lanvada

Description

@lanvada

Hello,

I encountered an issue while using Draco's compression feature on a GLB file that utilizes the EXT_instance_features and EXT_mesh_gpu_instancing extensions. After compression, the resulting file appears to be corrupted.

It seems that the buffer view responsible for GPU instancing has been removed in the compressed file's JSON. This removal breaks the model's ability to load correctly and fails format validation checks.

Could you please look into this issue? Any help or guidance on how to address this problem would be greatly appreciated.

Thank you!

Below are the JSON sections of the GLB files before and after compression.

  • JSON before compression:
{
  "asset": { "generator": "[email protected]", "version": "2.0" },
  "scene": 0,
  "scenes": [
    {
      "name": "root scene",
      "nodes": [0],
      "extras": {
        "name": "rac_basic_sample_project",
        "isBIMModel": "true",
        "modelGuid": "f2415188-5743-41f7-9117-8b195905cb43"
      }
    }
  ],
  "nodes": [
    { "name": "root", "children": [1] },
    { "name": "instanced", "children": [2, 3] },
    {
      "name": "705e25a1-127e-4d76-b5f5-4e766ef073a3-000f1bef",
      "mesh": 0,
      "extensions": {
        "EXT_mesh_gpu_instancing": {
          "attributes": {
            "TRANSLATION": 6,
            "ROTATION": 7,
            "SCALE": 8,
            "_FEATURE_ID_0": 9
          }
        },
        "EXT_instance_features": {
          "featureIds": [{ "featureCount": 4, "attribute": 0 }]
        }
      }
    },
    {
      "name": "705e25a1-127e-4d76-b5f5-4e766ef073a3-000f1d9e",
      "mesh": 1,
      "extensions": {
        "EXT_mesh_gpu_instancing": {
          "attributes": {
            "TRANSLATION": 10,
            "ROTATION": 11,
            "SCALE": 12,
            "_FEATURE_ID_0": 13
          }
        },
        "EXT_instance_features": {
          "featureIds": [{ "featureCount": 4, "attribute": 0 }]
        }
      }
    }
  ],
  "meshes": [
    {
      "name": "SM_Dining Chair (3)",
      "primitives": [
        {
          "attributes": { "POSITION": 0, "NORMAL": 1 },
          "indices": 2,
          "material": 0
        }
      ]
    },
    {
      "name": "SM_Dining Chair (3)",
      "primitives": [
        {
          "attributes": { "POSITION": 3, "NORMAL": 4 },
          "indices": 5,
          "material": 0
        }
      ]
    }
  ],
  "accessors": [
    {
      "bufferView": 0,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [0.4006734, 0.7755031, 0.4090699],
      "min": [-0.006043643, -0.0006093467, -0.0308729019]
    },
    {
      "bufferView": 1,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [1.0, 1.0, 0.9998036],
      "min": [-1.0, -1.0, -0.9998036]
    },
    {
      "bufferView": 2,
      "byteOffset": 0,
      "componentType": 5123,
      "count": 23328,
      "type": "SCALAR"
    },
    {
      "bufferView": 3,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [0.4006734, 0.7755031, 0.4090699],
      "min": [-0.006043643, -0.0006093467, -0.0308729019]
    },
    {
      "bufferView": 4,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [1.0, 1.0, 0.9998036],
      "min": [-1.0, -1.0, -0.9998036]
    },
    {
      "bufferView": 5,
      "byteOffset": 0,
      "componentType": 5123,
      "count": 23328,
      "type": "SCALAR"
    },
    {
      "bufferView": 6,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC3"
    },
    {
      "bufferView": 7,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC4"
    },
    {
      "bufferView": 8,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC3"
    },
    {
      "bufferView": 9,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "SCALAR"
    },
    {
      "bufferView": 10,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC3"
    },
    {
      "bufferView": 11,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC4"
    },
    {
      "bufferView": 12,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC3"
    },
    {
      "bufferView": 13,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "SCALAR"
    }
  ],
  "bufferViews": [
    {
      "byteOffset": 0,
      "buffer": 0,
      "byteLength": 57192,
      "byteStride": 12,
      "target": 34962
    },
    {
      "byteOffset": 57192,
      "buffer": 0,
      "byteLength": 57192,
      "byteStride": 12,
      "target": 34962
    },
    { "byteOffset": 114384, "buffer": 0, "byteLength": 46656, "target": 34963 },
    {
      "byteOffset": 161040,
      "buffer": 0,
      "byteLength": 57192,
      "byteStride": 12,
      "target": 34962
    },
    {
      "byteOffset": 218232,
      "buffer": 0,
      "byteLength": 57192,
      "byteStride": 12,
      "target": 34962
    },
    { "byteOffset": 275424, "buffer": 0, "byteLength": 46656, "target": 34963 },
    { "byteOffset": 322080, "buffer": 0, "byteLength": 48, "byteStride": 12 },
    { "byteOffset": 322128, "buffer": 0, "byteLength": 64, "byteStride": 16 },
    { "byteOffset": 322192, "buffer": 0, "byteLength": 48, "byteStride": 12 },
    { "byteOffset": 322240, "buffer": 0, "byteLength": 16, "byteStride": 4 },
    { "byteOffset": 322256, "buffer": 0, "byteLength": 48, "byteStride": 12 },
    { "byteOffset": 322304, "buffer": 0, "byteLength": 64, "byteStride": 16 },
    { "byteOffset": 322368, "buffer": 0, "byteLength": 48, "byteStride": 12 },
    { "byteOffset": 322416, "buffer": 0, "byteLength": 16, "byteStride": 4 }
  ],
  "materials": [
    {
      "name": "M_Phase - Exist",
      "pbrMetallicRoughness": {
        "baseColorFactor": [0.498039216, 0.498039216, 0.498039216, 1.0],
        "metallicFactor": 0.0,
        "roughnessFactor": 0.609375
      },
      "doubleSided": true
    }
  ],
  "buffers": [
    { "name": "53056330-2811-4816-84ba-b5022378e0d3", "byteLength": 322432 }
  ],
  "extensionsUsed": ["EXT_mesh_gpu_instancing", "EXT_instance_features"],
  "extensionsRequired": ["EXT_mesh_gpu_instancing"]
}
  • JSON after compression:
{
  "asset": { "generator": "[email protected]", "version": "2.0" },
  "scene": 0,
  "scenes": [
    {
      "name": "root scene",
      "nodes": [0],
      "extras": {
        "name": "rac_basic_sample_project",
        "isBIMModel": "true",
        "modelGuid": "f2415188-5743-41f7-9117-8b195905cb43"
      }
    }
  ],
  "nodes": [
    { "name": "root", "children": [1] },
    { "name": "instanced", "children": [2, 3] },
    {
      "name": "705e25a1-127e-4d76-b5f5-4e766ef073a3-000f1bef",
      "mesh": 0,
      "extensions": {
        "EXT_mesh_gpu_instancing": {
          "attributes": {
            "TRANSLATION": 6,
            "ROTATION": 7,
            "SCALE": 8,
            "_FEATURE_ID_0": 9
          }
        },
        "EXT_instance_features": {
          "featureIds": [{ "featureCount": 4, "attribute": 0 }]
        }
      }
    },
    {
      "name": "705e25a1-127e-4d76-b5f5-4e766ef073a3-000f1d9e",
      "mesh": 1,
      "extensions": {
        "EXT_mesh_gpu_instancing": {
          "attributes": {
            "TRANSLATION": 10,
            "ROTATION": 11,
            "SCALE": 12,
            "_FEATURE_ID_0": 13
          }
        },
        "EXT_instance_features": {
          "featureIds": [{ "featureCount": 4, "attribute": 0 }]
        }
      }
    }
  ],
  "meshes": [
    {
      "name": "SM_Dining Chair (3)",
      "primitives": [
        {
          "attributes": { "POSITION": 3, "NORMAL": 4 },
          "indices": 2,
          "material": 0,
          "mode": 4,
          "extensions": {
            "KHR_draco_mesh_compression": {
              "bufferView": 2,
              "attributes": { "POSITION": 0, "NORMAL": 1 }
            }
          }
        }
      ]
    },
    {
      "name": "SM_Dining Chair (3)",
      "primitives": [
        {
          "attributes": { "POSITION": 6, "NORMAL": 7 },
          "indices": 5,
          "material": 0,
          "mode": 4,
          "extensions": {
            "KHR_draco_mesh_compression": {
              "bufferView": 3,
              "attributes": { "POSITION": 0, "NORMAL": 1 }
            }
          }
        }
      ]
    }
  ],
  "accessors": [
    {
      "bufferView": 0,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "VEC3"
    },
    {
      "bufferView": 1,
      "byteOffset": 0,
      "componentType": 5126,
      "count": 4,
      "type": "SCALAR"
    },
    { "componentType": 5123, "count": 23328, "type": "SCALAR" },
    {
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [0.40068262341435573, 0.7755149427168185, 0.4090840279070497],
      "min": [
        -0.006055485716818494, -0.000621189416818494, -0.030884744616818494
      ]
    },
    {
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [1.007843137254902, 1.007843137254902, 1.008039537254902],
      "min": [-1.007843137254902, -1.007843137254902, -1.007646737254902]
    },
    { "componentType": 5123, "count": 23328, "type": "SCALAR" },
    {
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [0.40068262341435573, 0.7755149427168185, 0.4090840279070497],
      "min": [
        -0.006055485716818494, -0.000621189416818494, -0.030884744616818494
      ]
    },
    {
      "componentType": 5126,
      "count": 4766,
      "type": "VEC3",
      "max": [1.007843137254902, 1.007843137254902, 1.008039537254902],
      "min": [-1.007843137254902, -1.007843137254902, -1.007646737254902]
    }
  ],
  "bufferViews": [
    { "byteOffset": 0, "buffer": 0, "byteLength": 48, "byteStride": 12 },
    { "byteOffset": 48, "buffer": 0, "byteLength": 16, "byteStride": 4 },
    { "buffer": 0, "byteOffset": 64, "byteLength": 77274 },
    { "buffer": 0, "byteOffset": 77344, "byteLength": 77274 }
  ],
  "materials": [
    {
      "name": "M_Phase - Exist",
      "pbrMetallicRoughness": {
        "baseColorFactor": [0.498039216, 0.498039216, 0.498039216, 1],
        "metallicFactor": 0,
        "roughnessFactor": 0.609375
      },
      "doubleSided": true,
      "emissiveFactor": [0, 0, 0],
      "alphaMode": "OPAQUE"
    }
  ],
  "buffers": [
    { "name": "rac_basic_sample_project_test_draco", "byteLength": 154624 }
  ],
  "extensionsUsed": [
    "EXT_mesh_gpu_instancing",
    "EXT_instance_features",
    "KHR_draco_mesh_compression"
  ],
  "extensionsRequired": [
    "EXT_mesh_gpu_instancing",
    "KHR_draco_mesh_compression"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions